Skip to content

Python: Anthropic provider does not normalize single tools #6901

Description

@VectorPeak

The Python Anthropic provider prepares tools by iterating options[tools] directly. Core ChatOptions accepts either a single tool or a sequence of tools, so passing a single FunctionTool currently raises TypeError before the request is sent, while passing a single dict tool is treated as dictionary keys instead of one tool specification.

Repro summary:

  • tools= -> TypeError: 'FunctionTool' object is not iterable
  • tools= -> {'tools': ['type', 'name', 'description']}
  • tools=[...] works as expected

Expected behavior:
The Anthropic provider should normalize the framework-level tools input before applying Anthropic-specific tool conversion, matching the behavior of other Python providers and core tool handling.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions