Skip to main content
Every agent task follows a predictable lifecycle. This page explains each phase, the available status values, and the patterns you can use to interact with a task at each stage.
The lifecycle, status values, and event stream below are identical across agent runtimes — a Codex task and a Claude task move through the same states and emit the same events. Whichever runtime the model (or agent override) selects is transparent to every endpoint on this page.

Lifecycle Overview

Status Values

Once a task reaches a terminal state it will not change again. Poll until you see one of the four terminal statuses.

Phase 1 — Create

Start a task with POST /api/v1/tasks. You receive a runId immediately — the agent begins executing asynchronously.
Save the runId — you’ll use it for every subsequent operation.

Phase 2 — Monitor

You have two options for tracking progress:

Option A — Poll Status (lightweight)

Best for simple integrations. Call GET /api/v1/tasks/:id/status every few seconds:
The progress field (0–100) is a linear estimate based on elapsed time.

Option B — Stream Logs (real-time)

Best for live UIs or CLI output. Connect to the SSE stream and receive events as they happen:

Phase 3 — Retrieve Results

Once completed, fetch the full task details including the conversation history and GitHub context:
Key fields in the response: Extract the agent’s reply:

Phase 4 — Continue (Optional)

Send a follow-up prompt to the same task. The agent receives the full conversation history as context and, if a GitHub repo was involved, continues from the branch it created:
The response contains a new runId for the follow-up run. Use it to track the continuation independently.

Cancel a Running Task

Send a PATCH request with action: "cancel" at any point while the task is queued or running:
Cancelling a task that is already in a terminal state returns success: false.

Multi-Agent Tasks

When you pass selectedAgents with 2–5 entries, each agent gets its own runId. Track each run independently using the same endpoints described above.

Simple — Poll with Backoff

Advanced — Stream + Continue

Create Task

POST /api/v1/tasks

Get Task Status

GET /api/v1/tasks/:id/status

Stream Task Logs

GET /api/v1/tasks/:id/logs/stream

Continue Task

POST /api/v1/tasks/:id/continue

Get Task

GET /api/v1/tasks/:id

Cancel Task

PATCH /api/v1/tasks/:id