-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add Anthropic built-in WebFetchTool support
#3427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
9a92f05
8a0bbcc
3e36dc5
a95b249
f72bbe8
726957b
4ddee67
4d5da14
31dbe36
cd8b04b
4e54dfb
d8ef825
f8f9cd5
ba7f1fd
1e59fce
89751ce
b054020
ced98b4
e8f7a25
17fb30c
c048d15
52f2f86
de6d0c3
c533090
4dbc892
9bc5856
69939e2
3121c32
21cd40a
f518769
ec674ce
c038623
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -315,9 +315,9 @@ allowing it to pull up-to-date information from the web. | |
|
|
||
| | Provider | Supported | Notes | | ||
| |----------|-----------|-------| | ||
| | Anthropic | ✅ | Full feature support. Uses Anthropic's [Web Fetch Tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-fetch-tool) internally to retrieve URL contents. | | ||
| | Google | ✅ | No [`BuiltinToolCallPart`][pydantic_ai.messages.BuiltinToolCallPart] or [`BuiltinToolReturnPart`][pydantic_ai.messages.BuiltinToolReturnPart] is currently generated; please submit an issue if you need this. Using built-in tools and function tools (including [output tools](output.md#tool-output)) at the same time is not supported; to use structured output, use [`PromptedOutput`](output.md#prompted-output) instead. | | ||
|
||
| | OpenAI | ❌ | | | ||
| | Anthropic | ❌ | | | ||
| | Groq | ❌ | | | ||
| | Bedrock | ❌ | | | ||
| | Mistral | ❌ | | | ||
|
|
@@ -327,7 +327,23 @@ allowing it to pull up-to-date information from the web. | |
|
|
||
| ### Usage | ||
|
|
||
| ```py {title="url_context_basic.py"} | ||
| ```py {title="url_context_anthropic.py"} | ||
| from pydantic_ai import Agent, UrlContextTool | ||
|
|
||
| agent = Agent('anthropic:claude-sonnet-4-0', builtin_tools=[UrlContextTool()]) | ||
|
|
||
| result = agent.run_sync('What is the first sentence on https://ai.pydantic.dev?') | ||
| print(result.output) | ||
| """ | ||
| Pydantic AI is a Python agent framework designed to make it less painful to build production grade applications with Generative AI. | ||
| """ | ||
| ``` | ||
|
|
||
| _(This example is complete, it can be run "as is")_ | ||
|
|
||
| With Google, you can also use `UrlContextTool`: | ||
sarth6 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```py {title="url_context_google.py"} | ||
| from pydantic_ai import Agent, UrlContextTool | ||
|
|
||
| agent = Agent('google-gla:gemini-2.5-flash', builtin_tools=[UrlContextTool()]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,6 +171,7 @@ class UrlContextTool(AbstractBuiltinTool): | |
| Supported by: | ||
| * Anthropic | ||
| """ | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.