agentc
GitHubagentc-sh/agentc
agentc
GitHubagentc-sh/agentc
›Introduction
Get started›Concepts in 5 minutes›Build your first agent›Add your first tool›Serve and connect
Concepts›Architecture overview›The manifest›The compilation pipeline›Archetypes›The graph›Tools and capabilities›Runtime libraries›Skills›Agents and prompts›Serving and protocols›Observability
Guides›Author a manifest›Write a tool›Give your agent a filesystem›Control network egress›Connect external tools via MCP›Connect agents via A2A›Use the bash tool›Control tool access with capabilities›Write templated prompts›Manage prompts with Langfuse›Pass context from the client›Configure a model provider›Connect a CopilotKit frontend›Deploy a standalone binary›Deploy with Docker and PostgreSQL›Instrument with OpenTelemetry›Extend code generation with blocks
Reference
Manifest
Runtime
ReAct
HTTP
›Sessions›Messages›Runs›Checkpoints
›Prompt templates›State
›Observability

Runs

The native HTTP endpoints for starting, cancelling, reattaching to, and reading runs.

A run is one execution of the graph within a session. These endpoints list and read runs, start runs either attached to the original streaming request or detached in the background, cancel visible runs, and open live Server-Sent Events streams to active runs.

POST /v1/runs starts an attached run and streams events on the same response. If that response is dropped before the run finishes, the run is cancelled. POST /v1/runs/start starts a detached run and returns its IDs immediately; the run continues after the response is sent. Use GET /v1/runs/{run_id}/events to observe live events from a running run, and PUT /v1/runs/{run_id}/cancel to explicitly cancel a visible run.

Find runs for a session

Find runs for a session with optional filtering and pagination.

GET/v1/sessions/{session_id}/runs

Find runs for a session with optional filtering and pagination.

Path parametersin: path
session_id
string

The session ID.

Query parametersin: query
per_page
integer | nulldefault: 100

Maximum page size.

page
string | null

Opaque cursor for the next page.

ids
string[] | null

Run IDs to filter on.

session_ids
string[] | null

Session IDs to filter on.

statuses
string[] | null

Run statuses to filter on.

created_before
string | null

Filter by creation time.

created_after
string | null

Filter by creation time.

updated_before
string | null

Filter by update time.

updated_after
string | null

Filter by update time.

Responses

Get a run by ID

Get a run by ID.

GET/v1/runs/{run_id}

Get a run by ID.

Path parametersin: path
run_id
string

The run ID.

Responses

Create a new run

Create a new attached run and stream its events back as Server-Sent Events (SSE).

POST/v1/runs

Create a new attached run and stream its events back as Server-Sent Events (SSE).

Request bodyin: body
session_id
string | null

Optional session ID. If omitted, one is generated automatically.

run_id
string | null

Optional run ID. If omitted, one is generated automatically.

checkpoint_id
string | null

Optional checkpoint to start the run from. If omitted, the run continues from the session's latest state.

resume_payload
object | null

Opaque resume data supplied by the graph.

model
ModelConfig | null

Optional model selection, inference, timeout, and retry configuration for this run.

capability_override
CapabilityOverride | null

Optional capability override for this run.

messages
Message[]

Messages that seed the run. At least one message is required.

context_vars
ContextVar[]

Client-supplied context variables.

context
object | null

Initial context object.

tools
ToolDefinition[]

Client-defined tools available to the run.

Responses

curl -X POST http://localhost:8080/v1/runs \
  -H "Content-Type: application/json" \
  -H "X-Tenant-ID: acme" \
  -d '{
    "session_id": "8f3e19d8-3bc0-4fd5-bb02-7ac89af9d7bc",
    "model": {
      "override": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-6",
        "inference_params": {
          "max_tokens": 4096
        }
      },
      "timeout": 30000,
      "retry": {
        "max_attempts": 3,
        "initial_backoff": 250,
        "max_backoff": 5000
      }
    },
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "value": "What is 42 plus 7?" }
        ]
      }
    ]
  }'

The stream keeps the connection alive with periodic keep-alive comments between events. Closing the connection before the run finishes cancels the attached run. A full run looks like this on the wire:

event: run_started
data: {"kind":"run_started","timestamp":1710000000.0,"session_id":"...","run_id":"..."}

event: messages_snapshot
data: {"kind":"messages_snapshot","timestamp":1710000000.1,"messages":[...]}

