-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Initial Checks
- I confirm that I'm using the latest version of Pydantic AI
- I confirm that I searched for my issue in https://github.com/pydantic/pydantic-ai/issues before opening this issue
Description
running uv run pytest tests/models/test_anthropic.py::test_anthropic_memory_tool --record-mode=rewrite throughs an error:
except APIStatusError as e:
if (status_code := e.status_code) >= 400:
> raise ModelHTTPError(status_code=status_code, model_name=self.model_name, body=e.body) from e
E pydantic_ai.exceptions.ModelHTTPError: status_code: 400, model_name: claude-sonnet-4-5, body: {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': "tools.0: Input tag 'memory_20250818' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'"}, 'request_id': 'req_011CVJ4LP69nn2yLGMW2B5WX'}
looking for memory_20250818 in the codebase, it's under models/anthropic.py::AnthopicModel._add_builtin_tools()
filing the issue cause I don't yet know which of the two possible reasons in the title is causing the error
Example Code
anthropic_model = AnthropicModel(
'claude-sonnet-4-5',
provider=AnthropicProvider(api_key=anthropic_api_key),
settings=AnthropicModelSettings(extra_headers={'anthropic-beta': 'context-1m-2025-08-07'}),
)
agent = Agent(anthropic_model, builtin_tools=[MemoryTool()])
with pytest.raises(UserError, match="Built-in `MemoryTool` requires a 'memory' tool to be defined."):
await agent.run('Where do I live?')Python, Pydantic AI & LLM client version
python 3.12.10 | pydantic 2.11.7 | pydantic-ai 1.19.1.dev15+41598ec6 | openai 2.8.0