Agents
Agents are accessed throughclient.agents. Methods that take agent_id expect the agent UUID used by /api/v1/agent/{agent_id}/...; resolve names once with client.agents.list().
Retrieving agents
Updating agents
Running agents
Simple response
Streaming
event.raw; use that when an agent integration needs the raw SSE payload fields while still consuming the supported typed stream.
Structured output
With conversation context
With run options
Pass current chat request fields directly onRunOptions.
Sub-agent management
knowledge_bases are KB IDs. tool_assignments on create/update are tool names; the explicit assign/remove helpers use a tool UUID.
Direct sub-agent run
Direct sub-agent stream
POST /api/v1/agent/{agent_id}/subagents/{subagent_id}/run. They execute the specialist directly as the root run. Delegated sub-agent calls still occur when the parent agent chooses a sub-agent tool during normal chat.
Tool management
client.agents.tools.delete(agent_id, tool_id_or_name) to remove a tool from an agent. For sub-agent assignments, use client.agents.subagents.unassign_tool(agent_id, subagent_id, tool=tool_id_or_name) so the shared tool definition remains available elsewhere.
Questions
When a run emitsquestion_required, respond with the request ID and answers keyed by question item ID:
questions.respond maps to POST /api/v1/questions/{question_id}/respond. Questions are not a background-task API; they pause the active run until answered or timed out.
Background tasks
Non-blocking tool or sub-agent calls return task handles in the final response metrics and as model-visible tool results:client.background.cancel(task_id). Foreground runs can be cancelled by call_id, by server-side run ID, or by the original conversation/message pair:
get_background_sub_agent_result, fetch_sub_agent_progress, and message_sub_agent. Use fetch_sub_agent_progress for a non-interfering LLM progress answer, and message_sub_agent with mode="send" or mode="send_and_wait" when the parent needs to send an actual message into the child run.
Knowledge base management
Prompt blocks
Context blocks
Properties
| Property | Type | Description | |
|---|---|---|---|
id | str | Agent UUID | |
name | str | Agent name | |
description | `str | None` | Agent description |
system_prompt | `str | None` | System prompt |
llm_config | dict | Model configuration | |
knowledge_bases | list[dict] | Knowledge bases assigned to the agent |

