List control

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.

GET /v1/agent/sessions/{id}/control

Addresshttps://api.hanzo.ai/v1/agent/sessions/{id}/control
MethodGET
Operationget_agent_sessions_by_id_control
AuthAuthorization: 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.

FieldInTypeRequiredDescription
idpathstringyesID is the session whose commands are being drained, from the path.
afterqueryinteger—After is the last seq this poller applied; only commands newer than it come back.

Response

StatusBodyMeaning
200agent.controlDrainok
defaultproblem-detailsrefused

200 body — 6 fields.

FieldInTypeAlwaysDescription
commandsbodyagent.controlCommandView[]—Commands is the session's control commands newer than the cursor, oldest first.
commands[].commandbodystring—Command is what was asked, from a closed four: pause, resume, stop, message.
commands[].messagebodystring—Message is the text that came with the command: what to say into the run for message, and the cancellation reason for stop.
commands[].payloadbodyany—Payload is the structured half a caller sent instead of (or beside) Message, embedded as JSON.
commands[].seqbodyinteger (int64)—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 was issued.
cursorbodyinteger (int64)—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 agent sessions control <id>
import { Configuration, AgentApi } from 'hanzoai';

const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAgentSessionsByIdControl({ id: 'id' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentApi(client).get_agent_sessions_by_id_control(id='id')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AgentAPI.GetAgentSessionsByIdControl(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, agent_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = agent_api::get_agent_sessions_by_id_control(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AgentApi(client).getAgentSessionsByIdControl();
curl https://api.hanzo.ai/v1/agent/sessions/<id>/control \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches agent through the agent tool, which names its 38 operations with its own verbs — this one among them, under a name only MCP 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_agents"
         }
       }
     }'

Agent API · All Hanzo APIs · Interactive reference

Was this page useful?