Durable agent execution#

Call agent_task_get(task_id, assignment_token, lease_epoch) first. Copy the envelope values exactly and never print the token. The returned context is authoritative for this task; mission_input and instance_checkpoint preserve the user’s request across activations. The creation-time project, collections, tool allowlist and publication permission stay fixed. Ask for missing mission inputs and commit needs_attention with reason: user_input_required.

Run bounded work and commit through agent_task_commit once. result contains:

  • checkpoint: opaque JSON needed when this task resumes.

  • instance_checkpoint: optional confirmed mission inputs and progress needed by later activations.

  • outcome: continue: atomically admit tasks with distinct stable key, input, optional checkpoint and dependencies. An identity reused with different input fails; never hide conflicts with new random keys. A task cannot enqueue itself. id: key:<sibling-key> refers to a sibling.

  • outcome: wait: register at least one dependency and stop. Dependencies are exact owned operation IDs, same-instance task IDs, an aware one-time timer timestamp, or owner-approved catalog, knowledge or manual events. Services checks current operation state, including completion before registration. Do not poll, sleep inside the model turn, or schedule loops.

  • outcome: complete: finish this task with actual receipts and output links in the checkpoint.

  • outcome: needs_attention: retain the checkpoint and an actionable reason. A failure does not authorize silent sleep. The owner can retry or provide the missing input.

dependency_results holds completed predecessor task checkpoints. receipts accepts only operation IDs registered to this instance. A commit is durable even if the final response fails. Replay exactly the same commit after an ambiguous tool response. Conflicting replay and stale leases fail explicitly. Every resumed task uses a fresh bounded session; Services retries missing outcomes three times with 30 seconds between attempts, then requires owner attention.

Owner pause preserves queued messages. Agents cannot invoke pause/resume/stop or owner policy administration. An optional event_selector can narrow collection-event eligibility using exact metadata filters and a Polygon/MultiPolygon within the already-authorized collection scope. Unknown footprints remain eligible; selectors cannot expand scope or execute arbitrary code.

Read discovery and recovery for paginated missions.