Skip to content

Sub-agents have session tools in system prompt but no actual API tool bindings #5157

@gevertex

Description

@gevertex

Summary

Sub-agents spawned via sessions_spawn see sessions_list, sessions_history, and sessions_send mentioned in their system prompt, but these tools are not actually bound to the Anthropic API call. When the model tries to use them, it outputs text that looks like a tool call instead of triggering a real tool_use block.

Config

"tools": {
  "subagents": {
    "tools": {
      "allow": [
        "sessions_spawn",
        "sessions_list",
        "sessions_history",
        "sessions_send"
      ]
    }
  }
}

Expected Behavior

Sub-agents should be able to call sessions_list and sessions_history and get actual results, enabling cross-session visibility as documented.

Actual Behavior

  1. Sub-agent sees tools listed in system prompt
  2. Sub-agent attempts to call sessions_list
  3. Instead of a tool_use block, the model outputs text like:
    {"name": "sessions_list", "parameters": {}}
    
  4. stopReason is "stop" not "tool_use"
  5. No actual tool execution occurs

Evidence

From transcript inspection:

  • Sub-agent thinking: "From the system prompt, I can see the following tools mentioned..."
  • Response contains only thinking + text blocks, no tool_use blocks
  • stopReason: "stop" confirms no tools were invoked

Environment

  • OpenClaw version: 2026.1.29
  • Model: claude-opus-4-5
  • OS: macOS (Darwin arm64)

Root Cause Hypothesis

The tools.subagents.tools.allow config injects tool names into the sub-agent's system prompt, but does not add corresponding tool definitions to the Anthropic API tools parameter. The model hallucinates tool calls based on prompt text.

Workaround

None known. Sub-agents cannot currently use session tools despite config allowing them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions