sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Support for Anthropic advanced tool use

Open rjesh-git opened this issue 11 months ago • 2 comments

Problem Statement

Problem Statement

Support for Anthropic's advanced tool use features released in November 2024. These features enable agents to work with large tool libraries more efficiently and handle complex workflows that aren't feasible with traditional tool calling patterns.

capabilities:

  • Tool Search Tool: Allows agents to discover and load tools on-demand instead of loading all tool definitions upfront, reducing token consumption by up to 85%
  • Programmatic Tool Calling: Enables agents to orchestrate tools through code execution, keeping intermediate results out of context and reducing latency
  • Tool Use Examples: Provides a standard way to demonstrate correct tool usage patterns beyond JSON schema definitions

Proposed Solution

Add support for Anthropic's advanced tool use beta features to the SDK:

  1. Implement Tool Search Tool support with defer_loading parameter for tool definitions
  2. Add Programmatic Tool Calling with allowed_callers configuration for code execution integration
  3. Support input_examples field in tool definitions for Tool Use Examples
  4. Include the beta header advanced-tool-use-2025-11-20 when these features are enabled

Use Case

Enables building production-grade agents that can:

  • Work with hundreds or thousands of tools without context window overflow
  • Process large datasets efficiently by keeping intermediate results out of context
  • Achieve higher accuracy through concrete usage examples
  • Reduce latency by orchestrating multiple tool calls in code rather than through individual API round-trips

Alternatives Solutions

No response

Additional Context

  • Anthropic blog post: https://www.anthropic.com/engineering/advanced-tool-use
  • API documentation: https://platform.claude.com/docs/en/agents-and-tools/tool-use/
  • Released: November 24, 2025
  • Beta feature requiring opt-in header

rjesh-git avatar Dec 16 '25 22:12 rjesh-git

Tracking tool search in https://github.com/strands-agents/harness-sdk/issues/263

Porting programmatic tool calling tool from strands-tools to harness-sdk/vended-tools in https://github.com/chaynabors/harness-sdk/pull/57

gautamsirdeshmukh avatar Jul 16 '26 15:07 gautamsirdeshmukh

Adding a use case for the tool search part of this issue.

We run an agent on Amazon Bedrock through BedrockModel with 65 to 80 tools across several domains. The tool definitions come to roughly 15k tokens and are re-read on every model call, and Anthropic documents that tool selection degrades past 30 to 50 tools. The tool search tool (tool_search_tool_regex_20251119 / tool_search_tool_bm25_20251119 plus defer_loading: true) addresses both, and it keeps the cached prefix intact because discovered definitions are added inline in the conversation.

What blocks it in the Python SDK today:

  • BedrockModel calls the Converse API, and Bedrock does not offer tool search through Converse. It is only available through the Messages API endpoint and InvokeModel.
  • AnthropicModel passes server tools through anthropic_tools, but it builds function tools from ToolSpec with only name, description and input_schema, so there is no way to set defer_loading. It also constructs only the first-party client, and it has no Bedrock Guardrails support.
  • The tool selection design (the Hide strategy) filters the tool list per invocation. On Converse every change to the tool list invalidates the prompt cache from the tools onward, and the cache-preserving provider-native mode the design leaves for later does not exist on Converse, so it is not a substitute for deferred loading.

What we need is a supported way to mark tools as deferred and include the tool search tool on a Bedrock path that also supports guardrails, for example the InvokeModel provider in #1217.

surecloud-jleite avatar Oct 29 '26 09:10 surecloud-jleite