Returns the steering commands (pause/resume/stop/message) recorded against the…
Returns the steering commands (pause/resume/stop/message) recorded against the caller's own session that are newer than the cursor, oldest first, with the…
GET /v1/agents/sessions/{id}/control
| Address | https://api.hanzo.ai/v1/agents/sessions/{id}/control |
| Method | GET |
| Operation | get_agents_sessions_by_id_control |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns the steering commands (pause/resume/stop/message)
recorded against the caller's own session that are newer than the cursor,
oldest first, with the cursor to poll from next. It is how a locally started
hanzo code session — which is not task-backed, so nothing forwards its
commands to an execution engine — consumes what the dashboard posted. Read-only
and bounded at 200 per poll, so a steady poll is cheap and an applied command is
never redelivered.
Request
2 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the session whose commands are being drained, from the path. |
after | query | integer | — | After is the last seq this poller applied; only commands newer than it come back. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | controlDrain | ok |
200 body — 6 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
commands | body | controlCommandView[] | — | Commands is the session's control commands newer than the cursor, oldest first. |
commands[].command | body | string | — | Command is what was asked, from a closed four: pause, resume, stop, message. |
commands[].message | body | string | — | Message is the text that came with the command: what to say into the run for message, and the cancellation reason for stop. Up to 16 KiB. |
commands[].payload | body | any | — | Payload is the structured half a caller sent instead of (or beside) Message, embedded as JSON. |
commands[].seq | body | integer | — | Seq is this command's position in the session's log — the same monotonic number every other turn is ordered by, so a command sits in the transcript where it… |
cursor | body | integer | — | Cursor is the seq to send as after on the next poll — the highest seq in this page, or the cursor sent in when the page is empty. |
Failure carries the platform error shape — see Errors.
Examples
hanzo agents sessions control <id>import { Configuration, AgentsApi } from 'hanzoai';
const api = new AgentsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAgentsSessionsByIdControl({ id: 'id' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentsApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentsApi(client).get_agents_sessions_by_id_control(id='id')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AgentsAPI.GetAgentsSessionsByIdControl(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, agents_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = agents_api::get_agents_sessions_by_id_control(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentsApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new AgentsApi(client).getAgentsSessionsByIdControl();curl https://api.hanzo.ai/v1/agents/sessions/<id>/control \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches agents through the agents tool, which names its 36 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_agent_conversations"
}
}
}'How is this guide?