TaskFlow
DashboardFreewriteWhiteboardsProjectsCRMTasksNotificationsSettingsAgent TowerAPI Docs
OpenClaw Docs
?

User

Member

Caricamento in corso...

Home
Progetti
Task
Notifiche
CRM

    OpenClaw

    Documentation Mirror

    Documentation Overview

    Docs

    Auth credential semantics
    Scheduled tasks
    Hooks
    Automation & tasks
    Standing orders
    Task flow
    Background tasks
    BlueBubbles
    Broadcast groups
    Channel routing
    Discord
    Feishu
    Google Chat
    Group messages
    Groups
    iMessage
    Chat channels
    IRC
    LINE
    Channel location parsing
    Matrix
    Matrix migration
    Matrix push rules for quiet previews
    Mattermost
    Microsoft Teams
    Nextcloud Talk
    Nostr
    Pairing
    QA channel
    QQ bot
    Signal
    Slack
    Synology Chat
    Telegram
    Tlon
    Channel troubleshooting
    Twitch
    WeChat
    WhatsApp
    Yuanbao
    Zalo
    Zalo personal
    CI pipeline
    ACP
    Agent
    Agents
    Approvals
    Backup
    Browser
    Channels
    Clawbot
    `openclaw commitments`
    Completion
    Config
    Configure
    Cron
    Daemon
    Dashboard
    Devices
    Directory
    DNS
    Docs
    Doctor
    Flows (redirect)
    Gateway
    Health
    Hooks
    CLI reference
    Inference CLI
    Logs
    MCP
    Memory
    Message
    Migrate
    Models
    Node
    Nodes
    Onboard
    Pairing
    Plugins
    Proxy
    QR
    Reset
    Sandbox CLI
    Secrets
    Security
    Sessions
    Setup
    Skills
    Status
    System
    `openclaw tasks`
    TUI
    Uninstall
    Update
    Voicecall
    Webhooks
    Wiki
    Active memory
    Agent runtime
    Agent loop
    Agent runtimes
    Agent workspace
    Gateway architecture
    Channel docking
    Inferred commitments
    Compaction
    Context
    Context engine
    Delegate architecture
    Dreaming
    Experimental features
    Features
    Markdown formatting
    Memory overview
    Builtin memory engine
    Honcho memory
    QMD memory engine
    Memory search
    Messages
    Model failover
    Model providers
    Models CLI
    Multi-agent routing
    OAuth
    OpenClaw App SDK
    Presence
    QA overview
    Matrix QA
    Command queue
    Steering queue
    Retry policy
    Session management
    Session pruning
    Session tools
    SOUL.md personality guide
    Streaming and chunking
    System prompt
    Timezones
    TypeBox
    Typing indicators
    Usage tracking
    Date and time
    Node + tsx crash
    Diagnostics flags
    Authentication
    Background exec and process tool
    Bonjour discovery
    Bridge protocol
    CLI backends
    Configuration — agents
    Configuration — channels
    Configuration — tools and custom providers
    Configuration
    Configuration examples
    Configuration reference
    Diagnostics export
    Discovery and transports
    Doctor
    Gateway lock
    Health checks
    Heartbeat
    Gateway runbook
    Local models
    Gateway logging
    Multiple gateways
    Network model
    OpenAI chat completions
    OpenResponses API
    OpenShell
    OpenTelemetry export
    Gateway-owned pairing
    Prometheus metrics
    Gateway protocol
    Remote access
    Remote gateway setup
    Sandbox vs tool policy vs elevated
    Sandboxing
    Secrets management
    Secrets apply plan contract
    Security audit checks
    Security
    Tailscale
    Tools invoke API
    Troubleshooting
    Trusted proxy auth
    Debugging
    Environment variables
    FAQ
    FAQ: first-run setup
    FAQ: models and auth
    GPT-5.5 / Codex agentic parity
    GPT-5.5 / Codex parity maintainer notes
    Help
    Scripts
    Testing
    Testing: live suites
    General troubleshooting
    OpenClaw
    Ansible
    Azure
    Bun (experimental)
    ClawDock
    Release channels
    DigitalOcean
    Docker
    Docker VM runtime
    exe.dev
    Fly.io
    GCP
    Hetzner
    Hostinger
    Install
    Installer internals
    Kubernetes
    macOS VMs
    Migration guide
    Migrating from Claude
    Migrating from Hermes
    Nix
    Node.js
    Northflank
    Oracle Cloud
    Podman
    Railway
    Raspberry Pi
    Render
    Uninstall
    Updating
    Logging
    Network
    Audio and voice notes
    Camera capture
    Image and media support
    Nodes
    Location command
    Media understanding
    Talk mode
    Node troubleshooting
    Voice wake
    Pi integration architecture
    Pi development workflow
    Android app
    Platforms
    iOS app
    Linux app
    Gateway on macOS
    Canvas
    Gateway lifecycle
    macOS dev setup
    Health checks (macOS)
    Menu bar icon
    macOS logging
    Menu bar
    Peekaboo bridge
    macOS permissions
    Remote control
    macOS signing
    Skills (macOS)
    Voice overlay
    Voice wake (macOS)
    WebChat (macOS)
    macOS IPC
    macOS app
    Windows
    Plugin internals
    Plugin architecture internals
    Building plugins
    Plugin bundles
    Codex Computer Use
    Codex harness
    Community plugins
    Plugin compatibility
    Google Meet plugin
    Plugin hooks
    Plugin manifest
    Memory LanceDB
    Memory wiki
    Message presentation
    Agent harness plugins
    Building channel plugins
    Channel turn kernel
    Plugin entry points
    Plugin SDK migration
    Plugin SDK overview
    Building provider plugins
    Plugin runtime helpers
    Plugin setup and config
    Plugin SDK subpaths
    Plugin testing
    Skill workshop plugin
    Voice call plugin
    Webhooks plugin
    Zalo personal plugin
    OpenProse
    Alibaba Model Studio
    Anthropic
    Arcee AI
    Azure Speech
    Amazon Bedrock
    Amazon Bedrock Mantle
    Chutes
    Claude Max API proxy
    Cloudflare AI gateway
    ComfyUI
    Deepgram
    Deepinfra
    DeepSeek
    ElevenLabs
    Fal
    Fireworks
    GitHub Copilot
    GLM (Zhipu)
    Google (Gemini)
    Gradium
    Groq
    Hugging Face (inference)
    Provider directory
    Inferrs
    Inworld
    Kilocode
    LiteLLM
    LM Studio
    MiniMax
    Mistral
    Model provider quickstart
    Moonshot AI
    NVIDIA
    Ollama
    OpenAI
    OpenCode
    OpenCode Go
    OpenRouter
    Perplexity
    Qianfan
    Qwen
    Runway
    SGLang
    StepFun
    Synthetic
    Tencent Cloud (TokenHub)
    Together AI
    Venice AI
    Vercel AI gateway
    vLLM
    Volcengine (Doubao)
    Vydra
    xAI
    Xiaomi MiMo
    Z.AI
    Default AGENTS.md
    Release policy
    API usage and costs
    Credits
    Device model database
    Full release validation
    Memory configuration reference
    OpenClaw App SDK API design
    Prompt caching
    Rich output protocol
    RPC adapters
    SecretRef credential surface
    Session management deep dive
    AGENTS.md template
    BOOT.md template
    BOOTSTRAP.md template
    HEARTBEAT.md template
    IDENTITY template
    SOUL.md template
    TOOLS.md template
    USER template
    Tests
    Token use and costs
    Transcript hygiene
    Onboarding reference
    Contributing to the threat model
    Threat model (MITRE ATLAS)
    Formal verification (security models)
    Network proxy
    Agent bootstrapping
    Docs directory
    Getting started
    Docs hubs
    OpenClaw lore
    Onboarding (macOS app)
    Onboarding overview
    Personal assistant setup
    Setup
    Showcase
    Onboarding (CLI)
    CLI automation
    CLI setup reference
    ACP agents
    ACP agents — setup
    Agent send
    apply_patch tool
    Brave search
    Browser (OpenClaw-managed)
    Browser control API
    Browser troubleshooting
    Browser login
    WSL2 + Windows + remote Chrome CDP troubleshooting
    BTW side questions
    ClawHub
    Code execution
    Creating skills
    Diffs
    DuckDuckGo search
    Elevated mode
    Exa search
    Exec tool
    Exec approvals
    Exec approvals — advanced
    Firecrawl
    Gemini search
    Grok search
    Image generation
    Tools and plugins
    Kimi search
    LLM task
    Lobster
    Tool-loop detection
    Media overview
    MiniMax search
    Multi-agent sandbox and tools
    Music generation
    Ollama web search
    PDF tool
    Perplexity search
    Plugins
    Reactions
    SearXNG search
    Skills
    Skills config
    Slash commands
    Sub-agents
    Tavily
    Thinking levels
    Tokenjuice
    Trajectory bundles
    Text-to-speech
    Video generation
    Web search
    Web fetch
    Linux server
    Control UI
    Dashboard
    Web
    TUI
    WebChat

    OpenAPI Specs

    openapi
    TaskFlow
    docs/openclaw
    Original Docs

    Real-time Synchronized Documentation

    Last sync: 01/05/2026 07:01:44

    Note: This content is mirrored from docs.openclaw.ai and is subject to their terms and conditions.

    OpenClaw Docs

    v2.4.0 Production

    Last synced: Today, 22:00

    Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.

    Use this file to discover all available pages before exploring further.

    Sub-agents

    Sub-agents are background agent runs spawned from an existing agent run. They run in their own session (

    text
    agent:<agentId>:subagent:<uuid>
    ) and, when finished, announce their result back to the requester chat channel. Each sub-agent run is tracked as a background task.

    Primary goals:

    • Parallelize "research / long task / slow tool" work without blocking the main run.
    • Keep sub-agents isolated by default (session separation + optional sandboxing).
    • Keep the tool surface hard to misuse: sub-agents do not get session tools by default.
    • Support configurable nesting depth for orchestrator patterns.

    note

    **Cost note:** each sub-agent has its own context and token usage by default. For heavy or repetitive tasks, set a cheaper model for sub-agents and keep your main agent on a higher-quality model. Configure via `agents.defaults.subagents.model` or per-agent overrides. When a child genuinely needs the requester's current transcript, the agent can request `context: "fork"` on that one spawn.

    Slash command

    Use

    text
    /subagents
    to inspect or control sub-agent runs for the current session:

    text
    /subagents list /subagents kill <id|#|all> /subagents log <id|#> [limit] [tools] /subagents info <id|#> /subagents send <id|#> <message> /subagents steer <id|#> <message> /subagents spawn <agentId> <task> [--model <model>] [--thinking <level>]

    text
    /subagents info
    shows run metadata (status, timestamps, session id, transcript path, cleanup). Use
    text
    sessions_history
    for a bounded, safety-filtered recall view; inspect the transcript path on disk when you need the raw full transcript.

    Thread binding controls

    These commands work on channels that support persistent thread bindings. See Thread supporting channels below.

    text
    /focus <subagent-label|session-key|session-id|session-label> /unfocus /agents /session idle <duration|off> /session max-age <duration|off>

    Spawn behavior

    text
    /subagents spawn
    starts a background sub-agent as a user command (not an internal relay) and sends one final completion update back to the requester chat when the run finishes.

    Context modes

    Native sub-agents start isolated unless the caller explicitly asks to fork the current transcript.

    ModeWhen to use itBehavior
    text
    isolated
    Fresh research, independent implementation, slow tool work, or anything that can be briefed in the task textCreates a clean child transcript. This is the default and keeps token use lower.
    text
    fork
    Work that depends on the current conversation, prior tool results, or nuanced instructions already present in the requester transcriptBranches the requester transcript into the child session before the child starts.

    Use

    text
    fork
    sparingly. It is for context-sensitive delegation, not a replacement for writing a clear task prompt.

    Tool:
    text
    sessions_spawn

    Starts a sub-agent run with

    text
    deliver: false
    on the global
    text
    subagent
    lane, then runs an announce step and posts the announce reply to the requester chat channel.

    Availability depends on the caller's effective tool policy. The

    text
    coding
    and
    text
    full
    profiles expose
    text
    sessions_spawn
    by default. The
    text
    messaging
    profile does not; add
    text
    tools.alsoAllow: ["sessions_spawn", "sessions_yield", "subagents"]
    or use
    text
    tools.profile: "coding"
    for agents that should delegate work. Channel/group, provider, sandbox, and per-agent allow/deny policies can still remove the tool after the profile stage. Use
    text
    /tools
    from the same session to confirm the effective tool list.

    Defaults:

    • Model: inherits the caller unless you set
      text
      agents.defaults.subagents.model
      (or per-agent
      text
      agents.list[].subagents.model
      ); an explicit
      text
      sessions_spawn.model
      still wins.
    • Thinking: inherits the caller unless you set
      text
      agents.defaults.subagents.thinking
      (or per-agent
      text
      agents.list[].subagents.thinking
      ); an explicit
      text
      sessions_spawn.thinking
      still wins.
    • Run timeout: if
      text
      sessions_spawn.runTimeoutSeconds
      is omitted, OpenClaw uses
      text
      agents.defaults.subagents.runTimeoutSeconds
      when set; otherwise it falls back to
      text
      0
      (no timeout).

    Tool parameters

    The task description for the sub-agent. Optional human-readable label. Spawn under another agent id when allowed by `subagents.allowAgents`. `acp` is only for external ACP harnesses (`claude`, `droid`, `gemini`, `opencode`, or explicitly requested Codex ACP/acpx) and for `agents.list[]` entries whose `runtime.type` is `acp`. ACP-only. Resumes an existing ACP harness session when `runtime: "acp"`; ignored for native sub-agent spawns. ACP-only. Streams ACP run output to the parent session when `runtime: "acp"`; omit for native sub-agent spawns. Override the sub-agent model. Invalid values are skipped and the sub-agent runs on the default model with a warning in the tool result. Override thinking level for the sub-agent run. Defaults to `agents.defaults.subagents.runTimeoutSeconds` when set, otherwise `0`. When set, the sub-agent run is aborted after N seconds. When `true`, requests channel thread binding for this sub-agent session. If `thread: true` and `mode` omitted, default becomes `session`. `mode: "session"` requires `thread: true`. `"delete"` archives immediately after announce (still keeps the transcript via rename). `require` rejects spawn unless the target child runtime is sandboxed. `fork` branches the requester's current transcript into the child session. Native sub-agents only. Use `fork` only when the child needs the current transcript.

    warning

    `sessions_spawn` does **not** accept channel-delivery params (`target`, `channel`, `to`, `threadId`, `replyTo`, `transport`). For delivery, use `message`/`sessions_send` from the spawned run.

    Thread-bound sessions

    When thread bindings are enabled for a channel, a sub-agent can stay bound to a thread so follow-up user messages in that thread keep routing to the same sub-agent session.

    Thread supporting channels

    Discord is currently the only supported channel. It supports persistent thread-bound subagent sessions (

    text
    sessions_spawn
    with
    text
    thread: true
    ), manual thread controls (
    text
    /focus
    ,
    text
    /unfocus
    ,
    text
    /agents
    ,
    text
    /session idle
    ,
    text
    /session max-age
    ), and adapter keys
    text
    channels.discord.threadBindings.enabled
    ,
    text
    channels.discord.threadBindings.idleHours
    ,
    text
    channels.discord.threadBindings.maxAgeHours
    , and
    text
    channels.discord.threadBindings.spawnSubagentSessions
    .

    Quick flow

    Spawn

    `sessions_spawn` with `thread: true` (and optionally `mode: "session"`).

    Bind

    OpenClaw creates or binds a thread to that session target in the active channel.

    Route follow-ups

    Replies and follow-up messages in that thread route to the bound session.

    Inspect timeouts

    Use `/session idle` to inspect/update inactivity auto-unfocus and `/session max-age` to control the hard cap.

    Detach

    Use `/unfocus` to detach manually.

    Manual controls

    CommandEffect
    text
    /focus <target>
    Bind the current thread (or create one) to a sub-agent/session target
    text
    /unfocus
    Remove the binding for the current bound thread
    text
    /agents
    List active runs and binding state (
    text
    thread:<id>
    or
    text
    unbound
    )
    text
    /session idle
    Inspect/update idle auto-unfocus (focused bound threads only)
    text
    /session max-age
    Inspect/update hard cap (focused bound threads only)

    Config switches

    • Global default:
      text
      session.threadBindings.enabled
      ,
      text
      session.threadBindings.idleHours
      ,
      text
      session.threadBindings.maxAgeHours
      .
    • Channel override and spawn auto-bind keys are adapter-specific. See Thread supporting channels above.

    See Configuration reference and Slash commands for current adapter details.

    Allowlist

    List of agent ids that can be targeted via explicit `agentId` (`["*"]` allows any). Default: only the requester agent. If you set a list and still want the requester to spawn itself with `agentId`, include the requester id in the list. Default target-agent allowlist used when the requester agent does not set its own `subagents.allowAgents`. Block `sessions_spawn` calls that omit `agentId` (forces explicit profile selection). Per-agent override: `agents.list[].subagents.requireAgentId`.

    If the requester session is sandboxed,

    text
    sessions_spawn
    rejects targets that would run unsandboxed.

    Discovery

    Use

    text
    agents_list
    to see which agent ids are currently allowed for
    text
    sessions_spawn
    . The response includes each listed agent's effective model and embedded runtime metadata so callers can distinguish PI, Codex app-server, and other configured native runtimes.

    Auto-archive

    • Sub-agent sessions are automatically archived after
      text
      agents.defaults.subagents.archiveAfterMinutes
      (default
      text
      60
      ).
    • Archive uses
      text
      sessions.delete
      and renames the transcript to
      text
      *.deleted.<timestamp>
      (same folder).
    • text
      cleanup: "delete"
      archives immediately after announce (still keeps the transcript via rename).
    • Auto-archive is best-effort; pending timers are lost if the gateway restarts.
    • text
      runTimeoutSeconds
      does not auto-archive; it only stops the run. The session remains until auto-archive.
    • Auto-archive applies equally to depth-1 and depth-2 sessions.
    • Browser cleanup is separate from archive cleanup: tracked browser tabs/processes are best-effort closed when the run finishes, even if the transcript/session record is kept.

    Nested sub-agents

    By default, sub-agents cannot spawn their own sub-agents (

    text
    maxSpawnDepth: 1
    ). Set
    text
    maxSpawnDepth: 2
    to enable one level of nesting — the orchestrator pattern: main → orchestrator sub-agent → worker sub-sub-agents.

    json5
    { agents: { defaults: { subagents: { maxSpawnDepth: 2, // allow sub-agents to spawn children (default: 1) maxChildrenPerAgent: 5, // max active children per agent session (default: 5) maxConcurrent: 8, // global concurrency lane cap (default: 8) runTimeoutSeconds: 900, // default timeout for sessions_spawn when omitted (0 = no timeout) }, }, }, }

    Depth levels

    DepthSession key shapeRoleCan spawn?
    0
    text
    agent:<id>:main
    Main agentAlways
    1
    text
    agent:<id>:subagent:<uuid>
    Sub-agent (orchestrator when depth 2 allowed)Only if
    text
    maxSpawnDepth >= 2
    2
    text
    agent:<id>:subagent:<uuid>:subagent:<uuid>
    Sub-sub-agent (leaf worker)Never

    Announce chain

    Results flow back up the chain:

    1. Depth-2 worker finishes → announces to its parent (depth-1 orchestrator).
    2. Depth-1 orchestrator receives the announce, synthesizes results, finishes → announces to main.
    3. Main agent receives the announce and delivers to the user.

    Each level only sees announces from its direct children.

    note

    **Operational guidance:** start child work once and wait for completion events instead of building poll loops around `sessions_list`, `sessions_history`, `/subagents list`, or `exec` sleep commands. `sessions_list` and `/subagents list` keep child-session relationships focused on live work — live children remain attached, ended children stay visible for a short recent window, and stale store-only child links are ignored after their freshness window. This prevents old `spawnedBy` / `parentSessionKey` metadata from resurrecting ghost children after restart. If a child completion event arrives after you already sent the final answer, the correct follow-up is the exact silent token `NO_REPLY` / `no_reply`.

    Tool policy by depth

    • Role and control scope are written into session metadata at spawn time. That keeps flat or restored session keys from accidentally regaining orchestrator privileges.
    • Depth 1 (orchestrator, when
      text
      maxSpawnDepth >= 2
      ):
      gets
      text
      sessions_spawn
      ,
      text
      subagents
      ,
      text
      sessions_list
      ,
      text
      sessions_history
      so it can manage its children. Other session/system tools remain denied.
    • Depth 1 (leaf, when
      text
      maxSpawnDepth == 1
      ):
      no session tools (current default behavior).
    • Depth 2 (leaf worker): no session tools —
      text
      sessions_spawn
      is always denied at depth 2. Cannot spawn further children.

    Per-agent spawn limit

    Each agent session (at any depth) can have at most

    text
    maxChildrenPerAgent
    (default
    text
    5
    ) active children at a time. This prevents runaway fan-out from a single orchestrator.

    Cascade stop

    Stopping a depth-1 orchestrator automatically stops all its depth-2 children:

    • text
      /stop
      in the main chat stops all depth-1 agents and cascades to their depth-2 children.
    • text
      /subagents kill <id>
      stops a specific sub-agent and cascades to its children.
    • text
      /subagents kill all
      stops all sub-agents for the requester and cascades.

    Authentication

    Sub-agent auth is resolved by agent id, not by session type:

    • The sub-agent session key is
      text
      agent:<agentId>:subagent:<uuid>
      .
    • The auth store is loaded from that agent's
      text
      agentDir
      .
    • The main agent's auth profiles are merged in as a fallback; agent profiles override main profiles on conflicts.

    The merge is additive, so main profiles are always available as fallbacks. Fully isolated auth per agent is not supported yet.

    Announce

    Sub-agents report back via an announce step:

    • The announce step runs inside the sub-agent session (not the requester session).
    • If the sub-agent replies exactly
      text
      ANNOUNCE_SKIP
      , nothing is posted.
    • If the latest assistant text is the exact silent token
      text
      NO_REPLY
      /
      text
      no_reply
      , announce output is suppressed even if earlier visible progress existed.

    Delivery depends on requester depth:

    • Top-level requester sessions use a follow-up
      text
      agent
      call with external delivery (
      text
      deliver=true
      ).
    • Nested requester subagent sessions receive an internal follow-up injection (
      text
      deliver=false
      ) so the orchestrator can synthesize child results in-session.
    • If a nested requester subagent session is gone, OpenClaw falls back to that session's requester when available.

    For top-level requester sessions, completion-mode direct delivery first resolves any bound conversation/thread route and hook override, then fills missing channel-target fields from the requester session's stored route. That keeps completions on the right chat/topic even when the completion origin only identifies the channel.

    Child completion aggregation is scoped to the current requester run when building nested completion findings, preventing stale prior-run child outputs from leaking into the current announce. Announce replies preserve thread/topic routing when available on channel adapters.

    Announce context

    Announce context is normalized to a stable internal event block:

    FieldSource
    Source
    text
    subagent
    or
    text
    cron
    Session idsChild session key/id
    TypeAnnounce type + task label
    StatusDerived from runtime outcome (
    text
    success
    ,
    text
    error
    ,
    text
    timeout
    , or
    text
    unknown
    ) — not inferred from model text
    Result contentLatest visible assistant text, otherwise sanitized latest tool/toolResult text
    Follow-upInstruction describing when to reply vs stay silent

    Terminal failed runs report failure status without replaying captured reply text. On timeout, if the child only got through tool calls, announce can collapse that history into a short partial-progress summary instead of replaying raw tool output.

    Stats line

    Announce payloads include a stats line at the end (even when wrapped):

    • Runtime (e.g.
      text
      runtime 5m12s
      ).
    • Token usage (input/output/total).
    • Estimated cost when model pricing is configured (
      text
      models.providers.*.models[].cost
      ).
    • text
      sessionKey
      ,
      text
      sessionId
      , and transcript path so the main agent can fetch history via
      text
      sessions_history
      or inspect the file on disk.

    Internal metadata is meant for orchestration only; user-facing replies should be rewritten in normal assistant voice.

    Why prefer
    text
    sessions_history

    text
    sessions_history
    is the safer orchestration path:

    • Assistant recall is normalized first: thinking tags stripped;
      text
      <relevant-memories>
      /
      text
      <relevant_memories>
      scaffolding stripped; plain-text tool-call XML payload blocks (
      text
      <tool_call>
      ,
      text
      <function_call>
      ,
      text
      <tool_calls>
      ,
      text
      <function_calls>
      ) stripped, including truncated payloads that never close cleanly; downgraded tool-call/result scaffolding and historical-context markers stripped; leaked model control tokens (
      text
      <|assistant|>
      , other ASCII
      text
      <|...|>
      , full-width
      text
      <|...|>
      ) stripped; malformed MiniMax tool-call XML stripped.
    • Credential/token-like text is redacted.
    • Long blocks can be truncated.
    • Very large histories can drop older rows or replace an oversized row with
      text
      [sessions_history omitted: message too large]
      .
    • Raw on-disk transcript inspection is the fallback when you need the full byte-for-byte transcript.

    Tool policy

    Sub-agents use the same profile and tool-policy pipeline as the parent or target agent first. After that, OpenClaw applies the sub-agent restriction layer.

    With no restrictive

    text
    tools.profile
    , sub-agents get all tools except session tools and system tools:

    • text
      sessions_list
    • text
      sessions_history
    • text
      sessions_send
    • text
      sessions_spawn

    text
    sessions_history
    remains a bounded, sanitized recall view here too — it is not a raw transcript dump.

    When

    text
    maxSpawnDepth >= 2
    , depth-1 orchestrator sub-agents additionally receive
    text
    sessions_spawn
    ,
    text
    subagents
    ,
    text
    sessions_list
    , and
    text
    sessions_history
    so they can manage their children.

    Override via config

    json5
    { agents: { defaults: { subagents: { maxConcurrent: 1, }, }, }, tools: { subagents: { tools: { // deny wins deny: ["gateway", "cron"], // if allow is set, it becomes allow-only (deny still wins) // allow: ["read", "exec", "process"] }, }, }, }

    text
    tools.subagents.tools.allow
    is a final allow-only filter. It can narrow the already-resolved tool set, but it cannot add back a tool removed by
    text
    tools.profile
    . For example,
    text
    tools.profile: "coding"
    includes
    text
    web_search
    /
    text
    web_fetch
    but not the
    text
    browser
    tool. To let coding-profile sub-agents use browser automation, add browser at the profile stage:

    json5
    { tools: { profile: "coding", alsoAllow: ["browser"], }, }

    Use per-agent

    text
    agents.list[].tools.alsoAllow: ["browser"]
    when only one agent should get browser automation.

    Concurrency

    Sub-agents use a dedicated in-process queue lane:

    • Lane name:
      text
      subagent
    • Concurrency:
      text
      agents.defaults.subagents.maxConcurrent
      (default
      text
      8
      )

    Liveness and recovery

    OpenClaw does not treat

    text
    endedAt
    absence as permanent proof that a sub-agent is still alive. Unended runs older than the stale-run window stop counting as active/pending in
    text
    /subagents list
    , status summaries, descendant completion gating, and per-session concurrency checks.

    After a gateway restart, stale unended restored runs are pruned unless their child session is marked

    text
    abortedLastRun: true
    . Those restart-aborted child sessions remain recoverable through the sub-agent orphan recovery flow, which sends a synthetic resume message before clearing the aborted marker.

    Automatic restart recovery is bounded per child session. If the same sub-agent child is accepted for orphan recovery repeatedly inside the rapid re-wedge window, OpenClaw persists a recovery tombstone on that session and stops auto-resuming it on later restarts. Run

    text
    openclaw tasks maintenance --apply
    to reconcile the task record, or
    text
    openclaw doctor --fix
    to clear stale aborted recovery flags on tombstoned sessions.

    note

    If a sub-agent spawn fails with Gateway `PAIRING_REQUIRED` / `scope-upgrade`, check the RPC caller before editing pairing state. Internal `sessions_spawn` coordination should connect as `client.id: "gateway-client"` with `client.mode: "backend"` over direct loopback shared-token/password auth; that path does not depend on the CLI's paired-device scope baseline. Remote callers, explicit `deviceIdentity`, explicit device-token paths, and browser/node clients still need normal device approval for scope upgrades.

    Stopping

    • Sending
      text
      /stop
      in the requester chat aborts the requester session and stops any active sub-agent runs spawned from it, cascading to nested children.
    • text
      /subagents kill <id>
      stops a specific sub-agent and cascades to its children.

    Limitations

    • Sub-agent announce is best-effort. If the gateway restarts, pending "announce back" work is lost.
    • Sub-agents still share the same gateway process resources; treat
      text
      maxConcurrent
      as a safety valve.
    • text
      sessions_spawn
      is always non-blocking: it returns
      text
      { status: "accepted", runId, childSessionKey }
      immediately.
    • Sub-agent context only injects
      text
      AGENTS.md
      +
      text
      TOOLS.md
      (no
      text
      SOUL.md
      ,
      text
      IDENTITY.md
      ,
      text
      USER.md
      ,
      text
      HEARTBEAT.md
      , or
      text
      BOOTSTRAP.md
      ).
    • Maximum nesting depth is 5 (
      text
      maxSpawnDepth
      range: 1–5). Depth 2 is recommended for most use cases.
    • text
      maxChildrenPerAgent
      caps active children per session (default
      text
      5
      , range
      text
      1–20
      ).

    Related

    • ACP agents
    • Agent send
    • Background tasks
    • Multi-agent sandbox tools

    © 2024 TaskFlow Mirror

    Powered by TaskFlow Sync Engine