DataGrout.ai Logo
Tool Suite ยท Tasks

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.

tasks.status

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.

Best for: Polling loop: check every N seconds until status is 'completed' or 'failed'

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
๐Ÿ’ณ Minimal cost โ€” metadata read only
View tasks.status docs โ†’

Typical background task lifecycle

1. Call long-running toolโ†’2. Receive task_refโ†’3. tasks.wait (reattach)โ†’4. tasks.status (poll)โ†’5. tasks.result

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.

tasks.waittasks.statustasks.result

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.

tasks.statustasks.result

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.

tasks.listtasks.statustasks.result

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.

tasks.listtasks.statustasks.result

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.

tasks.statustasks.resulttasks.wait

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.

tasks.canceltasks.status
Power-Up Combos

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.

Tasks+Flow

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.

flow.into(plan) โ†’ task_ref promoted โ†’ tasks.wait(task_ref, wait_ms=25000) โ†’ tasks.result

โœฆ Multi-step workflows that survive MCP timeouts without losing progress

Tasks+Discovery

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.

discovery.perform(plan) โ†’ task_ref โ†’ tasks.status (fast-pathed) โ†’ tasks.result

โœฆ Execution plans that don't block โ€” monitor and retrieve on your schedule

Tasks+Scheduler

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.

scheduler.trigger(job_id) โ†’ task_ref โ†’ tasks.list โ†’ tasks.status โ†’ tasks.cancel (if needed)

โœฆ Full observability and control over scheduled autonomous work

Tasks+Governor

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.

governor.policy trigger โ†’ tasks.cancel(task_ref) โ†’ status: 'cancelled'

โœฆ Hard stop on runaway agent work without manual intervention

Conduit SDK

Integrate Tasks in Minutes

All five Tasks tools are standard MCP calls โ€” available via any MCP client or the Conduit SDK.

tasks.status polling loop ยท Python ยท 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 result

Also 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

We use cookies to improve your experience, analyze site traffic, and serve personalized content. You can accept all, decline non-essential cookies, or manage your preferences. See our Privacy Policy for details.

Ask the Advisor