Hanzo
OpenapiAgents

Opens a live agent session in the caller's org — the row every surface (the…

Opens a live agent session in the caller's org — the row every surface (the CLI's outer agent, hanzo.bot, the console, chat) hangs its activity off.

POST /v1/agents/sessions

Addresshttps://api.hanzo.ai/v1/agents/sessions
MethodPOST
Operationpost_agents_sessions
AuthAuthorization: Bearer $HANZO_API_KEY

Opens a live agent session in the caller's org — the row every surface (the CLI's outer agent, hanzo.bot, the console, chat) hangs its activity off. A session with a parentSessionId becomes a subagent of that session and inherits its root, so one flow is one tree; without one it is itself a root. Registering with a terminal status records a session that has already finished.

Request

16 fields, body application/json (required).

FieldInTypeRequiredDescription
accountbodystringAccount is which subscription or API account under that provider served the run, up to 256 characters.
actorbodystringActor is the "org/sub" identity to record the session under, up to 256 characters.
agentbodystringAgent is the label the surface opening this session calls itself by ("hanzo-dev").
cwdbodystringCwd is the directory the session starts in, up to 1024 characters.
hostbodystringExecution context — where this session runs (all optional).
parentSessionIdbodystringParentSessionID makes this a subagent of that session: it inherits the parent's root, so one flow stays one tree.
projectbodystringThe readable build (provenance.go): which product this session builds, and whether its story may be read by the world.
providerbodystringAccount tag — the linked AI account this session ran under (login manager).
publishedbodybooleanPublished opens this session's story to the public build route.
repobodystringRepo is the code being worked on, up to 512 characters.
statusbodystringStatus opens the session in one of running, paused, done or error. Empty means running.
targetbodystringTarget names a run-target the org has registered.
taskRunIdbodystringTaskRunID is that workflow's particular run, same bound.
taskWorkflowIdbodystringTaskWorkflowID links this session to the hanzoai/tasks workflow that executes it, up to 256 characters.
terminalbodystringTerminal is the URL this session's live terminal is published at, so the console can watch it.
titlebodystringTitle is the human line a card shows, up to 512 characters.

Response

StatusBodyMeaning
201sessionViewcreated

201 body — 31 fields.

FieldInTypeAlwaysDescription
accountbodystringAccount is which subscription or API account under that provider served it.
actorbodystringActor is WHO this session belongs to, as "org/sub" — the same identity a run is billed under. A register that names none takes the calling principal.
agentbodystringAgent is the label the surface running this session calls itself by ("hanzo-dev"), up to 128 characters. Required at register.
childrenbodyintegerChildren is the DIRECT fan-out — how many sessions name this one as parent — and not the size of the subtree.
createdAtbodystringCreatedAt is when the row was written, same format.
cwdbodystringCwd is the directory the session is working in NOW, not the one it started in: a linked shell moves around, and a card showing where hanzo link was run…
endedAtbodystringEndedAt is when it reached done or error, same format.
eventsbodyintegerEvents is how many turns the session's log holds, counted at read time.
hostbodystringExecution context (mission-control): the machine/repo/cwd a card shows and the run-target a session is dispatched to.
idbodystringID is the session's handle, minted here as "sess_" + 32 hex characters.
lastEventbodylastEventView
lastEvent.actorbodystringActor is who produced the turn, defaulted to the calling principal when the writer named nobody.
lastEvent.atbodystringAt is when the turn was recorded, RFC 3339 in UTC to the second.
lastEvent.kindbodystringKind is what the turn was, from the log's closed six: message, tool-call, spawn, log, status, control.
lastEvent.previewbodystringPreview is the first 240 bytes of the event's payload, cut without regard for the JSON inside it — it is a string to SHOW, never a value to parse.
lastEvent.seqbodyintegerSeq is that event's position in the session's log — monotonic from 1, per session.
orgbodystringOrg is the caller's OWN tenant, echoed so a client can build the public build URL (/builds/:org/:project) without a second call or a guess.
parentSessionIdbodystringParentSessionID is the session that spawned this one, making this a subagent of it. Empty means this session is a root — a flow of its own.
projectbodystringThe readable build: the product this session built and whether its story is public (provenance.go).
providerbodystringProvider is the linked AI account's provider (claude | codex | hanzo | …) that served this run.
publishedbodybooleanPublished is the author's decision to let anyone read this session's story at the public build route.
repobodystringRepo is the code the session is working on, as the surface reported it.
rootSessionIdbodystringRootSessionID is the top of this session's tree, inherited from the parent and shared by every node in one flow.
startedAtbodystringStartedAt is when the session opened, RFC 3339 in UTC to the second.
statusbodystringStatus is one of exactly four: running, paused, done, error.
targetbodystringTarget is the registered run-target this session is dispatched to — a machine the org claimed, resolved same-org when it was set, so it can never point at…
taskRunIdbodystringTaskRunID is that workflow's particular run.
taskWorkflowIdbodystringTaskWorkflowID is the hanzoai/tasks durable workflow that actually EXECUTES this session — this registry is the view, control and stream layer over it.
terminalbodystringTerminal is where this session can be WATCHED — the URL the machine published for its live terminal.
titlebodystringTitle is the human line a card shows ("ship the landing page"), up to 512 characters.
updatedAtbodystringUpdatedAt is the session's last-activity clock, same format.

Failure carries the platform error shape — see Errors.

Examples

hanzo agents sessions create

Agents API · All Hanzo APIs · Interactive reference

How is this guide?

On this page