Agents
Per-agent profiles are configured under [agents.<name>] in config.toml.
Agent Profile Fields
Defined in crates/core/src/config/toml_types.rs and resolved in crates/core/src/config/resolve.rs.
| Field | Type | Description |
|---|---|---|
model | string | Agent model override. Falls back to [defaults].model. |
provider | string | Agent provider override. Falls back to [defaults].provider. |
instructions | string | Extra instructions for the agent. |
mode | string | Agent mode (default if not set). |
tools_allow | array(string) | Allowlist rules for tools. |
tools_deny | array(string) | Denylist rules for tools. |
mcp_servers | array(string) | MCP servers available to this agent. |
max_turns | integer | Turn cap for this agent. Falls back to session default max turns. |
cwd | path | Agent working directory override. |
worktree | bool | Agent requests worktree isolation in profile config. |
Example
[agents.reviewer]
model = "claude-sonnet-4-5-20250929"
provider = "anthropic"
instructions = "Review code for correctness, risk, and tests"
mode = "default"
tools_allow = ["Read", "Glob", "Grep"]
tools_deny = ["Bash(rm -rf *)"]
mcp_servers = ["github", "docs"]
max_turns = 40
cwd = "/opt/agentbox/projects/swarm"
worktree = trueHow Defaults Are Applied
resolve_toml_agents() applies defaults when fields are omitted:
modelandproviderinherit from[defaults].modeinherits from[defaults].modethen falls back todefault.max_turnsinherits from resolved session default max turns.tools_allow/tools_denydefault to empty lists.worktreedefaults tofalse.
Worktree Isolation Behavior
Runtime worktree creation for spawned agents is controlled by orchestration code in crates/core/src/orchestration_tools/spawn_worker.rs plus git helpers in crates/core/src/worktree/.
should_create_worktree() requires:
- Repository root detected.
- More than one active agent.
- Agent has write capability (empty allowlist or includes write/edit/patch).
When enabled, Swarmie creates and locks a git worktree for the agent, and cleanup on close includes optional auto-commit and worktree prune.
Agent Selection in Runtime
Agent profile data becomes AgentProfile (crates/core/src/config/types.rs) and is consumed by orchestration/session runtime for per-agent behavior.