Repository navigation
Open
Labels
enhancementNew feature or request
Description
Summary
Status: speculative. We do not know yet if more web search helps the agent, or if the token cost is acceptable.
On the Claude backend, the agent almost never calls WebSearch or WebFetch. The Claude Code CLI marks both tools as deferred. The model gets only the tool names. Before it can call a deferred tool, it must call ToolSearch to load the schema. Nerve sets alwaysLoad only on the nerve MCP server (nerve/agent/tools/claude_sdk_adapter.py), so the built-in web tools stay deferred.
Evidence
Langfuse traces from one production deployment (direct Anthropic API, no proxy):
| Tool span | Count, all time |
|---|---|
Bash |
45,433 |
ToolSearch |
34 |
WebFetch |
15 |
WebSearch |
2 |
ToolSearchloadedWebSearch4 times andWebFetch9 times. The agent cannot call a deferred tool before it loads it, so these counts agree with the call counts.- The tracing is complete. The langsmith
PreToolUsehook traces all tools (matcher=None), and the twoWebSearchcalls returned normal results. - The workload is also a cause. This deployment does mostly code, GitHub, and database work. Its
curlcalls go to known APIs, not to search engines. - Codex turns are not traced, so this issue is about the Claude backend only.
CLI behavior
Examined in the CLI bundled with claude-agent-sdk 0.2.158:
WebSearchandWebFetchhaveshouldDefer: true.- The CLI sends the deferred tool names in a
deferred_tools_deltamessage attachment, not in the system prompt. The Nerve system prompt does not remove them. ENABLE_TOOL_SEARCHsets the mode. A false value loads all tools at the start.- The CLI turns tool search off when
ANTHROPIC_BASE_URLis not a first-party Anthropic host andENABLE_TOOL_SEARCHis not set. Thus proxy mode (CLIProxyAPI) and a gatewayANTHROPIC_BASE_URLalready load all tools at the start. - There is no setting to load one built-in tool at the start.
tengu_non_deferrable_builtinsin the bundle is a server-side feature flag.
Options
- Set
ENABLE_TOOL_SEARCH=falseinClaudeBackend._build_env. All tools load at the start, including the tools of all external MCP servers. This adds input tokens to each turn. - Tell the model in the prompt templates to load
WebSearchandWebFetchwithToolSearchwhen it needs current information. The cost is low, but the model can ignore it. - Add a config key (for example
agent.tool_search) that setsENABLE_TOOL_SEARCH, so operators can choose. - Make no change. The agent's work may not need web search often.
Open questions
- Is low web search use a problem? We have no reports of wrong answers caused by missing search.
- What is the token cost of option 1 with a typical set of MCP servers?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity