Skip to main content
Version: 1.15.0

Operate durable AgentWorks runs and interactions

An AgentWorks run is one durable piece of work, permanently pinned to the release, deployment revision, and invoker that started it. The runtime records the run before a worker executes it, and keeps its events, checkpoints, and external-effect decisions in its own SQLite file. A runtime that stops and restarts on the same file continues accepted work from its last checkpoint without repeating an effect it recorded.

How do you start and follow a run?​

Find the deployment id with GET /api/v1/deployments, then start a run on it. Replace <caller-key> with a caller key from the runtime file, and <deployment-id> with the id from the list:

curl --fail -X POST "http://127.0.0.1:8080/api/v1/deployments/<deployment-id>/runs" \
-H "Authorization: Bearer <caller-key>" \
-H "Idempotency-Key: kyc-check-2026-11-17-0042" \
-H "Content-Type: application/json" \
-d '{"input": {"prompt": "Check customer C-1042 before account opening."}}'

The answer is 201 Created with a Location header naming the run, and the run's pins and summary. An excerpt:

{
"id": "0b8f4c2e-6a51-4d3e-9a7c-2f1e8d5b7c90",
"deploymentId": "5d2a9f10-3c4b-4e8a-b1d6-7a0c9e2f4b13",
"releaseId": "9e7c1a42-8b3d-4f5e-a6c0-1d2b3e4f5a67",
"lifecycle": "QUEUED",
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"eventSequence": 1
}

Repeating the same request with the same Idempotency-Key returns the original run instead of starting a second one. A run stays QUEUED until a worker is enabled (agentworks.runs.worker.enabled=true) and the model gateway is configured. Its lifecycle is one of CREATED, QUEUED, ACTIVE, BLOCKED, PAUSED, SUCCEEDED, FAILED, or CANCELLED.

Follow it through these surfaces:

TaskAPICLI
Show pins, state, usage, and resultGET /api/v1/runs/{id}agentworks run show <run-id>
List runs, newest firstGET /api/v1/runsagentworks run list
Page through ordered eventsGET /api/v1/runs/{id}/eventsagentworks events list <run-id>
Follow events liveGET /api/v1/runs/{id}/streamagentworks stream <run-id>
Read the step projectionGET /api/v1/runs/{id}/steps—
CancelPOST /api/v1/runs/{id}/cancelagentworks run cancel
Pause at the next safe boundaryPOST /api/v1/runs/{id}/pauseagentworks run pause
Resume a paused runPOST /api/v1/runs/{id}/resumeagentworks run resume
Plan, then start, a replayGET /api/v1/runs/{id}/replay/plan, POST /api/v1/runs/{id}/replayagentworks replay plan, agentworks replay start

The stream is Server-Sent Events. Each event's id is <runId>:<sequence>; reconnect with Last-Event-ID to continue without a gap. A run that is not in the caller's workspace answers 404, and a run in the wrong state for an action answers 409 with a typed code such as RUN_TERMINAL.

What does pause guarantee?​

A queued run pauses at once. An active run pauses at its next safe boundary: after a checkpoint, before an effect, at a recovery claim, or before a model round. It never pauses while an effect is in doubt. An executor that cannot resume its current exchange without repeating work refuses the pause with 409 PAUSE_UNSAFE; treat that as protection, not as a transient error. Resume returns the same pinned run to the queue.

A caller's pause request, its withdrawal, and a cancel are recorded in the run store in the same transaction as the change, with the caller and how they signed in. A headless runtime serves these records at GET /api/v1/administrative-audit; a runtime enrolled with Flightdeck hands each one to Flightdeck's audit.

What does durable execution guarantee?​

Workers hold fenced leases (agentworks.runs.worker.lease-duration, default 30 seconds) and renew them while a model or tool call is in flight. If a process stops answering for longer than the lease, another worker of the same runtime takes the run over and continues from its recorded state: a tool call that completed is not called again, and its recorded result is used. Only the model call that was in flight is repeated.

No runtime can make an external system exactly-once. If a connection fails after the external action but before its result is recorded, the outcome is recorded as uncertain. Give consequential tools their own idempotency key and a reconciliation operation.

How does a run wait for a person?​

A run can open a typed human interaction and block without holding a worker. The kinds are APPROVAL, QUESTION, SELECTION, FORM, CONFIRMATION, and AUTHORIZATION, and each interaction carries the same run pins as the work that asked. List open ones and answer one:

agentworks interaction list --status OPEN
curl --fail -X POST "http://127.0.0.1:8080/api/v1/interactions/<interaction-id>/response" \
-H "Authorization: Bearer <caller-key>" -H "Content-Type: application/json" \
-d '{"approved": true}'

The body holds exactly one property that matches the kind: approved, answer, optionIds, fields, confirmed, or granted. Only the assigned principal may answer (UNAUTHORIZED_RESPONDER otherwise), and exactly one outcome resumes the run: a repeat is 409 ALREADY_TERMINAL. An operator with RUN_ADMIT can expire an interaction whose deadline has passed (DEADLINE_NOT_REACHED before then), cancel it, or revoke an authorization.

Cancelling a run that waits on a person ends its open interaction in the same transaction, so a late answer is refused. Never put a secret in interaction text, and treat submitted values as untrusted run input.

How do sessions, operations, and child runs resume work?​

  • Sessions (/api/v1/sessions) serialize deduplicated messages for a conversation or an external thread that outlives one request. A message without a runId starts a run on the session's deployment.
  • Durable operations (/api/v1/operations) let a run start a long external activity, release its worker, and continue from an authenticated callback or bounded polling. The terminal result is accepted once.
  • Child runs get their own release and execution identity, a narrowed budget, and recorded parent and root lineage. Parent cancellation propagates, and a child's completion resumes the parent once.
  • Scheduled wake-ups resume an existing run with its original pins; they never re-resolve the deployment.

None of these changes a run's release or deployment pins.

How do A2A tasks map to runs?​

A deployment exposed as an A2A agent (agentworks.a2a.exposures.<id>.*) turns each message/send into a run, admitted exactly as POST /api/v1/deployments/{id}/runs admits it. In 1.15.0:

  • a message naming a task that has not ended is refused with -32004, because a running run does not read new messages;
  • a message naming an ended task starts a new task in the same contextId, which names the ended one in referenceTaskIds;
  • a task is input-required only while its run waits on a person or an authorization, and working otherwise;
  • tasks/cancel cancels the run as the run API does.

Next steps​