event: text_message_start
data: {"kind":"text_message_start","timestamp":1710000000.2,"message_id":"..."}

event: text_message_content
data: {"kind":"text_message_content","timestamp":1710000000.3,"message_id":"...","delta":"Hello"}

event: text_message_end
data: {"kind":"text_message_end","timestamp":1710000000.4,"message_id":"..."}

event: run_finished
data: {"kind":"run_finished","timestamp":1710000000.5,"session_id":"...","run_id":"...","status":"completed","interrupt_payload":null,"result":null}

Start a detached run

Start a new run and return immediately with its IDs instead of keeping a streaming response open.

POST/v1/runs/start

Start a detached run and return its run and session IDs.

The request body accepts the same fields as POST /v1/runs. The run continues on the server after the HTTP response is returned. Dropping this request's connection after the response has been sent does not cancel the run.

Request bodyin: body
session_id
string | null

Optional session ID. If omitted, one is generated automatically.

run_id
string | null

Optional run ID. If omitted, one is generated automatically.

checkpoint_id
string | null

Optional checkpoint to start the run from. If omitted, the run continues from the session's latest state.

resume_payload
object | null

Opaque resume data supplied by the graph.

model
ModelConfig | null

Optional model selection, inference, timeout, and retry configuration for this run.

capability_override
CapabilityOverride | null

Optional capability override for this run.

messages
Message[]

Messages that seed the run. At least one message is required.

context_vars
ContextVar[]

Client-supplied context variables.

context
object | null

Initial context object.

tools
ToolDefinition[]

Client-defined tools available to the run.

Responses

curl -X POST http://localhost:8080/v1/runs/start \
  -H "Content-Type: application/json" \
  -H "X-Tenant-ID: acme" \
  -d '{
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "value": "What is 42 plus 7?" }
        ]
      }
    ]
  }'

The response body contains the IDs to use for later lookup, cancellation, or live reattachment:

{
  "run_id": "f7b97459-06a7-4e01-bb91-b8072d40452f",
  "session_id": "8f3e19d8-3bc0-4fd5-bb02-7ac89af9d7bc"
}

Cancel a run

Cancel a visible run by ID.

PUT/v1/runs/{run_id}/cancel

Cancel a run by ID.

Cancellation is idempotent for a run that exists in the caller's tenant. The endpoint returns 204 No Content whether the call transitions a running run to cancelled or the run was already in a terminal state. A run that does not exist and a run that belongs to another tenant both return 404.

Path parametersin: path
run_id
string

The run ID.

Responses

curl -X PUT -o /dev/null -w "%{http_code}\n" \
  http://localhost:8080/v1/runs/f7b97459-06a7-4e01-bb91-b8072d40452f/cancel \
  -H "X-Tenant-ID: acme"

Reattach to run events

Open a live Server-Sent Events stream to a run that is currently running.

GET/v1/runs/{run_id}/events

Stream live events for a running run from this point forward.

Reattachment is live-only. The stream receives events produced after the request attaches; it does not replay events that were produced earlier. Dropping this stream closes only this observer and does not cancel the run. Use PUT /v1/runs/{run_id}/cancel when the client wants to stop the run.

Path parametersin: path
run_id
string

The run ID.

Responses

curl -N http://localhost:8080/v1/runs/f7b97459-06a7-4e01-bb91-b8072d40452f/events \
  -H "X-Tenant-ID: acme"

Only runs with status running can be reattached to. A visible run that has already completed, failed, interrupted, or been cancelled returns 409. A missing run, or a run owned by another tenant, returns 404.

Reattach across replicas

Reattach uses pub/sub to deliver live run events to GET /v1/runs/{run_id}/events streams. By default, generated standalone agents use an in-memory transport with no external service:

export AGENT__PUBSUB__KIND=memory
export AGENT__PUBSUB__CAPACITY=4096

The in-memory transport is process-local. If a deployment has multiple replicas and a reattach request may land on a different process than the one executing the run, configure the Redis-compatible transport:

export AGENT__PUBSUB__KIND=redis
export AGENT__PUBSUB__URL=redis://localhost:6379

Dragonfly can provide that Redis-compatible pub/sub service:

compose.yaml
services:
  dragonfly:
    image: docker.dragonflydb.io/dragonflydb/dragonfly
    ulimits:
      memlock: -1
    ports:
      - 6379:6379

