pub struct MultiAgentConfig {
pub enabled: bool,
pub max_sub_agents: usize,
pub max_agent_depth: i32,
pub child_permission_mode: ChildPermissionMode,
pub child_excluded_tools: Vec<String>,
pub child_reasoning_effort: Option<ReasoningEffort>,
pub child_read_only: bool,
}Expand description
Configuration for the multi-agent subsystem.
§Default
Multi-agent is enabled by default with limits of 8 sub-agents and depth 1. Disable it with:
use agent_works::AgentBuilder;
let agent = AgentBuilder::new(client)
.without_multi_agent()
.build()?;§Limits
Limits only take effect when enabled is true.
Fields§
§enabled: boolEnable multi-agent capabilities.
When true (default): all 6 multi-agent tools are registered, and the main
agent’s system prompt is augmented with usage guidance.
When false: no multi-agent tools are registered, and the system
prompt does not mention multi-agent capabilities.
max_sub_agents: usizeMaximum number of concurrent sub-agents.
Default: 8. Only enforced when enabled is true.
max_agent_depth: i32Maximum nesting depth for sub-agents.
Default: 1 (only direct children of root can spawn). A value of 0 means
no sub-agents can be spawned at all. Only enforced when enabled is true.
child_permission_mode: ChildPermissionModePermission mode for spawned child agents.
Default: ChildPermissionMode::Full.
child_excluded_tools: Vec<String>Business tool names to EXCLUDE from child agents.
By default children inherit every business tool registered on the parent.
Some tools are inherently root-level (e.g. decompose/merge orchestration):
a leaf agent that lacks spawn_agent should not be handed a “split this into
parallel sub-agents” tool — it would plan work it cannot execute. Mark such
tools here so build_child_runtime skips them, and children do the work
inline instead of trying to orchestrate further.
child_reasoning_effort: Option<ReasoningEffort>Optional reasoning-effort override applied to every child agent.
Child agents do narrow, focused slices, so they rarely need the parent’s
full reasoning depth — and on reasoning-heavy models (deepseek-v4-pro) an
unbounded child can “think” itself into a runaway (30KB+ of reasoning with
no tool call or answer). Setting e.g. ReasoningEffort::Low caps that
cost. None (default) leaves the child on the framework default.
child_read_only: boolWhether child agents are recommended to be read-only.
The framework is domain-agnostic: it cannot classify which business tools
mutate state and which merely read, so this is a prompt-level suggestion
only — it does not remove or gate any tool. When true (default),
[MultiAgentRuntime::build_child_runtime] appends a read-only nudge to
every child’s system prompt, telling it to investigate and report rather
than mutate.
For a hard guarantee, exclude mutating tools at the business layer via
MultiAgentConfig::child_excluded_tools; the framework only suggests
read-only, it cannot enforce it. Set this to false when children are
meant to write (the codex-style symmetric model).
Implementations§
Source§impl MultiAgentConfig
impl MultiAgentConfig
Sourcepub fn enabled() -> MultiAgentConfig
pub fn enabled() -> MultiAgentConfig
Create a config with multi-agent enabled and default limits.
Sourcepub fn with_limits(
max_sub_agents: usize,
max_agent_depth: i32,
) -> MultiAgentConfig
pub fn with_limits( max_sub_agents: usize, max_agent_depth: i32, ) -> MultiAgentConfig
Create a config with multi-agent enabled and custom limits.
Trait Implementations§
Source§impl Clone for MultiAgentConfig
impl Clone for MultiAgentConfig
Source§fn clone(&self) -> MultiAgentConfig
fn clone(&self) -> MultiAgentConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more