Background Work.
Nothing Gets Lost.
Tasks is the durable control plane for long-running agent work. When any tool call is promoted to the background โ because of MCP timeouts, slow upstream APIs, or multi-step plans โ Tasks gives you a task_ref to poll, reattach, inspect, and cancel that work at any time.
5 tools
status ยท wait ยท list ยท result ยท cancel
MCP timeout-safe
auto-promotes before the wall
Cross-session
reattach from any future call
Free forever ยท No credit card required
Five Tools. Complete Background Job Control.
When a tool call is promoted to the background, you get a task_ref. The Tasks suite gives you everything you need to monitor, reattach to, retrieve, and cancel that work.
Check Task State
Returns the current state of a background task identified by its task_ref. Use it for lightweight polling โ it's fast and cheap. Returns the status field (running, completed, failed, cancelled), a status_message, and a suggested poll_interval_ms so your agent knows how frequently to check back.
Capabilities
- Returns status: running | completed | failed | cancelled
- status_message: human-readable progress description
- poll_interval_ms: suggested wait before next status check
- task_ref, started_at, and updated_at timestamps
- Does not fetch the result payload โ use tasks.result for that
- Lightweight โ safe to call frequently in a polling loop
Typical background task lifecycle
How Agents Use Tasks
Any time agent work outlives a single MCP response, Tasks keeps it alive โ and gives your agent the primitives to find it, monitor it, and complete it.
Multi-Step Workflow Orchestration
When flow.into kicks off a plan with more steps than a single MCP response can hold, the gateway promotes the work to a background task. Tasks.wait provides an ergonomic reattach point, and tasks.status lets downstream agents poll without blocking their own context window.
Related Solutions
Long-Running Data Wrangling
Large Frame or Data operations against slow upstream integrations โ pulling thousands of rows from Salesforce, QuickBooks, or a data warehouse โ are promoted to background tasks. Tasks.result delivers the cache_ref once complete, feeding directly into the next pipeline step.
Related Solutions
Human-in-the-Loop Approval Gates
When a workflow reaches a step requiring human approval, the agent detaches and stores a task_ref. The approver reviews asynchronously; the agent later calls tasks.status to check whether the gate has passed, then tasks.result to continue with the approved output.
Related Solutions
Cross-Session Task Recovery
An agent's session ends before a background task completes. In the next session, the agent calls tasks.list to rediscover the task_ref, confirms progress with tasks.status, and picks up exactly where it left off โ no re-running expensive upstream queries.
Related Solutions
Parallel Background Fan-Out
An agent fans out to multiple integrations simultaneously โ each returns a task_ref. It then polls all tasks.status calls in parallel and calls tasks.result on each as they complete, assembling the final output without any single blocking point.
Related Solutions
Governor-Triggered Task Cancellation
A Governor policy detects a runaway agent consuming excessive credits or looping unexpectedly. It issues tasks.cancel on the task_ref from the offending call, terminating the background work before the budget ceiling is breached.
Related Solutions
Tasks Powers Every Long-Running Pattern
Tasks is the connective tissue between DataGrout's orchestration, scheduling, and governance layers โ providing the control plane whenever work runs in the background.
Resilient Multi-Step Pipelines
When a flow.into plan exceeds inline response limits, the gateway promotes it to a background task. Tasks.wait gives the calling agent an ergonomic reattach window. If the window closes, tasks.status keeps the polling loop alive across sessions.
โฆ Multi-step workflows that survive MCP timeouts without losing progress
Background Plan Execution
When discovery.perform kicks off a multi-tool execution plan that gets promoted to background, Tasks tracks the work. Intelligent clients fast-path task-monitoring reads through discovery.perform, so the reattach experience feels seamless.
โฆ Execution plans that don't block โ monitor and retrieve on your schedule
Inspect Scheduled Work In Flight
Scheduler-triggered jobs appear as background tasks with a task_ref. Use tasks.list to surface them, tasks.status to monitor progress mid-run, and tasks.cancel to abort a scheduled job from a separate session โ including from a governor policy handler.
โฆ Full observability and control over scheduled autonomous work
Policy-Driven Task Termination
A Governor budget or loop-detection policy fires mid-execution. The policy handler retrieves the task_ref from context and calls tasks.cancel, terminating the background work immediately. The task transitions to 'cancelled' and the cost bleed stops.
โฆ Hard stop on runaway agent work without manual intervention
Integrate Tasks in Minutes
All five Tasks tools are standard MCP calls โ available via any MCP client or the Conduit SDK.
import asyncio
from datagrout.conduit import Client
async with Client(
"https://gateway.datagrout.ai/servers/{uuid}/mcp",
auth={"bearer": "your-access-token"}
) as client:
# A prior tool call returned a task_ref instead of an inline result
task_ref = prior_response["task_ref"]
while True:
status = await client.perform("data-grout@1/tasks.status@1", {
"task_ref": task_ref
})
state = status["status"]
print(f"State: {state} โ {status.get('status_message', '')}")
if state in ("completed", "failed", "cancelled"):
break
# Respect the suggested poll interval
poll_ms = status.get("poll_interval_ms", 3000)
await asyncio.sleep(poll_ms / 1000)
if state == "completed":
result = await client.perform("data-grout@1/tasks.result@1", {
"task_ref": task_ref
})
return resultAlso available in TypeScript, Rust, Elixir, and Ruby. View Conduit SDK โ
Frequently Asked Questions
What developers ask before integrating Tasks into production agent pipelines.
More questions? Read the full Tasks documentation.
Long-running work belongs in the background.
Tasks gives every agent a durable control plane for background jobs โ so no work is lost to timeouts, and every result is retrievable when you need it.
Free forever ยท No credit card required
