docs/capabilities/x-search.md
The [XSearch][pydantic_ai.capabilities.XSearch] capability gives your agent search over X (Twitter) posts. It's a provider-adaptive tool backed by [XSearchTool][pydantic_ai.native_tools.XSearchTool] on the native side — see X Search Tool for configuration options.
Unlike Web Search and Web Fetch, there is no default non-xAI fallback: X search is only available natively on xAI models. If your agent is not running on an xAI model, set fallback_model explicitly to an xAI model that supports [XSearchTool][pydantic_ai.native_tools.XSearchTool], and search requests are delegated to that model as a subagent tool:
from pydantic_ai import Agent
from pydantic_ai.capabilities import XSearch
agent = Agent(
'anthropic:claude-sonnet-4-6',
capabilities=[XSearch(fallback_model='xai:grok-4.3')],
)