Hanzo AI
OpenapiAgents

Stop sessions

Ends a running session. `message` is recorded as the cancellation reason, which is what a later reader of the transcript sees.

POST /v1/agents/sessions/{id}/stop

Addresshttps://api.hanzo.ai/v1/agents/sessions/{id}/stop
MethodPOST
Operationpost_agents_sessions_by_id_stop
AuthAuthorization: Bearer $HANZO_API_KEY

Ends a running session. message is recorded as the cancellation reason, which is what a later reader of the transcript sees.

STOPPING IS NOT DELETING: the session, its transcript and anything it produced stay readable. A session that has already finished is 409 rather than a second stop.

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID is the session to steer, from the path.
idbodystringID is the session to steer, from the path.
messagebodystringMessage is free text for the running agent, up to 16 KiB.
payloadbodyanyPayload is a structured argument for the command: any valid JSON up to 64 KiB, scanned for credentials before it is stored (a hit refuses the command with 422…

Response

StatusBodyMeaning
200controlResultok

200 body — 10 fields.

FieldInTypeAlwaysDescription
commandbodystringCommand is the verb that was recorded: pause, resume, stop or message.
eventbodyeventView
event.actorbodystringActor is who produced the turn.
event.createdAtbodystringCreatedAt is when the turn was recorded, RFC 3339 in UTC to the second.
event.idbodystringID is the event's own handle, minted as "evt_" + 32 hex characters.
event.kindbodystringKind is what the turn IS, from a closed six: message (a model turn), tool-call, spawn (a subagent started), log, status, control (a steering command the…
event.payloadbodyanyPayload is the turn's body, embedded as JSON rather than as a string — whatever the writer sent, up to 64 KiB, checked for well-formedness and scanned for…
event.seqbodyintegerSeq is the turn's position in this session's log: monotonic from 1, assigned by the store inside the insert, and unique PER SESSION rather than globally.
event.sessionIdbodystringSessionID is the session this turn belongs to.
forwardedbodybooleanForwarded is whether the command also reached the durable-execution engine.

Failure carries the platform error shape — see Errors.

Examples

hanzo agents sessions stop <id>

Agents API · All Hanzo APIs · Interactive reference

How is this guide?

On this page