Seshat AIDocumentation

Documentation / Concepts

Agents and delegation

How an agent hands work to sub-agents, runs them in the background, keeps them under control, and what is not available yet.

A single agent working through a large task fills its context quickly. Seshat lets an agent delegate: it starts a sub-agent with a self-contained task, the sub-agent works on its own with a limited set of tools, and only its result comes back.

  • Main agentTalks to you, plans, decides what to delegate
    • exploreRead-only: read_file, glob, grep
    • planDesigns an approach, read-only
    • general-purposeDoes a self-contained piece of work
      • helperA sub-agent of a sub-agent, within the depth limit
    • browseRead-only research on the web and in documents

Two ways to delegate

The agent tool runs a sub-agent and waits for its answer. The main agent chooses a type and writes the task.

ParameterMeaning
typegeneral-purpose, explore, plan, browse or verify
taskA self-contained description: paths, goal, constraints, what to return
max_turnsTurn limit for the sub-agent
run_in_backgroundReturn immediately with a task id and let it run. Read its state with the task tools (task_get)
forkGive the sub-agent the parent’s message history
isolationworktree runs it in its own git worktree, so its changes stay apart until merged
toolsRestrict its tools to a list of patterns
The main agent decidesthe work is large, parallelor would flood the contextIt calls the agent toola type, a task and optionsIt waits for the answeror carries on if the sub-agentruns in the backgroundIt receives the answeras an ordinary tool resultYou approve the startstarting an agent asks firstLimits are checkeddepth under 3 (5 at most),a known agent typeA sub-agent session startsits own context, the tools ofits type, no more questionsIt worksits own turn limit, and 30minutes at mostIt returns its final answera summary of what it foundor didfinal answer
The sub-agent runs in its own session, so its many tool calls stay out of the main conversation. Only the final answer comes back.

The background family starts an agent that keeps running while the main agent continues:

ToolUse
spawn_agentStart a background sub-agent
send_agent_messageSteer it between turns
wait_agentBlock until it finishes and read its result (it gives up waiting after 300 seconds by default and reports it is still running)
list_agentsSee what is running
resume_agentContinue a completed one with a new task. It sees its full earlier history
close_agentStop it
spawn_agentreturns an agent idright awayRunningworks on its own,up to 30 minutesCompletedits result is keptFailedwith its errorCancelledstopped earlysend_agent_messagequeued as its next promptclose_agentcancels and removes itfinisheserrorscancelswait_agent blocks until it ends (300 s by default), list_agents shows what runsresume_agent continues a completed one with a new task
Background agents are tracked by the process. At most 8 run at once, across all sessions.

Built-in agent types

TypeForToolsTurns by default
general-purposeA self-contained piece of workAll of them20
exploreUnderstanding a codebaseread_file, glob, grep12
planDesigning an approachread_file, glob, grep20
browseDeep read-only research across the web, documents and codeReading, search, web and browser tools35
verifyChecking an agent setup: that definitions are valid, that security constraints and tool permissions are correctly scoped. It does not review your code changesread_file, glob, grep20

max_turns overrides the default for one call. An agent defined by a skill gets its turns from its effort field: minimal is 10, low 20, medium 50 (the default), high 100 and maximum 150.

A skill that has an agent field in its header also becomes a sub-agent type of that name, with the skill’s text as its instructions. See Skills and MCP.

Keeping it under control

Delegation can run away if nothing stops it, so the runtime sets limits:

LimitDefault
Delegation depth (A starts B starts C)3, adjustable up to 5
Background agents running at once, across the process8
Turns for a sub-agentSet by its type (12 to 35), or by max_turns
Wall-clock time of one sub-agent30 minutes, as a safety net for an agent that is stuck

Permissions of a sub-agent

Starting an agent is itself an action that asks for approval, like any other tool. Once you approve it, the sub-agent does not ask again for each tool, within the tools it was given: it runs in bypass mode. Deny rules and the safety check still apply, as in any bypass run (see Security and trust).

There is one exception. A parent session in never mode starts its sub-agents in never mode too, so nothing is escalated and a refused action goes back to the model as an error. This holds for a foreground agent, a background agent and a skill that runs in a fork. Every other parent mode gives a bypass sub-agent, because a sub-agent has no screen of its own to show a question on.

That is why the tool list matters. explore, plan, browse and verify can only read. general-purpose has every tool, including the shell. You can narrow any agent further with the tools parameter. Both the tool list of a type and the tools parameter really restrict the sub-agent: a tool that is not on the list is not available to it.

Teams of persistent agents

The repository also contains building blocks for persistent agents that have a name, a role and a mailbox, and message each other asynchronously: agent profiles, a mailbox stored in SQLite, a dispatcher that sends, replies and broadcasts, and a bus that polls each inbox.

Next

Updated on 2026-10-13