Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpioneer.dev/llms.txt

Use this file to discover all available pages before exploring further.

Tasks are the durable automation layer in the gateway. A task can run immediately, wait for a schedule, repeat on an interval or cron expression, depend on another task, or be triggered manually or externally. When the executor is agent, the task can create a subagent thread with its own prompt, model, context policy, tool policy, and result contract. Clients use the Tasks API for two different experiences: user-facing automation UI and internal agent orchestration. In both cases the gateway owns task state, run state, retries, write locks, delivery state, and the lineage between parent work and subagent threads.

Methods

MethodParamsResultPurpose
task/createTaskCreateParamsTaskCreateResponseCreate a task and its first trigger.
task/getTaskGetParamsTaskGetResponseLoad one task plus triggers, runs, specs, dependencies, and locks.
task/listTaskListParamsTaskListResponseList tasks in a workspace with optional filters.
task/treeTaskTreeParamsTaskTreeResponseLoad a root task with nested child tasks.
task/eventsTaskEventsParamsTaskEventsResponseRead durable task event history.
task/waitTaskWaitParamsTaskWaitResponseWait for tasks or runs to reach terminal state.
task/cancelTaskCancelParamsTaskCancelResponseCancel a task and optionally its subtree.
task/rescheduleTaskRescheduleParamsTaskRescheduleResponseReplace a task trigger.
task/detachTaskDetachParamsTaskDetachResponseDetach a child task from parent lifecycle.
task/pauseTaskPauseParamsTaskPauseResponsePause active triggers.
task/resumeTaskResumeParamsTaskResumeResponseResume paused triggers.
task/agendaTaskAgendaParamsTaskAgendaResponseQuery upcoming/recent task schedule view.
task/deliveriesTaskDeliveriesParamsTaskDeliveriesResponseQuery task result delivery records and attempts.

Creating An Agent Task

task/create uses mostly camelCase payload fields. The gateway creates the task, stores the trigger, and may also create a run immediately depending on the trigger.
{
  "jsonrpc": "2.0",
  "id": "aaaaaaaaaaaaaaaaaaaaa",
  "method": "task/create",
  "params": {
    "workspaceId": "ws_000000000000000001",
    "ownerKind": "thread",
    "ownerId": "thr_000000000000000001",
    "createdByThreadId": "thr_000000000000000001",
    "createdByTurnId": "trn_000000000000000001",
    "executorKind": "agent",
    "title": "Review the protocol docs",
    "goal": "Check the protocol reference for missing methods and incorrect examples.",
    "priority": 0,
    "trigger": {
      "spec": {
        "kind": "immediate"
      }
    },
    "agentSpec": {
      "agentRole": "Reviewer",
      "agentNickname": "Protocol reviewer",
      "model": "gpt-5.1",
      "modelProvider": "openai",
      "prompt": {
        "goal": "Review the Protocol Reference section.",
        "instructions": [
          "Compare the docs with pioneer-protocol types.",
          "Report incorrect method names, payload casing, or missing lifecycle notes."
        ],
        "outputInstructions": "Return a concise Markdown review."
      },
      "contextPolicy": {
        "mode": "inherit_parent",
        "includeParentSummary": true,
        "includeArtifacts": true
      },
      "toolPolicy": {
        "allowedTools": ["grep", "file_read"],
        "deniedTools": [],
        "writeMode": "read_only",
        "allowedPaths": ["/Users/alexander/Code/pioneer"],
        "networkAccess": false
      },
      "resultContract": {
        "format": "markdown",
        "required": true
      },
      "depth": 1,
      "maxDepth": 2
    }
  }
}
Important create fields:
FieldMeaning
workspaceIdGateway workspace that owns the task.
ownerKind, ownerIdLogical owner: user, thread, workspace, or system.
createdByThreadId, createdByTurnIdOptional lineage back to the turn that created the task.
parentTaskIdOptional parent for task trees and subagent orchestration.
executorKindagent, tool, workflow, webhook, or system.
title, goalHuman-facing title and durable goal.
priorityHigher-level scheduling hint. Defaults to 0.
triggerWhen and how the task should run.
agentSpecRequired for agent-style subagent work.
lifecyclePolicyParent/child attachment and completion behavior.
deliveryPolicyWhere the result should be delivered.
retryPolicy, timeoutPolicy, concurrencyPolicyExecution controls.
metadataLabels and structured custom data.
Response:
{
  "task": {
    "id": "tsk_000000000000000001",
    "workspaceId": "ws_000000000000000001",
    "ownerKind": "thread",
    "ownerId": "thr_000000000000000001",
    "executorKind": "agent",
    "status": "Queued",
    "title": "Review the protocol docs",
    "goal": "Check the protocol reference for missing methods and incorrect examples.",
    "priority": 0,
    "revision": 1,
    "createdAt": 1777900000,
    "updatedAt": 1777900000
  },
  "trigger": {
    "id": "trg_000000000000000001",
    "taskId": "tsk_000000000000000001",
    "status": "active",
    "spec": {
      "kind": "immediate"
    },
    "createdAt": 1777900000,
    "updatedAt": 1777900000
  },
  "run": {
    "id": "run_000000000000000001",
    "taskId": "tsk_000000000000000001",
    "runGroupId": "grp_000000000000000001",
    "attemptNumber": 1,
    "runNumber": 1,
    "status": "queued",
    "executorKind": "agent",
    "createdAt": 1777900000,
    "updatedAt": 1777900000
  },
  "agentSpec": {
    "id": "ags_000000000000000001",
    "taskId": "tsk_000000000000000001",
    "agentRole": "Reviewer",
    "agentNickname": "Protocol reviewer",
    "prompt": {
      "goal": "Review the Protocol Reference section.",
      "instructions": [],
      "outputInstructions": "Return a concise Markdown review."
    },
    "depth": 1,
    "maxDepth": 2,
    "createdAt": 1777900000,
    "updatedAt": 1777900000
  }
}
TaskStatus values currently serialize as PascalCase: Draft, Scheduled, Queued, Running, Waiting, Completed, Failed, Cancelled. Many supporting enums use snake_case, so clients should follow the generated schema rather than guessing casing.

