openclaw - 💡(How to fix) Fix Feature request: allowedTools / toolPolicy param for sessions_spawn [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#58623Fetched 2026-04-08 02:00:02
View on GitHub
Comments
1
Participants
1
Timeline
0
Reactions
0

Code Example

sessions_spawn({
  task: "...",
  runtime: "subagent",
  allowedTools: ["Read", "Edit", "exec", "Write"]
})
RAW_BUFFERClick to expand / collapse

Problem

When spawning sub-agents via sessions_spawn with runtime: "subagent", all tools available to the parent session are inherited by the child. There is currently no way to restrict which tools a sub-agent can use at the harness level — only soft prompt-level hints.

This creates two real failure modes:

  1. Accidental channel writes — a worker agent calls message(action=send) and sends a message to a real user channel when it should only be editing files
  2. Context bloat / confused workers — agents in tight loops try browser, web_search, or other irrelevant tools when the task only needs Read, Edit, and exec

Proposed Solution

Add an optional allowedTools (or toolPolicy) parameter to sessions_spawn:

sessions_spawn({
  task: "...",
  runtime: "subagent",
  allowedTools: ["Read", "Edit", "exec", "Write"]
})

The harness would enforce this at the session level — tools not in the list are simply unavailable to the child session, regardless of what the model tries to call.

Why Not Just Prompt Engineering?

Soft constraints work reasonably well but are not reliable for safety-critical boundaries (e.g., preventing a worker from messaging users). A prompt that says "do not use the message tool" can be ignored under pressure. Hard enforcement at the harness layer is the right place for this.

Prior Art / Pattern Reference

The concept maps to a ToolPermissionContext pattern — a scoped execution context where tool availability is determined at spawn time rather than inherited from the parent.

Use Case

We run a multi-agent system with ~10 agents. When spawning coding workers we want to restrict to file + exec tools only. When spawning research workers we allow web_search but not message. Currently we rely entirely on prompt instructions for this boundary.

Effort Estimate (from outside)

Likely involves filtering available tools in the session initialization path when a toolPolicy config is present. Low user-facing complexity, meaningful safety improvement.


Filed on behalf of the Pinnacle NW agent team. Happy to provide more context or examples.

extent analysis

TL;DR

Implementing an allowedTools parameter in sessions_spawn can restrict tool access for sub-agents, preventing accidental channel writes and context bloat.

Guidance

  • To address the issue, consider adding an allowedTools parameter to sessions_spawn to enforce tool restrictions at the session level.
  • Evaluate the proposed solution by testing the allowedTools parameter with different tool configurations to ensure it effectively restricts tool access for sub-agents.
  • Assess the feasibility of implementing this solution by reviewing the session initialization path and identifying where tool filtering can be applied.
  • Consider the ToolPermissionContext pattern as a reference for implementing the allowedTools parameter.

Example

sessions_spawn({
  task: "...",
  runtime: "subagent",
  allowedTools: ["Read", "Edit", "exec", "Write"]
})

Notes

The implementation of the allowedTools parameter may require modifications to the session initialization path, and its effectiveness should be verified through thorough testing.

Recommendation

Apply the workaround by implementing the allowedTools parameter in sessions_spawn to restrict tool access for sub-agents, as it provides a more reliable and safety-critical boundary than relying on prompt instructions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING