GraphIngest SDK Documentation
GraphIngest is a hosted orchestrator for tasks, workflows, and jobs. A job is a list of steps. One step finishes, and the next one starts. The run happens here. This page says what you can do with that list, in plain words, then shows the code.
How a job works Β· If / else Β· Wait Β· Stop Β· Clock Β· Start link Β· Retry one step Β· The run page Β· Slack Β· GitHub
Architecture Overview
extract
@node
transform
@node
load
@node
Quick Start
A complete, copy-paste-ready pipeline. This file does everything: defines nodes, composes them into a graph with retries, fans out in parallel, and deploys to the platform.
# pipeline.py β save this file and run: python pipeline.py
from graphingest import node, graph, deploy, RetryPolicy
import requests
# ββ Step 1: Define your nodes (individual tasks) ββ
@node(name="fetch-page", cache_ttl=3600, max_retries=3)
def fetch_page(url: str) -> dict:
"""Fetch a web page. Cached for 1 hour. Retries 3x on failure."""
resp = requests.get(url, timeout=10)
resp.raise_for_status()
return {"url": url, "status": resp.status_code, "length": len(resp.text)}
@node(name="summarize")
def summarize(page: dict) -> str:
"""Summarize a fetched page."""
return f"Page {page['url']}: {page['length']} chars, status {page['status']}"
# ββ Step 2: Compose nodes into a graph (pipeline) ββ
@graph(
name="web-scraper",
retry_policy=RetryPolicy(
max_retries=2,
delay_seconds=1,
backoff_factor=2,
jitter=True,
),
timeout_seconds=300,
)
def scrape_pipeline(urls: list[str]):
# Fan-out: fetch all URLs in parallel
pages = fetch_page.map(urls)
# Process each result
summaries = [summarize(page) for page in pages]
return {"total": len(summaries), "summaries": summaries}
# ββ Step 3: Deploy and run ββ
deploy() # push code to platform
# Execute the pipeline
result = scrape_pipeline([
"https://example.com",
"https://httpbin.org/get",
"https://jsonplaceholder.typicode.com/posts/1",
])
print(result)
# β {"total": 3, "summaries": ["Page ...: 1256 chars, status 200", ...]}Installation
These commands install a client SDK on your machine. IngestGraph can host Python, JavaScript and TypeScript jobs. The Go and Java SDKs are for client use only. Platform updates do not update your local SDK.
pip install graphingest
# With AI agent support:
pip install graphingest[react]
# With LangGraph integration:
pip install graphingest[langgraph]@node / node()
A node is a single unit of work that runs in isolation. The SDK handles lifecycle management, logging, result serialization, and automatic retries so you can focus on your business logic.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | Function name | Unique key identifying this node |
cache_ttl | int / number | None | Cache TTL in seconds |
max_retries | int / number | 3 | Max automatic retries on failure |
tags | list / string[] | [] | Metadata tags for dashboard |
version | string | None | Semantic version string |
@node(name="extract-data", cache_ttl=3600, max_retries=5, tags=["etl"])
def extract(url: str) -> dict:
response = requests.get(url)
return response.json()
# Async support
@node(name="async-fetch")
async def fetch(url: str) -> dict:
async with httpx.AsyncClient() as client:
resp = await client.get(url)
return resp.json()@graph / graph()
A graph is a pipeline entrypoint β the top-level function that orchestrates nodes with retries (exponential backoff), timeouts, parameter validation, state hooks, run context, and streaming logs.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | Function name | Graph name for dashboard |
retry_policy | RetryPolicy | None | Retry configuration |
timeout | int / number | None | Max execution time (sec / ms) |
on_completion | hook[] | [] | Success callbacks |
on_failure | hook[] | [] | Failure callbacks |
on_cancellation | hook[] | [] | Timeout/cancel callbacks |
tags | list / string[] | [] | Metadata tags |
version | string | None | Semantic version |
.map() β Parallel Fan-Out
Fan-out a node across multiple inputs in parallel. Each input runs as a separate isolated execution. Results are collected in order. Must be called from within a @graph function.
@graph(name="parallel-pipeline")
def pipeline(urls: list[str]):
# Fan-out: dispatches len(urls) parallel workers
results = extract.map(urls)
# results[0] corresponds to urls[0], etc.
return results.submit() β Async Dispatch
Dispatch a single node asynchronously and get a NodeFuture back. The node runs in the background while your graph continues.
@graph(name="async-pipeline")
def pipeline(data: dict):
future = slow_transform.submit(data) # returns immediately
do_other_stuff() # do work while it runs
result = future.result(timeout=120) # block until ready
return resultNodeFuture
| Parameter | Type | Default | Description |
|---|---|---|---|
result() | Any / Promise | β | Block until done, return result |
RetryPolicy
Configurable retry strategy with exponential backoff and jitter to avoid thundering herd.
RetryPolicy(
max_retries=4, # Total retry attempts
delay_seconds=2, # Initial delay
backoff_factor=2.0, # Multiplier per attempt
max_delay_seconds=120, # Upper bound
jitter=True, # Β±50% randomization
)
# Delay formula:
# min(delay Γ backoff^attempt, max_delay) Γ random(0.5, 1.5)Presets
RetryPolicy(max_retries=3, delay_seconds=1, backoff_factor=2)Delays: ~1s, ~2s, ~4sRetryPolicy(max_retries=6, delay_seconds=0.5, backoff_factor=3, max_delay_seconds=60)Delays: ~0.5s, ~1.5s, ~4.5s, ~13.5s, ~40.5s, ~60sRetryPolicy(max_retries=3, delay_seconds=5, backoff_factor=1, jitter=False)Delays: 5s, 5s, 5sSubgraphs
Call a @graph from within another @graph. The child graph gets its own run ID, retry policy, timeout, and hooks β with parent_graph_run_id automatically linked.
@graph(name="sub-etl", retry_policy=RetryPolicy(max_retries=2))
def sub_etl(url: str) -> dict:
data = extract(url)
return transform(data)
@graph(name="main-pipeline")
def main_pipeline(urls: list[str]):
results = []
for url in urls:
result = sub_etl(url) # each creates a child graph run
results.append(result)
return resultsRun Contexts
Thread-safe (Python) / async-safe (TypeScript) context objects available from anywhere inside a running graph or node.
GraphRunContext
@graph(name="my-pipeline", version="2.0", tags=["prod"])
def pipeline(source: str):
ctx = GraphRunContext.get()
ctx.graph_run_id # "uuid-..."
ctx.graph_name # "my-pipeline"
ctx.graph_version # "2.0"
ctx.parameters # {"source": "..."}
ctx.tags # ["prod"]
ctx.parent_graph_run_id # None (or parent's ID)NodeRunContext
@node(name="extract")
def extract(url: str):
ctx = NodeRunContext.get()
ctx.node_run_id # "uuid-..."
ctx.node_key # "extract"
ctx.graph_run_id # parent graph's run ID
ctx.map_index # None (or int if .map())
ctx.retry_count # 0Streaming Logger
Real-time log streaming to the dashboard. Logs appear automatically as your pipeline runs.
import logging
logger = logging.getLogger(__name__)
@node(name="extract")
def extract(url: str):
logger.info("Starting extraction") # β appears in dashboard
logger.warning("Rate limit hit")
logger.error("Connection failed")
# Or use the dedicated logger:
from graphingest import get_run_logger
log = get_run_logger()
log.info("Pipeline started")LangGraph / AI Agent Orchestration
GraphIngest integrates with LangGraph to orchestrate AI agents at scale. Wrap any LangGraph agent as a @node, then use .map() to fan-out agents in parallel.
from graphingest.langgraph import agent_node, agent_graph, AgentConfig
researcher = agent_node(
name="researcher",
graph_builder=build_research_agent,
config=AgentConfig(
model="gpt-4o",
temperature=0.0,
max_iterations=10,
system_prompt="You are a research assistant.",
stream_steps=True,
),
cache_ttl=600,
retries=2,
)
# Use like any node:
result = researcher("What is quantum computing?")
# Fan-out: run 50 agents in parallel
results = researcher.map(["query1", "query2", ..., "query50"])Multi-Agent Pattern
Planner
breaks into N sub-tasks
Researcher
Agent 1
Researcher
Agent 2
Researcher
Agent N
Synthesizer
combines all findings
How a job works
You write a list of steps. Each step has a name, like check. A step can say which earlier step it waits for. That line is depends_on. When the earlier step finishes, this one starts.
You put that list on the flow. Open the flow, or send the list to PATCH /api/flows/$FLOW_ID as task_definitions. One function you deploy is one step. Yes and no, and a wait, are extra steps on this list.
- If / else. The step returns a word. One next step runs. The other is skipped.
- Wait. The job stops until someone calls a link. Nothing keeps running.
- Stop. You end the run. A step that already finished stays finished.
- Clock. The job starts itself at a time you set.
- Start link. One address starts the job. Paste it into a cron route or a form.
- Retry one step. A failed function runs again. A function that already finished stays finished.
- The run page. You open a row and see the input, the result, and the error.
- Slack. A failed job sends you a message.
- GitHub. A file in your repo starts the job, then GitHub's computer turns off.
If / else between steps
One step answers a question. Two steps come after it. Only the step that matches the answer runs. The other one is marked Skipped. The job still finishes.
Yes and no are example words. You can use any short word, such as pass or fail. The word on when has to be the same word the previous step returned. Letters, numbers, a dot, a dash, and an underscore are fine.
Three steps:
checkdoes the work and returns a word.yesruns only when that word isyes.noruns only when that word isno.
[
{
"key": "check",
"name": "Check",
"type": "standard",
"depends_on": ["start"]
},
{
"key": "yes",
"name": "Yes",
"type": "standard",
"depends_on": ["check"],
"when": "yes"
},
{
"key": "no",
"name": "No",
"type": "standard",
"depends_on": ["check"],
"when": "no"
}
]Inside the check step, return the word. Either line is enough:
return "yes"
return {"when": "yes"}branch, choice, and status are read the same way as when. If check returns { "when": "yes" }, the yes step runs. The no step is Skipped, and its row says the previous step said yes. A step that comes after a skipped step is skipped too. Skipped is not a failure.
If check returns a number, a list, or an object with none of those fields, both next steps are skipped. A step that splits into many copies with map cannot also use when.
Try a different output
Open a completed run, choose Tasks, expand the step that produced the decision, and select Try a different output. Choose a next step and edit the two sample JSON outputs to compare their routes.
For example, if the shipping step requires paid, compare {"status":"paid"} with {"status":"declined"}. The first would take the shipping path; the second would skip it. Neither ships anything.
Samples stay in your tab. The preview checks the current flow rule, not the code inside a task. It supports a direct, standard next step with one upstream task, not joins or mapped outputs.
A job can wait, then continue
A step can stop and wait for a message from outside. That can take minutes or a day. Nothing keeps running. The run page shows Waiting. When the message arrives, the waiting step starts.
Put wait_for on the step that should run after the message. The step before it is given signal_url. That function takes signal_url, or **kwargs. Hand that address to whoever will call back. The token in the address is the secret. No API key.
{
"key": "continue",
"name": "Continue",
"type": "standard",
"depends_on": ["ask"],
"wait_for": "answer.ready"
}They call the address. event must be the same name as wait_for. The waiting step receives data as signal.
curl -X POST "$SIGNAL_URL" \
-H "Content-Type: application/json" \
-d '{ "event": "answer.ready", "data": { "ok": true } }'A call that arrives early is saved and used when the step is ready. Add wait_timeout_secondsif you want the step to fail when the call never comes. Leave it off and the run stays Waiting until the call arrives or you press Stop. The run's own time limit does not end a wait. Press Stop and a later call is refused.
On the run page, while the job is Waiting, you see a box. The event is already filled, for example answer.ready. Paste the answer as JSON, such as { "ok": true }, and press Continue. That is the same as the call above. You do not need to find the signal address.
{ "ok": true }Stop a job
Press Stop on the run page, or send the call below. The run stops. A step that already finished stays finished. A step that was still going, or waiting, is cancelled. The next step does not start. A later call to a waiting run is refused.
curl -X PATCH https://www.graphingest.io/api/runs/$RUN_ID \
-H "Authorization: Bearer $GRAPHINGEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "state": "CANCELLING" }'The button stays available while the run is going, including while it is Waiting. The page then shows Cancelled. $RUN_ID is the id on graphingest.io/runs.
A job can start itself
Open the flow and set a clock. Choose Off, Every hour, Every day, or Weekdays, then pick the hour. Times are UTC. Every day at 03:00 starts the job every night. Nothing stays running between jobs. Choose Custom to type your own cron expression, five UTC fields such as */15 * * * * or 0 9 * * 1.
curl -X PATCH https://www.graphingest.io/api/flows/$FLOW_ID \
-H "Authorization: Bearer $GRAPHINGEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "schedule": { "cron": "0 3 * * *" } }'Send { "schedule": null } to clear the clock. The run page says the job started from the clock. GitHub, the API, and the dashboard can still start the same job.
A start link
Open the flow and create a start link. You get one address. Anyone who can POST to that address starts this job. Paste it into a Vercel cron route, a form, Stripe, or GitHub. The caller returns right away. The long work runs here.
curl -X POST https://www.graphingest.io/api/start/$START_TOKEN \
-H "Content-Type: application/json" \
-d '{ "source": "nightly" }'The body is optional. Send a small JSON object if the job needs parameters. Opening the address in a browser does not start the job. The secret is long and stored only as a hash. Rotate or revoke it on the flow page if the address leaks. A paused job refuses the call.
Retry one step
A function inside a deployed job tries again on its own before the job is marked failed. The number of tries is max_retries on that function. The default is 3.
If the job still fails, press Retry on the run. Functions that already finished keep their result and are not run again. The function that failed runs again. The chart keeps the finished boxes and adds a new box for the one that runs.
What you see on a run
Open a run on graphingest.io/runs. Each step is a row. The row says what the step is doing: running, waiting, skipped, failed, or finished.
- The clock moves while the step is going. When it ends, the row shows how long it took.
- Click the row. You see the input that step received, and the result it returned.
- A big result is a link on that row. An https link opens. A stored file address is shown as text.
- A failed step shows the error on that same row.
- The Chart tab draws each step as a box. A function called inside a deployed job shows up as its own box while the job runs. A line points to the step that runs next. The word on the line is the answer that step is waiting for. A pale box was skipped. Click a box to open that step.
- A skipped step says which word the previous step returned, and which word this step was waiting for.
The secret in a wait link is hidden on this page. You still use the real link from the step that was given signal_url.
Start a job from GitHub
You keep a small file in your own GitHub repo. When it runs, GitHub sends a short note to graphingest.io: please start. Then GitHubβs computer turns off. The long work happens here. When it finishes, the mark on that save turns green or red.
Connect GitHub once in Settings. Add two secrets in the repo: GRAPHINGEST_API_KEY and GRAPHINGEST_FLOW_ID. The key is from Settings. The flow id is on graphingest.io/flows.
Save this as .github/workflows/graphingest.yml. The action lives at github.com/graphingest/run.
name: Start a GraphIngest job
on:
workflow_dispatch:
jobs:
start:
runs-on: ubuntu-latest
steps:
- uses: graphingest/run@v1
with:
api-key: ${{ secrets.GRAPHINGEST_API_KEY }}
flow-id: ${{ secrets.GRAPHINGEST_FLOW_ID }}Run it from the Actions tab. The dashboard run says it started from GitHub, and the link opens that save. Change workflow_dispatch to push when you want every save to start the job.
A Slack message when a job fails
The job fails while you are away. You get an email: the job name, the error, a button to retry the failed step, and a link to that run on graphingest.io/runs. The retry button opens a confirm page, then runs the failed step again. Finished steps stay finished. The link works for one week, once. A job that finishes stays quiet. The email is on for the address on your account. Turn it off in Settings.
Slack can get the same message. Open the link and continue from the row that failed.
In Slack, create an incoming webhook for the channel that should hear about failures. The address starts with https://hooks.slack.com/services/. Then send it to GraphIngest with your API key from Settings. The same form is on that Settings page if you would rather paste the address there.
curl -X POST https://www.graphingest.io/api/settings/notifications \
-H "Authorization: Bearer $GRAPHINGEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Slack",
"channel_type": "slack",
"alert_level": "failures_only",
"config": { "webhook_url": "https://hooks.slack.com/services/..." }
}'failures_only is the usual choice. A finished job stays quiet. Use all when you also want a message for a job that finishes. The reply hides most of the webhook address. List what you saved with GET /api/settings/notifications. Send a test with POST /api/settings/notifications/test and the channel id. Remove one with DELETE /api/settings/notifications and { "id": "..." }.
Configuration
Set these on the computer where you call deploy(). You can find your API URL and key in the dashboard settings. A running pipeline receives only the values saved for that pipeline. It does not receive platform settings, and it does not receive another account's values.
| Variable | Required | Description |
|---|---|---|
GRAPHINGEST_API_URL | Yes | Your GraphIngest API endpoint |
GRAPHINGEST_API_KEY | Yes | Your API key (found in dashboard) |
Full Examples
Complete, runnable examples for real-world use cases. Each file is self-contained β copy, set your env vars, and run.
Python12 examples
π Quick Start β Web Scraper
Fan-out 3 URLs, caching, retries, RetryPolicy
β° Vercel Cron Timeout Fix
Cron returns <1s, pipeline runs for hours on Cloud Run
π PDF Report Generation
Background job, job ID, frontend polling pattern
πΌοΈ Image Processing at Scale
10K images in parallel with .map() β minutes not hours
π§ LLM Content Pipeline
ThrottlePolicy + cache to avoid rate limits and $ waste
πΎ Database Migration
Cache makes restart instant β skip already-migrated batches
π ETL Pipeline
Multi-source extract β transform β load with subgraphs
π€ AI Agent
ReAct research agent with search/scrape/summarize tools
π§ LangGraph Fan-Out
Parallel agents, five at a time, with a throttle on the next batch
π Flow Control
Per-user concurrency, throttling, priority queuing
π FastAPI Backend
Dispatch jobs + status polling endpoints + frontend JS
π₯ Multi-Tenant SaaS
Free vs Pro tiers with different limits
TypeScript8 examples
π Quick Start β Web Scraper
Fan-out 3 URLs, caching, retries, RetryPolicy
β° Vercel Cron Timeout Fix
Cron returns <1s, pipeline runs for hours
β±οΈ Vercel Cron Route
Next.js route that returns immediately and dispatches the pipeline
π¦ No Workers
deploy() a TypeScript graph. Nothing stays running when it's idle
π PDF Report Generation
Background job with async dispatch and polling
πΌοΈ Image Processing
10K images in parallel with .map()
π§ LLM Content Pipeline
Throttle + cache for OpenAI rate limits
π ETL Pipeline
Multi-source ETL with subgraphs
Go5 examples
π Quick Start β Web Scraper
Fan-out URLs, caching, RetryPolicy
π ETL Pipeline
Multi-source ETL with .Map() fan-out
β³ Async Jobs
Background jobs with .Submit() and .Map()
π¦ No Workers
deploy() a Go graph. Nothing stays running when it's idle
π― Full Feature Demo
All SDK features: nodes, graphs, subgraphs, futures
Ready to get started?
Deploy your first pipeline in under 5 minutes.