Skip to main content

Module agent

Module agent 

Source
Expand description

Unified multi-agent delegation tool (agent) plus shared-memory tools.

§Design

A single agent tool replaces the previous fragmented delegation surface (SubAgent / spawn_worker / spawn_workers_parallel / team_add_role / team_remove_role / team_list_roles). The caller provides a manifest that maps worker IDs to { system_prompt, allowed_tools } entries and an execution mode:

  • "single" — one worker, exactly as if SubAgent + explicit role had been combined.
  • "parallel" — all workers run concurrently (join_all). Read-only workers benefit most.
  • "sequential" — workers run one after another, in manifest key order.

Shared-memory read/write are kept as independent tools so workers can coordinate through a shared key-value store.

§Recursive safety

A depth limit (RECURSIVE_SUBAGENT_MAX_DEPTH env, default 2) prevents unbounded nesting. Each child agent increments the depth counter; when the limit is reached the tool returns an error string instead of spawning.

Structs§

AgentTool
The unified agent delegation tool.
SharedMemoryRead
The shared_memory_read tool — read a value from the shared memory store.
SharedMemoryWrite
The shared_memory_write tool — write a value into the shared memory store.
WorkerHandle
A long-lived handle to a background worker, enabling cross-turn continuation via send_message.

Type Aliases§

WorkerTable
A process-wide table of live background workers keyed by worker_id. Shared between the agent tool (which inserts) and the send_message tool ( which looks up to continue a worker).