Trigger Specs

The trigger.spec object is tagged by kind.
KindExtra fieldsMeaning
immediatenoneQueue as soon as the task is created.
scheduled_atscheduled_at, optional timezoneRun once at a Unix timestamp.
intervalinterval_seconds, optional interval_anchor_atRun repeatedly on an interval.
croncron_expr, timezoneRun repeatedly from a cron expression.
manualoptional allowed_actorCreate task but wait for manual/external start.
externalsource, optional event_type, optional filterRun from an external event source.
dependencypolicyRun after other tasks satisfy a dependency policy.
Example cron trigger:
{
  "spec": {
    "kind": "cron",
    "cron_expr": "0 9 * * 1-5",
    "timezone": "Europe/Moscow"
  }
}
Dependency trigger policy uses mode values all_succeeded, any_succeeded, or all_terminal and a dependsOnTaskIds list.

Subagents

Subagents are represented by agentSpec. They are not just a UI affordance; the gateway uses the spec to create a child thread and run that child thread with bounded context and tools.
FieldMeaning
agentRole, agentNicknameHuman-readable identity for history and task trees.
model, modelProviderOptional model override for this subagent.
prompt.goalMain objective.
prompt.instructionsAdditional instructions.
prompt.inputOptional structured variables, attachments, and references.
prompt.outputInstructionsHow the result should be returned.
contextPolicyWhat parent context the subagent receives.
toolPolicyWhat tools, paths, writes, and network access are allowed.
resultContractExpected result format and optional schema.
depth, maxDepthNesting controls for subagent trees.
Context policy modes are inherit_parent, last_n_turns, summary_only, empty, and custom. Write modes are read_only, workspace_write, scoped_write, and full_access. Result formats are text, markdown, json, and artifact. When a task creates a child thread, task events include child thread lineage. Clients can then show the subagent’s work in the parent task tree and can load the child conversation through Threads API and Turns API.

Policies

Lifecycle policy controls what happens to child tasks when parent work ends:
{
  "attachment": "attached",
  "onParentCancel": "cancel",
  "onParentFailure": "detach",
  "completion": "complete_on_terminal_run"
}
Delivery policy controls where task results go:
{
  "mode": "owner_thread",
  "includeResult": true,
  "format": "summary"
}
Retry, timeout, and concurrency policies are optional, but they are what turn tasks from “run this once” into reliable automation:
{
  "retryPolicy": {
    "maxAttempts": 3,
    "backoff": "exponential",
    "initialDelaySeconds": 30,
    "maxDelaySeconds": 600,
    "retryOn": ["provider", "tool", "timeout"]
  },
  "timeoutPolicy": {
    "queueTimeoutSeconds": 300,
    "runTimeoutSeconds": 1800,
    "heartbeatTimeoutSeconds": 120
  },
  "concurrencyPolicy": {
    "key": "docs-protocol-reference",
    "maxParallelRuns": 1,
    "onConflict": "queue"
  }
}
Write locks are produced by the task runtime when a task needs exclusive write access to a workspace or path. Clients normally display them in diagnostics rather than creating them directly.

Reading Tasks

Use task/get for a detail view:
{
  "jsonrpc": "2.0",
  "id": "bbbbbbbbbbbbbbbbbbbbb",
  "method": "task/get",
  "params": {
    "taskId": "tsk_000000000000000001"
  }
}
Use task/list for a workspace list:
{
  "jsonrpc": "2.0",
  "id": "ccccccccccccccccccccc",
  "method": "task/list",
  "params": {
    "workspaceId": "ws_000000000000000001",
    "ownerKind": "thread",
    "ownerId": "thr_000000000000000001",
    "status": "Running",
    "limit": 50
  }
}
task/tree returns a root TaskTree with nested children. Use it when showing a delegated workflow, because a parent task can fan out into child tasks and each child can have its own run, agent spec, dependencies, write locks, and child thread lineage.
{
  "jsonrpc": "2.0",
  "id": "ddddddddddddddddddddd",
  "method": "task/tree",
  "params": {
    "taskId": "tsk_000000000000000001"
  }
}

