ares_agent/config.rs
1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4// ============= Agent Configuration =============
5
6/// Agent configuration binding a model to tools and behavior.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct AgentConfig {
9 /// Reference to a model name defined in \[models\].
10 pub model: String,
11
12 /// System prompt for the agent (personality, instructions).
13 #[serde(default)]
14 pub system_prompt: Option<String>,
15
16 /// List of tool names this agent can use.
17 #[serde(default)]
18 pub tools: Vec<String>,
19
20 /// Optional whitelist of tool names this agent is allowed to use.
21 /// If absent, all tools are permitted.
22 #[serde(default, skip_serializing_if = "Option::is_none")]
23 pub allowed_tools: Option<Vec<String>>,
24
25 /// Maximum tool calling iterations before stopping (default: 10).
26 #[serde(default = "default_max_tool_iterations")]
27 pub max_tool_iterations: usize,
28
29 /// Whether to execute tool calls in parallel when possible.
30 #[serde(default)]
31 pub parallel_tools: bool,
32
33 /// Additional agent-specific configuration passed through.
34 #[serde(flatten)]
35 pub extra: HashMap<String, toml::Value>,
36}
37
38fn default_max_tool_iterations() -> usize {
39 10
40}