Set deadlines and cancel work
Bound agent execution time, control repeated passes and cancel from your code.
Use the setup configuration for these dispatch examples. Choose deadlines before starting unattended work, and decide how you will inspect a retained branch after cancellation. The workflow budget bounds cumulative work separately.
Set task deadlines
Section titled “Set task deadlines”Set deadlines alongside the brief when a task needs tighter limits than the defaults. You can bound the whole agent turn and the time it may remain silent.
If the agent runs longer than 20 minutes, or stays silent for 5, the promise rejects with an OutpostError of code timeout. The sandbox is released; the branch keeps what the agent committed.
Choose a limit
Section titled “Choose a limit”deadlineMs bounds a dispatch’s total duration; idleMs watches its silence. A task attempt uses timeoutMs, while the workflow sets its own deadline with start({ timeoutMs }). Start with a total deadline, then add silence detection only when a long quiet operation should be interrupted.
API reference: DispatchOptions.
Your observe callback receives a stopped event whose reason says which one ended the process: deadline, idle-timeout, completion or aborted.
Cancel from your code
Section titled “Cancel from your code”Pass an AbortSignal. Here, Ctrl+C stops the agent instead of leaving it running in the sandbox.
The promise rejects with the value passed to abort(), here "cancelled by user". AbortSignal.timeout(ms) works the same way for a deadline that spans every pass.
| After a stop | dispatch() | sandbox.dispatch() in a session |
|---|---|---|
| Agent process | Its process group and descendants terminated | Same |
| Sandbox | Released | Still running, ready for the next dispatch |
| Worktree, branch | Kept; recoveryDetails(error) gives both | Kept |
To change the agent’s direction without stopping it, steer it instead.
For this step, follow Repeat the brief until the agent declares it done.
Set Git and file operation deadlines
Section titled “Set Git and file operation deadlines”limits sets deadlines on the Git and file steps around the agent. Pass it to dispatch(), createWorkspace() or createSandbox().
API reference: StageLimits.
Other limits
Section titled “Other limits”- Detect repeated activityStop, warn or redirect an agent repeating tools or edits.
- BudgetsToken and attempt ceilings shared by the tasks of a workflow.
- Concurrency, retries and timeouts
timeoutMsfor each task attempt and for a whole run. - Built-in harness
limitson steps, tool calls and usage of one agent loop. - Sandbox sessions
deadlineMsandsignalon a single command. - Write a brief
expansionMsbounds the shell commands of a file brief. - Steering a running agentChange direction without cancelling.
Limits
Section titled “Limits”- Every duration must be a positive number:
0does not disable a limit. passesabove 1 cannot be combined withresponseorcontinuation.- Stopping an agent does not roll anything back. Commits and files it already wrote stay on the branch.
API: dispatch · DispatchOptions · DispatchResult · StageLimits · recoveryDetails · AgentObservation.

