Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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.

FieldTypeDescription
modelstringAgent model override. Falls back to [defaults].model.
providerstringAgent provider override. Falls back to [defaults].provider.
instructionsstringExtra instructions for the agent.
modestringAgent mode (default if not set).
tools_allowarray(string)Allowlist rules for tools.
tools_denyarray(string)Denylist rules for tools.
mcp_serversarray(string)MCP servers available to this agent.
max_turnsintegerTurn cap for this agent. Falls back to session default max turns.
cwdpathAgent working directory override.
worktreeboolAgent 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 = true

How Defaults Are Applied

resolve_toml_agents() applies defaults when fields are omitted:

  • model and provider inherit from [defaults].
  • mode inherits from [defaults].mode then falls back to default.
  • max_turns inherits from resolved session default max turns.
  • tools_allow/tools_deny default to empty lists.
  • worktree defaults to false.

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.