Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/pydantic/pydantic-ai
/ types & classes
Types & classes
3,079 in github.com/pydantic/pydantic-ai
⨍
Functions
21,322
◇
Types & classes
3,079
↳
Endpoints
183
↓ 4,212 callers
Class
Agent
Class for defining "agents" - a way to have a specific type of "conversation" with an LLM. Agents are generic in the dependency type they take [`
pydantic_ai_slim/pydantic_ai/agent/__init__.py:446
↓ 1,598 callers
Class
ModelResponse
A response from a model, e.g. a message from the model to the Pydantic AI app.
pydantic_ai_slim/pydantic_ai/messages.py:2799
↓ 1,457 callers
Class
ModelRequest
A request generated by Pydantic AI and sent to a model, e.g. a message from the Pydantic AI app to the model.
pydantic_ai_slim/pydantic_ai/messages.py:2091
↓ 1,374 callers
Class
FunctionModel
A model controlled by a local function. Apart from `__init__`, all methods are private or match those of the base class.
pydantic_ai_slim/pydantic_ai/models/function.py:51
↓ 1,283 callers
Class
UserPromptPart
A user prompt, generally written by the end user. Content comes from the `user_prompt` parameter of [`Agent.run`][pydantic_ai.agent.AbstractAgent
pydantic_ai_slim/pydantic_ai/messages.py:1125
↓ 1,139 callers
Class
TextPart
A plain text response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2150
↓ 958 callers
Class
TestModel
tests/models/test_model_test.py:474
↓ 811 callers
Class
RequestUsage
LLM usage associated with a single request. This is an implementation of `genai_prices.types.AbstractUsage` so it can be used to calculate the pr
pydantic_ai_slim/pydantic_ai/usage.py:274
↓ 752 callers
Class
ModelRequestParameters
Configuration for an agent's request to a model, specifically related to tools and output handling.
pydantic_ai_slim/pydantic_ai/models/__init__.py:178
↓ 736 callers
Class
ToolCallPart
A tool call from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2536
↓ 606 callers
Class
OpenAIProvider
Provider for OpenAI API. Changing `base_url` does not change the OpenAI model profile selection. For another service, use its dedicated provi
pydantic_ai_slim/pydantic_ai/providers/openai.py:28
↓ 466 callers
Class
ToolReturnPart
A tool return message, this encodes the result of running a tool.
pydantic_ai_slim/pydantic_ai/messages.py:1705
↓ 381 callers
Class
AnthropicModel
A model that uses the Anthropic API. Internally, this uses the [Anthropic Python client](https://github.com/anthropics/anthropic-sdk-python) to i
pydantic_ai_slim/pydantic_ai/models/anthropic.py:815
↓ 380 callers
Class
AnthropicProvider
Provider for Anthropic API.
pydantic_ai_slim/pydantic_ai/providers/anthropic.py:76
↓ 345 callers
Class
OpenAIResponsesModel
A model that uses the OpenAI Responses API. The [OpenAI Responses API](https://platform.openai.com/docs/api-reference/responses) is the new A
pydantic_ai_slim/pydantic_ai/models/openai.py:1974
↓ 331 callers
Class
UserError
Error caused by a usage mistake by the application developer — You!
pydantic_ai_slim/pydantic_ai/exceptions.py:229
↓ 262 callers
Class
ToolDefinition
Definition of a tool passed to a model. This is used for both function tools and output tools.
pydantic_ai_slim/pydantic_ai/tools.py:587
↓ 254 callers
Class
FunctionToolset
A toolset that lets Python functions be used as tools. See [toolset docs](../toolsets.md#function-toolset) for more information.
pydantic_ai_slim/pydantic_ai/toolsets/function.py:50
↓ 251 callers
Class
FakeRealtimeConnection
A connection that replays a fixed list of events and records what is sent.
tests/realtime/test_session.py:273
↓ 250 callers
Class
ResponseDone
The provider reported that its current response is done. This codec event is consumed by the session to finalize a [`ModelResponse`][pydantic
pydantic_ai_slim/pydantic_ai/realtime/codec.py:251
↓ 249 callers
Class
RunUsage
LLM usage associated with an agent run. Responsibility for calculating request usage is on the model; Pydantic AI simply sums the usage informati
pydantic_ai_slim/pydantic_ai/usage.py:342
↓ 244 callers
Class
OpenAIChatModel
A model that uses the OpenAI API. Internally, this uses the [OpenAI Python client](https://github.com/openai/openai-python) to interact with the
pydantic_ai_slim/pydantic_ai/models/openai.py:957
↓ 240 callers
Class
BedrockConverseModel
A model that uses the Bedrock Converse API.
pydantic_ai_slim/pydantic_ai/models/bedrock.py:601
↓ 214 callers
Class
ThinkingPart
A thinking response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2188
↓ 207 callers
Class
GoogleModel
A model that uses Gemini via `generativelanguage.googleapis.com` API. This is implemented from scratch rather than using a dedicated SDK, good AP
pydantic_ai_slim/pydantic_ai/models/google.py:500
↓ 204 callers
Class
NativeTool
A capability that registers a native tool with the agent. Wraps a single [`AgentNativeTool`][pydantic_ai.tools.AgentNativeTool] — either a static
pydantic_ai_slim/pydantic_ai/capabilities/native_tool.py:18
↓ 184 callers
Class
XaiProvider
Provider for xAI API (native xAI SDK).
pydantic_ai_slim/pydantic_ai/providers/xai.py:53
↓ 181 callers
Class
NativeToolCallPart
A tool call to a native tool. For native tools with a stable cross-provider shape (currently `tool_search`), this base class can be promoted
pydantic_ai_slim/pydantic_ai/messages.py:2558
↓ 172 callers
Class
NativeToolReturnPart
A tool return message from a native tool. For native tools with a stable cross-provider shape (currently `tool_search`), a `NativeToolReturnP
pydantic_ai_slim/pydantic_ai/messages.py:1727
↓ 171 callers
Class
MCPToolset
A toolset for connecting to an MCP server. `MCPToolset` is the recommended way to use [Model Context Protocol](https://modelcontextprotocol.io)
pydantic_ai_slim/pydantic_ai/mcp.py:717
↓ 166 callers
Class
XaiModel
A model that uses the xAI SDK to interact with xAI models.
pydantic_ai_slim/pydantic_ai/models/xai.py:303
↓ 156 callers
Class
ToolCall
The model is requesting a tool call.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:214
↓ 152 callers
Class
RetryPromptPart
A message back to a model asking it to try again. This can be sent for a number of reasons: * Pydantic validation of tool arguments failed,
pydantic_ai_slim/pydantic_ai/messages.py:1770
↓ 147 callers
Class
ModelSettings
Settings to configure an LLM. Includes only settings which apply to multiple models / model providers, though not all of these settings are s
pydantic_ai_slim/pydantic_ai/settings.py:90
↓ 146 callers
Class
GraphBuilder
A builder for constructing executable graph definitions. GraphBuilder provides a fluent interface for defining nodes, edges, and routing in a
pydantic_graph/pydantic_graph/graph_builder.py:1139
↓ 142 callers
Class
AnthropicModelSettings
Settings used for an Anthropic model request.
pydantic_ai_slim/pydantic_ai/models/anthropic.py:431
↓ 140 callers
Class
BinaryContent
Binary content, e.g. an audio or image file.
pydantic_ai_slim/pydantic_ai/messages.py:576
↓ 140 callers
Class
ModelProfile
Describes how requests to and responses from specific models or families of models need to be constructed and processed to get the best results, indep
pydantic_ai_slim/pydantic_ai/profiles/__init__.py:47
↓ 137 callers
Class
InstrumentationSettings
Options for instrumenting models and agents with OpenTelemetry. Used in: - [`Instrumentation`][pydantic_ai.capabilities.Instrumentation] cap
pydantic_ai_slim/pydantic_ai/models/instrumented.py:63
↓ 134 callers
Class
OutputTranscript
The model's textual output (partial or final): an audio transcript, or plain text output.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:166
↓ 133 callers
Class
AgentPlugin
Temporal worker plugin for a specific Pydantic AI agent. Accepts either a regular `Agent` carrying a [`TemporalDurability`][pydantic_ai.durab
pydantic_ai_slim/pydantic_ai/durable_exec/temporal/__init__.py:239
↓ 133 callers
Class
SystemPromptPart
A system prompt, generally written by the application developer. This gives the model context and guidance on how to respond.
pydantic_ai_slim/pydantic_ai/messages.py:209
↓ 132 callers
Class
ModelRetry
Exception to raise to request a model retry. Can be raised from tool functions, output validators, and capability hooks (such as `after_model
pydantic_ai_slim/pydantic_ai/exceptions.py:57
↓ 131 callers
Class
UIMessage
A message as displayed in the UI by Vercel AI Elements.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:389
↓ 131 callers
Class
WebSearchTool
A native tool that allows your agent to search the web for information. The parameters that PydanticAI passes depend on the model, as some parame
pydantic_ai_slim/pydantic_ai/native_tools/__init__.py:140
↓ 127 callers
Class
OpenAIResponsesModelSettings
Settings used for an OpenAI Responses model request. ALL FIELDS MUST BE `openai_` PREFIXED SO YOU CAN MERGE THEM WITH OTHER MODELS.
pydantic_ai_slim/pydantic_ai/models/openai.py:749
↓ 122 callers
Class
ImageUrl
A URL to an image.
pydantic_ai_slim/pydantic_ai/messages.py:448
↓ 118 callers
Class
BedrockModelSettings
Settings for Bedrock models. See [the Bedrock Converse API docs](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.htm
pydantic_ai_slim/pydantic_ai/models/bedrock.py:498
↓ 115 callers
Class
FakeRealtimeModel
A model that yields a pre-built connection and records connect arguments.
tests/realtime/test_session.py:329
↓ 113 callers
Class
InstructionPart
A single instruction part with metadata about its origin. Instructions are composed of one or more parts, each of which can be static (from a lit
pydantic_ai_slim/pydantic_ai/messages.py:1979
↓ 113 callers
Class
Instrumentation
Capability that instruments agent runs with OpenTelemetry/Logfire tracing. When added to an agent via `capabilities=[Instrumentation(...)]`, this
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:72
↓ 113 callers
Class
TextUIPart
A text part of a message.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:26
↓ 112 callers
Class
OpenAIRealtimeModel
OpenAI Realtime API model. Authentication and the base URL come from a [`Provider`][pydantic_ai.providers.Provider], mirroring [`OpenAIChatMo
pydantic_ai_slim/pydantic_ai/realtime/openai.py:892
↓ 110 callers
Class
FallbackModel
A model that uses one or more fallback models upon failure. Apart from `__init__`, all methods are private or match those of the base class.
pydantic_ai_slim/pydantic_ai/models/fallback.py:90
↓ 110 callers
Class
UsageLimits
Limits on model usage. The request count is tracked by pydantic_ai, and the request limit is checked before each request to the model. Token
pydantic_ai_slim/pydantic_ai/usage.py:446
↓ 109 callers
Class
Path
A sequence of path items defining data flow through the graph. Paths represent the route that data takes through the graph, including transfo
pydantic_graph/pydantic_graph/paths.py:130
↓ 107 callers
Class
PartStartEvent
An event indicating that a new part has started. If multiple `PartStartEvent`s are received with the same index, the new one should fully rep
pydantic_ai_slim/pydantic_ai/messages.py:4077
↓ 102 callers
Class
BinaryImage
Binary content that's guaranteed to be an image.
pydantic_ai_slim/pydantic_ai/messages.py:738
↓ 99 callers
Class
OnlineEvalConfig
Holds cross-evaluator defaults for online evaluation. Create instances for different evaluation configurations, or use the global `DEFAULT_CO
pydantic_evals/pydantic_evals/online.py:416
↓ 98 callers
Class
SpeechPart
Spoken audio exchanged during a realtime session, paired with its transcript. This part is a member of both [`ModelRequestPart`][pydantic_ai.mess
pydantic_ai_slim/pydantic_ai/messages.py:2338
↓ 98 callers
Class
SubmitMessage
Submit message request.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:411
↓ 97 callers
Class
CachePoint
A cache point marker for prompt caching. Can be inserted into UserPromptPart.content to mark cache boundaries. Models that don't support cach
pydantic_ai_slim/pydantic_ai/messages.py:790
↓ 96 callers
Class
FakeWebSocket
A minimal stand-in for a `websockets` client connection. Running out of scripted frames stands in for the server closing the connection normally,
tests/realtime/test_openai.py:816
↓ 96 callers
Class
GoogleProvider
Provider for the Gemini API (formerly Google AI Studio / Google GLA).
pydantic_ai_slim/pydantic_ai/providers/google.py:99
↓ 96 callers
Class
OpenAIModelProfile
Profile for models used with `OpenAIChatModel`. ALL FIELDS MUST BE `openai_` PREFIXED SO YOU CAN MERGE THEM WITH OTHER MODELS.
pydantic_ai_slim/pydantic_ai/profiles/openai.py:179
↓ 96 callers
Class
OpenRouterProvider
Provider for OpenRouter API.
pydantic_ai_slim/pydantic_ai/providers/openrouter.py:124
↓ 96 callers
Class
ToolAvailabilityDeltaPart
Records that the set of tools available to the model changed at this point. Additions only. Withdrawing a tool is not supported yet, because no p
pydantic_ai_slim/pydantic_ai/messages.py:2050
↓ 94 callers
Class
ToolOutput
Marker class to use a tool for output and optionally customize the tool. Example: ```python {title="tool_output.py"} from pydantic import
pydantic_ai_slim/pydantic_ai/output.py:83
↓ 92 callers
Class
NativeOutput
Marker class to use the model's native structured outputs functionality for outputs and optionally customize the name and description. Example:
pydantic_ai_slim/pydantic_ai/output.py:159
↓ 91 callers
Class
Hooks
Register hook functions via decorators or constructor kwargs. For extension developers building reusable capabilities, subclass [`AbstractCap
pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:757
↓ 91 callers
Class
MistralProvider
Provider for Mistral API.
pydantic_ai_slim/pydantic_ai/providers/mistral.py:48
↓ 91 callers
Class
UploadedFile
A reference to a file uploaded to a provider's file storage by ID. This allows referencing files that have been uploaded via provider-specific fi
pydantic_ai_slim/pydantic_ai/messages.py:839
↓ 87 callers
Class
PromptedOutput
Marker class to use a prompt to tell the model what to output and optionally customize the prompt. Example: ```python {title="prompted_output
pydantic_ai_slim/pydantic_ai/output.py:214
↓ 86 callers
Class
MistralModel
A model that uses Mistral. Internally, this uses the [Mistral Python client](https://github.com/mistralai/client-python) to interact with the API
pydantic_ai_slim/pydantic_ai/models/mistral.py:184
↓ 84 callers
Class
RunContext
Information about the current call.
pydantic_ai_slim/pydantic_ai/_run_context.py:133
↓ 82 callers
Class
DBOSDurability
Capability that makes an agent durable by routing I/O through DBOS steps. The capability routes model requests, MCP I/O, and optionally event-str
pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_durability.py:32
↓ 79 callers
Class
Tool
A tool function for an agent.
pydantic_ai_slim/pydantic_ai/tools.py:334
↓ 78 callers
Class
InputTranscript
A transcription of the user's audio input (partial or final). Providers with per-item IDs use `item_id` to associate interleaved transcripts with
pydantic_ai_slim/pydantic_ai/realtime/codec.py:185
↓ 76 callers
Class
PartDeltaEvent
An event indicating a delta update for an existing part.
pydantic_ai_slim/pydantic_ai/messages.py:4115
↓ 75 callers
Class
OpenRouterModel
Extends OpenAIChatModel to capture extra metadata for Openrouter.
pydantic_ai_slim/pydantic_ai/models/openrouter.py:662
↓ 74 callers
Class
PartEndEvent
An event indicating that a part is complete.
pydantic_ai_slim/pydantic_ai/messages.py:4131
↓ 73 callers
Class
AudioDelta
A chunk of audio output from the model.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:153
↓ 71 callers
Class
PrefectDurability
Capability that makes an agent durable by routing I/O through Prefect tasks. Built on the declarative base: the base owns toolset/model/event ass
pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_durability.py:32
↓ 70 callers
Class
CombinedCapability
A capability that combines multiple capabilities. When any child returns a fresh instance from [`for_agent`][pydantic_ai.capabilities.Abstrac
pydantic_ai_slim/pydantic_ai/capabilities/combined.py:53
↓ 68 callers
Class
Embedder
High-level interface for generating text embeddings. The `Embedder` class provides a convenient way to generate vector embeddings from text u
pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:143
↓ 67 callers
Class
ImageGeneration
Image generation capability. Uses the model's native image generation when available. When the model doesn't support it, the [direct image ge
pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:104
↓ 66 callers
Class
DeferredToolResults
Results for deferred tool calls from a previous run that required approval or external execution. The tool call IDs need to match those from the
pydantic_ai_slim/pydantic_ai/_deferred.py:158
↓ 66 callers
Class
DocumentUrl
The URL of the document.
pydantic_ai_slim/pydantic_ai/messages.py:494
↓ 66 callers
Class
OpenAIRealtimeConnection
A live WebSocket connection to the OpenAI Realtime API.
pydantic_ai_slim/pydantic_ai/realtime/openai.py:344
↓ 65 callers
Class
FilePart
A file response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2300
↓ 63 callers
Class
CodeExecutionTool
A native tool that allows your agent to execute code. Supported by: * Anthropic * OpenAI Responses * Google * Bedrock (Nova2.0)
pydantic_ai_slim/pydantic_ai/native_tools/__init__.py:357
↓ 63 callers
Class
Collector
Collects sink submissions for test assertions.
tests/evals/test_online.py:116
↓ 61 callers
Class
DynamicToolset
A toolset that dynamically builds a toolset using a function that takes the run context.
pydantic_ai_slim/pydantic_ai/toolsets/_dynamic.py:21
↓ 61 callers
Class
TemporalDurability
Capability that makes an agent durable by routing I/O through Temporal activities. When added to an agent, this capability intercepts model reque
pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_durability.py:119
↓ 59 callers
Class
TestImageGenerationModel
A deterministic image generation model for testing. This model returns a single 1x1 PNG without making any API calls, and records the reference i
pydantic_ai_slim/pydantic_ai/images/test.py:24
↓ 59 callers
Class
VercelAIAdapter
UI adapter for the Vercel AI protocol.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:152
↓ 57 callers
Class
AzureProvider
Provider for Azure OpenAI API. See <https://azure.microsoft.com/en-us/products/ai-foundry> for more information.
pydantic_ai_slim/pydantic_ai/providers/azure.py:50
↓ 57 callers
Class
MyOutput
tests/test_tools.py:1872
↓ 56 callers
Class
CompactionPart
A compaction part that summarizes previous conversation history. Compaction parts contain an opaque or readable summary of prior messages, pr
pydantic_ai_slim/pydantic_ai/messages.py:2249
↓ 56 callers
Class
EmbeddingResult
The result of an embedding operation. This class contains the generated embeddings along with metadata about the operation, including the ori
pydantic_ai_slim/pydantic_ai/embeddings/result.py:22
next →
1–100 of 3,079, ranked by callers