Description
The Sandbox Agent API needs an abort/cancel turn endpoint so that clients can stop an in-progress turn without terminating the entire session.
Currently, the only way to stop a running agent is POST /v1/sessions/{sessionId}/terminate, which destroys the session entirely. There's no way to cancel just the current turn and continue the conversation.
Proposed API
Add POST /v1/sessions/{sessionId}/abort that:
- Cancels the in-progress turn (stops the LLM request / agent subprocess work)
- Keeps the session alive so new messages can be sent
- Emits a
session.ended event with reason: "terminated" for the current turn, or a new event type like turn.aborted
Agent support
- OpenCode already has a native
session.abort() API that does exactly this
- Claude Code supports Escape to cancel via stdin
- Codex — needs investigation
- Amp — needs investigation
The daemon would need to translate the universal abort into the appropriate agent-specific mechanism.
Related
- Gigacode ESC cancel: needs to call this endpoint once it exists (see linked gigacode issue)
🤖 Generated with Claude Code
Description
The Sandbox Agent API needs an abort/cancel turn endpoint so that clients can stop an in-progress turn without terminating the entire session.
Currently, the only way to stop a running agent is
POST /v1/sessions/{sessionId}/terminate, which destroys the session entirely. There's no way to cancel just the current turn and continue the conversation.Proposed API
Add
POST /v1/sessions/{sessionId}/abortthat:session.endedevent withreason: "terminated"for the current turn, or a new event type liketurn.abortedAgent support
session.abort()API that does exactly thisThe daemon would need to translate the universal abort into the appropriate agent-specific mechanism.
Related
🤖 Generated with Claude Code