Move web search into a sub-agent tool#136
Merged
Merged
Conversation
PrismPHP's Anthropic provider returns 400 errors when an agent mixes custom tools with provider tools (like WebSearch) across multi-turn conversations. Extract WebSearch into MediaWebSearchAgentTool — a custom tool whose handle() spawns a sub-agent with WebSearch as its only tool — so the orchestrator only owns custom tools. Mirrors the existing MediaWritingAgentTool pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previously the orchestrator was told to "always" call MediaWebSearchAgentTool before responding, which caused needless web searches when David referred to media already in his library (e.g. logging a finished event on something currently being read). Reframe the guidance around the tool's purpose — identifying unknown media — so the orchestrator can skip it when SearchMedia alone is sufficient. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Documents the PrismPHP/Anthropic 400-error bug that motivates wrapping WebSearch inside MediaWebSearchAgentTool instead of exposing it directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
WebSearchout ofMediaTrackingAgentand into a newMediaWebSearchAgentToolsub-agent, working around a PrismPHP bug where the Anthropic provider returns 400 errors when an agent mixes custom and provider tools across multi-turn conversations.Test plan
php artisan test— 294 passedtask format🤖 Generated with Claude Code