Expand description
Agent definitions, configuration, and completion API types.
An Agent is a fully-specified configuration of a single upstream language model. It encapsulates:
- Model identity (which LLM to use)
- Prompt structure (prefix/suffix messages)
- Decoding parameters (temperature, top_p, etc.)
- Provider preferences and routing
- Output mode, reasoning settings, and verbosity
§Content-Addressed Identity
Agents use content-addressed identifiers - their ID is derived deterministically from their full definition using XXHash3-128. This ensures:
- Two identical definitions always produce the same ID
- IDs can be computed anywhere (server, client, browser via WASM)
- No hidden mutation or “latest version” ambiguity
§Normalization
Before computing an ID, definitions are normalized via InlineAgentBase::prepare:
- Default values are removed (e.g.,
temperature: 1.0becomesNone) - Empty collections are removed
- Collections are sorted for deterministic ordering
Modules§
- claude_
agent_ sdk - codex_
sdk - completions
- Agent completions request and response types.
- mcp_
servers - Functions for working with
McpServers. - mock
- openrouter
- request
- Request types for agent listing endpoints.
- response
- Response types for Agent API endpoints.
- validate
Structs§
- Agent
With Fallbacks With Count - An
AgentWithFallbackswith a count (post-validation swarm agent slot). - Inline
Agent Base With Fallbacks - An
InlineAgentBasewith optional fallbacks (no description). - Inline
Agent Base With Fallbacks OrRemote With Count - An
InlineAgentBaseWithFallbacksOrRemotewith a count (pre-validation swarm agent slot). - Inline
Agent With Fallbacks - A validated
InlineAgentwith optional fallbacks (no description). - McpServer
- An MCP server that the agent can connect to.
- Remote
Agent - A validated remote Agent with metadata and computed content-addressed ID.
- Remote
Agent Base - A remote agent base definition with metadata.
- Remote
Agent Base With Fallbacks - A remote agent base definition with description and optional fallbacks.
- Remote
Agent With Fallbacks - A validated remote agent with description and optional fallbacks.
Enums§
- Agent
- A validated Agent, either remote (with metadata) or inline.
- Agent
Base - An Agent base definition, either remote (with metadata) or inline.
- Agent
With Fallbacks - A validated agent with optional fallbacks, either remote (with description) or inline.
- Continuation
- Continuation state for multi-turn agent completions.
- Inline
Agent - A validated inline Agent with its computed content-addressed ID.
- Inline
Agent Base - The base inline configuration for an Agent (without computed ID or metadata).
- Inline
Agent Base With Fallbacks OrRemote - An agent specification that is either an inline agent base with fallbacks or a remote path reference.
- Inline
Agent Base With Fallbacks OrRemote Commit Optional - Like
InlineAgentBaseWithFallbacksOrRemotebut with optional commit. Used in request types where commit resolution happens server-side. - Inline
Agent Ref - A borrowed reference into an
InlineAgentBasevariant. - Output
Mode - The method used to constrain LLM output to valid response keys.
- Upstream
- Supported agent upstreams.
Functions§
- get_
agent - Retrieves a specific Agent.
- get_
agent_ usage - Retrieves usage statistics for a specific Agent.
- list_
agents - Lists all Agents that have been used.
Type Aliases§
- McpServers
- A list of MCP servers.