techlist.io

Claude Api

2 posts

Anthropic2025-11-244 min readCurated summary

Introducing advanced tool use for Claude

# Anthropic's Advanced Tool Use: Tool Search, Programmatic Calling, and Usage Examples Anthropic argues that agents need to work with hundreds or thousands of tools without overloading their context window, call tools from code rather than one at a time, and learn correct usage from examples rather than schemas alone. To address this, the post introduces three beta features: Tool Search Tool, Programmatic Tool Calling, and Tool Use Examples. Internal testing shows these features cut token usage substantially while improving accuracy on tool-heavy tasks. ## Tool Search Tool Loading every tool definition upfront wastes context. A five-server MCP setup can consume about 55K tokens before a conversation starts, and Anthropic has seen definitions reach 134K tokens. Wrong tool selection is also common when names are similar, such as `notification-send-user` versus `notification-send-channel`. - Tools marked with `defer_loading: true` are excluded from the initial prompt. Claude sees only the search tool plus tools marked `defer_loading: false`. - When Claude needs a capability, it searches (regex, BM25, or a custom method such as embeddings), and only the matching tools expand into full definitions. - Entire MCP servers can be deferred with `mcp_toolset` configs, while frequently used tools stay loaded. - Because deferred tools are left out of the initial prompt, the system prompt and core tool definitions remain cacheable. - In the reported example, context use dropped from about 77K to 8.7K tokens, an 85% reduction. - Accuracy on MCP evaluations improved: Opus 4 went from 49% to 74%, and Opus 4.5 from 79.5% to 88.1%. - It suits setups with more than 10 tools or definitions over 10K tokens. It is less useful with fewer than 10 compact tools or tools used in every session, since the search step adds latency. ## Programmatic Tool Calling Conventional tool calling floods context with intermediate results and requires a full inference pass per call. Programmatic Tool Calling lets Claude write Python that orchestrates tools inside a sandboxed code execution environment, so Claude sees only the final output. - Tools opt in through `allowed_callers`, and the API exposes them as Python functions. - In the budget compliance example, a script fetches team members, budgets, and expenses for 20 people (about 200KB of raw data), and Claude receives only the one to three people who exceeded their limits (about 1KB). - Average token usage fell from 43,588 to 27,297 (37%) on complex research tasks, and accuracy improved on internal benchmarks. - Latency drops because 20+ tool calls can run in one code block instead of 20+ inference passes. - It is most useful for large datasets, workflows with three or more dependent calls, and parallel operations. Single calls and tasks where Claude must reason over every intermediate result gain little. - Claude for Excel uses this approach to handle spreadsheets with thousands of rows. ## Tool Use Examples JSON Schema defines structure but cannot show when optional parameters apply, which combinations make sense, or what format conventions an API expects. Ambiguous fields such as date formats, ID patterns, and nested objects often lead to malformed calls. - An `input_examples` array in the tool definition shows concrete calls, including minimal, partial, and full specifications. - Examples teach conventions such as `YYYY-MM-DD` dates, `USR-XXXXX` IDs, and which optional fields go with which priority levels. - In Anthropic's internal testing, accuracy on complex parameter handling rose from 72% to 90%. - Keep it to 1–5 realistic examples per tool, focused on ambiguity the schema doesn't resolve. Examples add tokens, so they are less useful for simple tools or standard formats like emails and URLs. ## Practical Recommendations Start with the bottleneck that limits your agent most: context bloat points to Tool Search, large intermediate results point to Programmatic Tool Calling, and parameter errors point to Tool Use Examples. The features complement each other, and clear tool names and descriptions improve search accuracy. The features are available in beta under the `advanced-tool-use-2025-11-20` header.

Anthropic2025-09-175 min readCurated summary

A postmortem of three recent issues