Pub/sub carries live events only. It does not store run history or replay missed events. Cancelling a run is persisted through the shared database and does not depend on pub/sub.

Types

ContextVar

A single client-supplied context variable made available to a run.

ContextVar
description
string

What the variable represents.

value
string

The variable value.

ToolDefinition

A client-defined tool made available to a run.

ToolDefinition
name
string

The tool name.

description
string

What the tool does.

parameters
object

A JSON Schema object describing the tool's parameters.

InferenceParams

Inference parameters for a model request. Every field is optional; omitted fields use the provider or model defaults.

InferenceParams
max_tokens
integer | null

Maximum number of tokens to generate.

temperature
float | null

Sampling temperature.

top_p
float | null

Nucleus sampling probability mass.

top_k
integer | null

Top-k sampling cutoff.

stop_sequences
string[] | null

Sequences that stop generation when produced.

frequency_penalty
float | null

Penalty applied in proportion to how often a token has appeared.

presence_penalty
float | null

Penalty applied to tokens that have already appeared at all.

seed
integer | null

Seed for deterministic sampling.

provider_params
object | null

Provider-specific parameters passed through unchanged.

ModelConfig

Per-run model call configuration. Timeout and retry values supplied here take precedence over manifest and startup defaults independently. Omitted values continue to use the corresponding startup defaults. The override object controls model selection and inference parameters only for this run.

ModelConfig
override
ModelConfigOverride | null

Optional provider, model, and inference parameter overrides.

timeout
integer | null

Maximum time in milliseconds to establish the model response stream. This does not limit the duration of an established stream.

retry
ModelConfigRetry | null

Retry policy for transient failures while establishing the model response stream.

AG-UI clients can supply the same object through forwarded_props.model. It is interpreted by the ReAct adapter and does not add fields to the AG-UI protocol itself.

ModelConfigOverride

Per-run overrides for the agent's configured model. Any omitted field falls back to the manifest configuration.

ModelConfigOverride
provider
string | null

Provider name to use instead of the configured one.

model
string | null

Model identifier to use instead of the configured one.

inference_params
InferenceParams | null

Inference parameter overrides.

ModelConfigRetry

Retry policy for transient failures before the model response stream is established. A response stream that has already started is not retried.

ModelConfigRetry
max_attempts
integer

Maximum number of attempts, including the first request.

initial_backoff
integer

Delay in milliseconds before the first retry.

max_backoff
integer

Maximum base backoff between attempts, in milliseconds. Jitter may add a small delay after the base backoff is capped.

CapabilityOverride

Per-run override for the agent's capability set. The strategy field selects how the supplied capabilities combine with the agent's configured capabilities.

CapabilityOverride
inherit
strategy
string

Use the agent's configured capabilities unchanged.

inherit
extend
strategy
string

Add the listed capabilities to the configured set.

extend
capabilities
string[]

Capabilities to add.

replace
strategy
string

Use only the listed capabilities.

replace
capabilities
string[]

Capabilities to use.

PatchOperation

A single RFC 6902 JSON Patch operation, discriminated by op. State deltas and tool activity updates are expressed as arrays of these operations.

PatchOperation
add
op
string

Adds a value at the target location.

add
path
string

JSON Pointer to the target location.

value
any

The value to add.

remove
op
string

Removes the value at the target location.

remove
path
string

JSON Pointer to the target location.

replace
op
string

Replaces the value at the target location.

replace
path
string

JSON Pointer to the target location.

value
any

The replacement value.

move
op
string

Moves a value from one location to another.

move
from
string

JSON Pointer to the source location.

path
string

JSON Pointer to the target location.

copy
op
string

Copies a value from one location to another.

copy
from
string

JSON Pointer to the source location.

path
string

JSON Pointer to the target location.

test
op
string

Asserts that the target location holds the given value.

test
path
string

JSON Pointer to the target location.

value
any

The value to compare against.

← PreviousMessagesNext →Checkpoints

© 2026 pogue.dev. All rights reserved.

Creative CommonsCC BY 4.0
On this pageFind runs for a sessionGet a run by IDCreate a new runStart a detached runCancel a runReattach to run eventsReattach across replicasTypesContextVarToolDefinitionInferenceParamsModelConfigModelConfigOverrideModelConfigRetryCapabilityOverridePatchOperation

Search docs

Search the agentc documentation