claude/agent/config

Types

Configuration for the agent loop.

pub type AgentConfig {
  AgentConfig(
    client: client.Config,
    model: String,
    max_tokens: Int,
    system: option.Option(String),
    tools: tool.Registry,
    tool_choice: option.Option(tool.ToolChoice),
    thinking: option.Option(Int),
    max_iterations: Int,
    tool_timeout_ms: Int,
  )
}

Constructors

Values

pub fn new(
  client client: client.Config,
  tools tools: tool.Registry,
) -> AgentConfig

Create a new AgentConfig with sensible defaults.

Defaults:

  • model: config.default_model
  • max_tokens: config.default_max_tokens
  • max_iterations: 10
  • tool_timeout_ms: 30_000 (30 seconds)
pub fn with_max_iterations(
  config: AgentConfig,
  max: Int,
) -> AgentConfig

Set the maximum number of agent loop iterations.

pub fn with_max_tokens(
  config: AgentConfig,
  max_tokens: Int,
) -> AgentConfig

Set the max tokens for API calls.

pub fn with_model(
  config: AgentConfig,
  model: String,
) -> AgentConfig

Set the model to use.

pub fn with_system(
  config: AgentConfig,
  system: String,
) -> AgentConfig

Set the system prompt.

pub fn with_thinking(
  config: AgentConfig,
  budget: Int,
) -> AgentConfig

Enable extended thinking with a budget (in tokens).

pub fn with_tool_choice(
  config: AgentConfig,
  choice: tool.ToolChoice,
) -> AgentConfig

Set the tool choice strategy.

pub fn with_tool_timeout(
  config: AgentConfig,
  timeout_ms: Int,
) -> AgentConfig

Set the per-tool execution timeout in milliseconds.

Search Document