Drop `WebSearchTool` from non-compound `GroqModel` profiles so web search fallbacks run

Merged
DS
1mo ago
+486-4

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

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 -

2026-11-03 · pre-push review 1 of 3 at 620a3de0f080773f2cffe57f638e73fe41bcf5bc · iter -

2026-11-04 · second opinion: none · iter -

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.profile now drops WebSearchTool from supported native tools unless groq_always_has_web_search_builtin_tool is set, matching OpenAIChatModel.profile.
  • A required native WebSearchTool on a non-compound model now fails early with an error naming groq/compound and the local fallback option.
  • groq_model_profile is 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.