Between August and early September, three overlapping infrastructure bugs intermittently degraded Claude's response quality across Anthropic's first-party API, Amazon Bedrock, and Google Cloud Vertex AI. Anthropic states that model quality is never reduced because of demand, time of day, or server load, and that the reported problems came only from these bugs. The post is a postmortem covering what went wrong, why detection took so long, and what Anthropic is changing. ### How Claude Is Served - Claude runs across AWS Trainium, NVIDIA GPUs, and Google TPUs to serve millions of users worldwide. - Each platform needs its own optimizations, but Anthropic holds all of them to strict equivalence standards so users get the same quality regardless of hardware. - Any infrastructure change therefore needs validation across all platforms and configurations. ### Timeline of the Incidents - A first bug was introduced on August 5, affecting about 0.8% of Sonnet 4 requests. - Two more bugs came from deployments on August 25 and 26. - A load balancing change on August 29 sharply increased the affected traffic, while other users saw normal performance, which made the reports look contradictory. ### The Three Bugs #### Context Window Routing Error - Some short-context Sonnet 4 requests were routed to servers configured for the upcoming 1M-token context window. - At the worst hour, on August 31, 16% of Sonnet 4 requests were affected. - About 30% of Claude Code users who made requests during this period had at least one message misrouted. - Routing is "sticky," so follow-up messages often landed on the same bad server, making some users' experience worse. - The fix shipped September 4 and finished rolling out by September 16 on the first-party platform and Vertex AI, and by September 18 on Bedrock. #### Output Corruption - A misconfiguration on the TPU servers, combined with a runtime optimization, sometimes gave high probability to tokens that should rarely appear. Examples include Thai or Chinese characters in English responses and obvious syntax errors in code. - It affected Opus 4.1 and Opus 4 from August 25 to 28, and Sonnet 4 from August 25 to September 2. Third-party platforms were not affected. - The change was rolled back on September 2, and Anthropic added detection tests for unexpected character output to its deployment process. #### Approximate Top-k XLA:TPU Miscompilation - A change to how Claude selects tokens triggered a latent bug in the XLA:TPU compiler. It was confirmed for Haiku 3.5 and likely affected some Sonnet 4 and Opus 3 requests. - Haiku 3.5 was rolled back on September 4 and Opus 3 on September 12. Sonnet 4 was rolled back as a precaution, though the bug could not be reproduced on it. - Anthropic switched to exact top-k with higher precision. ### Deep Dive: The XLA Compiler Bug - Claude samples the next token using top-p sampling, which requires sorting probabilities across tens of TPU chips. - A December 2024 workaround addressed a case where the most probable token was dropped at temperature zero. - The root cause was a precision mismatch. Probabilities were computed in bf16, but the compiler's `xla_allow_excess_precision` optimization (default `true`) moved some operations to fp32. This made operations disagree about the top token. - An August 26 sampling rewrite removed the December workaround, which had been masking a deeper bug in the approximate top-k operation. That bug returned wrong results only for certain batch sizes and model configurations. - The bug was inconsistent: the same prompt could succeed or fail depending on surrounding operations and whether debugging tools were enabled. - Anthropic moved to exact top-k, which no longer carried a prohibitive cost, and standardized more operations on fp32, accepting a minor efficiency cost. - Tokens near the top-p threshold may now be included slightly differently, so a few users may need to re-tune their top-p setting. ### Why Detection Took So Long - Benchmarks, safety evaluations, spot checks, and canary deployments did not capture the degradation, partly because Claude often recovers from isolated mistakes. - Privacy controls limit engineers' access to conversations that users did not submit as feedback, which made the problematic interactions hard to examine. - Each bug produced different symptoms on different platforms at different rates, so the reports looked random. - Anthropic relied too heavily on noisy evaluations and did not quickly connect the August 29 spike in reports to the load balancing change. ### What Anthropic Is Changing - Developing evaluations that more reliably separate working implementations from broken ones. - Running quality evaluations continuously on production systems, not only in regular testing. - Building debugging tools that work with community feedback without compromising user privacy. - Encouraging direct feedback through `/bug` in Claude Code or the thumbs-down button in the Claude apps. Developers with new evaluation methods can reach out to feedback@anthropic.com. If you use top-p sampling, it's worth checking your settings after these fixes. And if Claude produces unexpected output, the `/bug` command or thumbs-down button helps Anthropic catch problems like these sooner.