v8.0.1 · Interface

agent

Methods exported by an agent. The client calls these. Maps to the JSON-RPC methods listed under "Agent" in the protocol overview: The session lifecycle is resource-shaped: `new-session` / `load-session` / `resume-session` each return an owned [`session`] resource alongside an initial state snapshot. Dropping the `session` closes it; there is no `close-session` method. `session.prompt` is a plain async function that returns the terminal `prompt-response` when the turn ends. Intermediate `session-update`s (agent message chunks, tool-call lifecycle, plan/mode notifications, etc.) flow over `client.notify-session` in the opposite direction.