Drop `WebSearchTool` from non-compound `GroqModel` profiles so web search fallbacks run
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Closes #9098
Why we make these changes
Non-compound Groq models listed WebSearchTool in profile['supported_native_tools'], though only compound models search. The native-tool resolver kept the tool, then GroqModel raised a UserError at request time, so WebSearch(local=...) and WebSearchTool(optional=True) never fell back. GroqModel.profile now drops the tool unless groq_always_has_web_search_builtin_tool is set, following OpenAIChatModel.profile. groq_model_profile is unchanged, since the OpenAI-compatible and Vercel providers also use it.
New public surface
none
User-visible behavior
model = GroqModel('openai/gpt-oss-20b')
Agent(model, capabilities=[WebSearch(local='duckduckgo')]).run_sync('...')
# before: UserError: `WebSearchTool` is not supported by Groq
# after: runs the DuckDuckGo fallback; an optional WebSearchTool is dropped
Agent(model, capabilities=[NativeTool(WebSearchTool())]).run_sync('...')
# before: UserError: `WebSearchTool` is not supported by Groq
# after: UserError: `WebSearchTool` is not supported by Groq model 'openai/gpt-oss-20b'.
# Use a compound model such as 'groq/compound', or a local fallback such as `WebSearch(local='duckduckgo')`.
Verification
test_groq_web_search_tool_support_follows_compound_flag: profile on both sides of the compound flag, plus a user override.test_groq_non_compound_web_search_falls_back: recorded against Groq; the local fallback runs and an optional tool is dropped, with nosearch_settingssent.test_groq_non_compound_web_search_tool_requires_compound_model: the early error, before any request.
What changes for existing users
On non-compound Groq models, web search with a local fallback or optional=True now runs instead of raising, and a required native web search still raises, now naming a compound model, while compound models are unchanged.
PR decisions
2026-11-03 · early error names groq/compound · iter -
- Decision: GroqModel.prepare_request raises a UserError naming 'groq/compound' for a required WebSearchTool with no local fallback on a non-compound model; optional tools and unless_native fallbacks pass through to the resolver
- Why: follows OpenAIChatModel.prepare_request precedent; honors optional like GoogleModel's image-generation guard, since the resolver drops optional tools
- Source: https://github.com/pydantic/pydantic-ai/issues/9098
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
2026-11-03 · narrow in GroqModel.profile, not groq_model_profile · iter -
- Decision: WebSearchTool is dropped in a GroqModel.profile override; groq_model_profile is unchanged
- Why: groq_model_profile also feeds providers/openai_compatible.py and providers/vercel.py; agent_docs/index.md rule 717
- Source: https://github.com/pydantic/pydantic-ai/issues/9098
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
2026-11-03 · new tests use openai/gpt-oss-20b · iter -
- Decision: new Groq tests use openai/gpt-oss-20b as the non-compound model
- Why: Groq returns model_not_found for llama-3.3-70b-versatile on recording; gpt-oss-20b is live and already used by test_structured_content_input
- Source: https://github.com/pydantic/pydantic-ai/issues/9098
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
2026-11-03 · pre-push review 1 of 3 at 620a3de0f080773f2cffe57f638e73fe41bcf5bc · iter -
- Decision: reserved; dispatching fresh Haiku reviewer from policy-base checkout
- Why: tree 976614a457537840a9d0c464288cf1197c6e4905; scope f379d17dae1569ea5722b9f1f8bf9a4aa24c5e4b..620a3de0f080773f2cffe57f638e73fe41bcf5bc (full branch, first review); policy base 854b3d08bdcc050ee64965031eace0e1d5357e74
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/9098-groq-web-search-non-compound
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
2026-11-03 · pre-push review 1 of 3 at 620a3de0f080773f2cffe57f638e73fe41bcf5bc · iter -
- Decision: no findings: reviewer returned current at 620a3de0f080773f2cffe57f638e73fe41bcf5bc
- Why: reviewed tree 976614a457537840a9d0c464288cf1197c6e4905; scope f379d17da..620a3de0f full branch; headless Haiku reviewer from policy-base checkout 854b3d08b
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/9098-groq-web-search-non-compound
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
2026-11-04 · second opinion: none · iter -
- Decision: no additional review surface after douwebot APPROVE at 620a3de0f
- Why: David chose None; merge bar already met (CI green, clean douwebot approval)
- Source: https://github.com/pydantic/pydantic-ai/pull/12386
- Session: fa7db37b-b904-42db-a04e-7db662e18fd6
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.
Summary by cubic
Fixes non-compound Groq models advertising WebSearchTool support and then failing at request time, so web search with a local fallback or optional=True now works instead of raising a UserError.
GroqModel.profilenow dropsWebSearchToolfrom supported native tools unlessgroq_always_has_web_search_builtin_toolis set, matchingOpenAIChatModel.profile.- A required native
WebSearchToolon a non-compound model now fails early with an error naminggroq/compoundand the local fallback option. groq_model_profileis unchanged since the OpenAI-compatible and Vercel providers also consume it.- Adds tests covering the profile flag, the local fallback path, optional tool dropping, and the early error.