Repository navigation
deploy_agent: a peer_tools option to leave out the peer_agents tools - #836
Open
kaihackney-scale wants to merge 1 commit into
Open
kaihackney-scale wants to merge 1 commit into
kaihackney-scale wants to merge 1 commit into
Conversation
A deploy_agent step can already narrow an agent's own tools with builtin_tools, but every claude-code turn still got the SDK's peer_agents MCP tools, and only code (the always-on verifier's judge) could turn them off. A task now sets peer_tools: false on the step. It is checked against the agent's agent-config before the first request (an agent that can't take it fails the deploy), sent with the identity, kept on the card, and sent again on each prompt_agent and always_on turn like builtin_tools, including to a peer user sim, which until now got neither again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines
+571
to
+575
| user_card = user_sim.a2a_card or {} | ||
| # Its own tools and peer tools as deploy_agent set them, again, as for the agent above. | ||
| user_config = {k: v for k, v in {"output_format": user_output_format, "model": user_model, | ||
| "builtin_tools": user_card.get("builtin_tools"), | ||
| "peer_tools": user_card.get("peer_tools")}.items() if v is not None} |
There was a problem hiding this comment.
Built-in users regain peer tools. The new resend runs only in
elif is_user_sim, so it skips users created by deploy_user_sim_agent. If that agent restarts between deployment and prompt_agent, its saved peer_tools: false is never sent again. Claude Code defaults to True, so the user simulator gets the peer tools back. always_on also skips this resend for its user simulator. Send the saved tool settings independently of the branches that skip model and prompt setup, and cover the built-in user path in a test.
Knowledge Base Used: Task-step context and execution
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/task_step/task_steps/prompt_agent.py
Line: 571-575
Comment:
**Built-in users regain peer tools.** The new resend runs only in `elif is_user_sim`, so it skips users created by `deploy_user_sim_agent`. If that agent restarts between deployment and `prompt_agent`, its saved `peer_tools: false` is never sent again. Claude Code defaults to `True`, so the user simulator gets the peer tools back. `always_on` also skips this resend for its user simulator. Send the saved tool settings independently of the branches that skip model and prompt setup, and cover the built-in user path in a test.
**Knowledge Base Used:** [Task-step context and execution](https://app.greptile.com/-/switch-tenant?tenant=scale-ai&next=%2Fcustom-context%2Fknowledge-base%2Fscaleapi%2Fagentenv-framework%2F-%2Fdocs%2Ftask-step-execution.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A
deploy_agentstep can narrow an agent's own tools withbuiltin_tools, but every claude-code turn still gets theSDK's peer_agents MCP tools, which message the task's other agents. Only code could turn them off: the always-on
verifier does it for its judge. An agent that should have no tools at all, such as an LLM user sim, keeps six it
shouldn't have, even in a task with nothing for it to reach.
deploy_agentnow takespeer_tools: false, handled likebuiltin_tools:peer_toolsfails the deploy instead of keeping the tools.
prompt_agentandalways_onturn, so an agent that restarted doesn't get the tools back.A peer user sim now gets its
builtin_toolsandpeer_toolsagain each turn too; until now it got neither afterdeploy.
Leaving
peer_toolsunset changes nothing.How it was tested
test_deploy_agent_role_delivery.py: false is sent once with the identity and kept on the card;unset sends nothing; an agent that can't take it fails before any request; the field round-trips and must be a
bool. In
test_prompt_agent_builtin_tools.py: each turn resends it, and a user sim gets its own tools and peer toolseach turn. The two resend tests fail without the
prompt_agentchange.pytest tst/unit/task_step tst/unit/agents: the same failures as onmainand no new ones (they need sandboxprovider modules that aren't installed locally).
make lint: passed.builtin_tools: {"disable": "*"}andpeer_tools: false, then oneprompt_agentturn with anoutput_format. The CLI's session log shows the model wasoffered only
StructuredOutput, and the turn answered through it. Withbuiltin_toolsalone, the same agent isoffered
StructuredOutputplus the sixmcp__peer_agents__*tools. The sandbox was terminated.🤖 Generated with Claude Code
Restore the saved tool settings for built-in user simulators before merging.
Fix with agent prompt
Summary
Adds
peer_toolsto agent deployment and carries it into later prompt and always-on steps.Reviews (1) · Last reviewed commit: "deploy_agent: a peer_tools option to lea..." · Reviewed by Greptile