Skip to main content

Module agent

Module agent 

Source
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.0 becomes None)
  • 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§

AgentWithFallbacksWithCount
An AgentWithFallbacks with a count (post-validation swarm agent slot).
InlineAgentBaseWithFallbacks
An InlineAgentBase with optional fallbacks (no description).
InlineAgentBaseWithFallbacksOrRemoteWithCount
An InlineAgentBaseWithFallbacksOrRemote with a count (pre-validation swarm agent slot).
InlineAgentWithFallbacks
A validated InlineAgent with optional fallbacks (no description).
McpServer
An MCP server that the agent can connect to.
RemoteAgent
A validated remote Agent with metadata and computed content-addressed ID.
RemoteAgentBase
A remote agent base definition with metadata.
RemoteAgentBaseWithFallbacks
A remote agent base definition with description and optional fallbacks.
RemoteAgentWithFallbacks
A validated remote agent with description and optional fallbacks.

Enums§

Agent
A validated Agent, either remote (with metadata) or inline.
AgentBase
An Agent base definition, either remote (with metadata) or inline.
AgentWithFallbacks
A validated agent with optional fallbacks, either remote (with description) or inline.
Continuation
Continuation state for multi-turn agent completions.
InlineAgent
A validated inline Agent with its computed content-addressed ID.
InlineAgentBase
The base inline configuration for an Agent (without computed ID or metadata).
InlineAgentBaseWithFallbacksOrRemote
An agent specification that is either an inline agent base with fallbacks or a remote path reference.
InlineAgentBaseWithFallbacksOrRemoteCommitOptional
Like InlineAgentBaseWithFallbacksOrRemote but with optional commit. Used in request types where commit resolution happens server-side.
InlineAgentRef
A borrowed reference into an InlineAgentBase variant.
OutputMode
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.