Events

task/events returns durable task events with monotonically increasing sequence.
{
  "jsonrpc": "2.0",
  "id": "eeeeeeeeeeeeeeeeeeeee",
  "method": "task/events",
  "params": {
    "taskId": "tsk_000000000000000001",
    "afterSequence": 42
  }
}
Each event has eventType, payload, createdAt, optional runId, optional threadId, and optional turnId. The payload is tagged by kind, with variants for task creation, trigger creation, run start/completion/failure, retries, cancellation, delivery, child thread linking, depth limits, and write-lock state. Use afterSequence for incremental polling after reconnect. Live clients should also listen to task notifications.

Waiting

task/wait is useful for automation clients and for a parent agent waiting on delegated work.
{
  "jsonrpc": "2.0",
  "id": "fffffffffffffffffffff",
  "method": "task/wait",
  "params": {
    "taskIds": ["tsk_000000000000000001"],
    "runIds": [],
    "timeoutMs": 30000,
    "mode": "all_terminal",
    "returnCompleted": true,
    "returnPending": true
  }
}
Response groups terminal and pending work:
{
  "completed": [],
  "failed": [],
  "cancelled": [],
  "pending": [],
  "timedOut": false,
  "totalCount": 1,
  "terminalCount": 1,
  "pendingCount": 0,
  "mode": "all_terminal"
}
Wait modes are all_terminal and any_terminal. A timed-out wait does not cancel the task; it only returns control to the caller.

Cancelling And Lifecycle Changes

Cancel scope controls how far cancellation propagates:
ScopeMeaning
task_onlyCancel only this task.
attached_subtreeCancel this task and attached children. This is the default.
full_subtreeCancel this task and all descendants.
{
  "jsonrpc": "2.0",
  "id": "ggggggggggggggggggggg",
  "method": "task/cancel",
  "params": {
    "taskId": "tsk_000000000000000001",
    "reason": "User cancelled from UI",
    "scope": "attached_subtree"
  }
}
Use task/pause and task/resume for scheduled or recurring tasks. Use task/reschedule to replace the trigger. Use task/detach when a child task should keep running independently of its parent.

Agenda

task/agenda is optimized for “what is coming up” and “what recently ran” screens.
{
  "jsonrpc": "2.0",
  "id": "hhhhhhhhhhhhhhhhhhhhh",
  "method": "task/agenda",
  "params": {
    "workspaceId": "ws_000000000000000001",
    "from": 1777900000,
    "to": 1778504800,
    "triggerKinds": ["cron", "interval", "scheduled_at"],
    "includePaused": true,
    "includeCompleted": false,
    "limit": 100
  }
}
Agenda items include the task, trigger, latest run, latest delivery, goal preview, next/last fire timestamps, recurring flag, delivery mode, and result/error previews.

Deliveries

Delivery records track result handoff after a run: owner thread posts, target thread posts, user notifications, and webhook attempts.
{
  "jsonrpc": "2.0",
  "id": "iiiiiiiiiiiiiiiiiiiii",
  "method": "task/deliveries",
  "params": {
    "workspaceId": "ws_000000000000000001",
    "taskId": "tsk_000000000000000001",
    "statuses": ["pending", "failed"],
    "limit": 50
  }
}
The response contains deliveries and attempts. Use it for a delivery/debug panel and for retry/error visibility in scheduled automation.

Notifications

Task notifications use the same event names as durable task events:
EventMeaning
task/created, task/scheduled, task/queuedTask lifecycle entered created/scheduled/queued state.
task/run/created, task/run/started, task/progressRun lifecycle and progress updates.
task/run/completed, task/run/failed, task/run/cancelledRun terminal updates.
task/run/retry_scheduled, task/run/retry_exhaustedRetry lifecycle updates.
task/completed, task/failed, task/cancelledTask terminal updates.
task/detached, task/rescheduled, task/paused, task/resumedManual lifecycle changes.
task/tree/changedParent/child structure, dependencies, or child thread linkage changed.
task/recoveredRuntime recovered task state.
task/delivery/queued, task/delivery/started, task/delivery/delivered, task/delivery/failed, task/delivery/cancelledResult delivery lifecycle.
task/write_lock/acquired, task/write_lock/released, task/write_lock/blocked, task/write_lock/expiredWrite-lock lifecycle.
Notification params include a context object with workspaceId, taskId, optional runId, optional parent/root ids, optional thread/turn ids, eventId, and sequence. Treat notifications as streaming state changes and use read methods to rebuild exact state when needed.

How Tasks Relate To Turns

Agent turns can create tasks, tasks can create child threads, and child turns can report results back to parent tasks. For rendering a conversation that includes delegated work, combine Turns API turn/timeline with task/tree and task/events. For a task automation screen, use task/agenda, task/list, task/get, and task/deliveries. For an agent orchestration screen, use task/tree, task/events, and child thread links.