sdkagent

pydantic-ai API reference

400 public APIs from pydantic-ai (pydantic/pydantic-ai) — 176 classes, 49 functions, 175 methods. Signatures extracted by static analysis of the actual source.

Repository: pydantic/pydantic-ai

KindCount
Classes176
Functions49
Methods175

API list

func.claude.skills.testing-skill.parse_cassette.parse_cassette(path:Path, interaction_idx:int | None=None) -> None
Parse and print cassette contents.
funcclai.clai.cli()
Run the clai CLI and exit.
classpydantic_ai_slim.pydantic_ai._agent_graph.AgentNode
The base class for all agent nodes.
classpydantic_ai_slim.pydantic_ai._agent_graph.GraphAgentDeps
Dependencies/config passed to the agent graph.
classpydantic_ai_slim.pydantic_ai._agent_graph.GraphAgentState
State kept across the execution of the agent graph.
funcpydantic_ai_slim.pydantic_ai._agent_graph.resolve_run_id(explicit:str | None, message_history:Sequence[_messages.ModelMessage] | None) -> str
Resolve the `run_id` to use for an agent run.
classpydantic_ai_slim.pydantic_ai._cancel.RunBinding
Bridge an `AgentRunEvents` handle to the run it starts.
methodpydantic_ai_slim.pydantic_ai._cancel.RunCancellation.bind(task:asyncio.Task[object] | None=None) -> None
Bind the task that is currently driving the run.
methodpydantic_ai_slim.pydantic_ai._cancel.RunCancellation.cancel() -> None
Request cancellation of the run from any thread.
classpydantic_ai_slim.pydantic_ai._cli.SimpleCodeBlock
Customized code blocks in markdown.
funcpydantic_ai_slim.pydantic_ai._cli.cli(args_list:Sequence[str] | None=None, *prog_name:str='clai', *default_model:str='openai:gpt-5') -> int
Run the CLI and return the exit code for the process.
funcpydantic_ai_slim.pydantic_ai._cli.cli_exit(prog_name:str='clai')
Run the CLI and exit.
funcpydantic_ai_slim.pydantic_ai._cli.load_agent(agent_path:str) -> Agent[Any, Any] | None
Load an agent from a module path or a YAML/JSON spec file.
classpydantic_ai_slim.pydantic_ai._function_schema.FunctionSchema
Internal information about a function schema.
classpydantic_ai_slim.pydantic_ai._json_schema.InlineDefsJsonSchemaTransformer
Transforms the JSON Schema to inline $defs.
classpydantic_ai_slim.pydantic_ai._run_context.RunContext
Information about the current call.
methodpydantic_ai_slim.pydantic_ai._run_context.RunContext.cancel() -> None
Cancel the agent run this context belongs to.
funcpydantic_ai_slim.pydantic_ai._run_context.set_current_run_context(run_context:RunContext[Any]) -> Generator[None]
Context manager to set the current run context.
classpydantic_ai_slim.pydantic_ai._ssrf.ResolvedUrl
Result of URL validation and DNS resolution.
funcpydantic_ai_slim.pydantic_ai._ssrf.is_private_ip(ip_str:str) -> bool
Check if an IP address is in a private/internal range.
funcpydantic_ai_slim.pydantic_ai._ssrf.resolve_hostname(hostname:str) -> list[str]
Resolve a hostname to its IP addresses using DNS.
funcpydantic_ai_slim.pydantic_ai._ssrf.resolve_redirect_url(current_url:str, location:str) -> str
Resolve a redirect location against the current URL.
funcpydantic_ai_slim.pydantic_ai._ssrf.validate_and_resolve_url(url:str, allow_local:bool) -> ResolvedUrl
Validate URL and resolve hostname to IP addresses.
classpydantic_ai_slim.pydantic_ai._tool_search.ToolSearchArgs
Typed arguments for a tool-search call.
classpydantic_ai_slim.pydantic_ai._tool_search.ToolSearchMatch
A single match in a tool-search result.
classpydantic_ai_slim.pydantic_ai._utils.Some
Analogous to Rust's `Option::Some` type.
classpydantic_ai_slim.pydantic_ai._utils.Unset
A singleton to represent an unset value.
funcpydantic_ai_slim.pydantic_ai._utils.aclose_if_supported(stream:AsyncIterable[Any]) -> None
Close an async iterable if it exposes an `aclose` method.
funcpydantic_ai_slim.pydantic_ai._utils.dataclasses_no_defaults_repr(self:Any) -> str
Exclude fields with values equal to the field default.
funcpydantic_ai_slim.pydantic_ai._utils.generate_tool_call_id() -> str
Generate a tool call id.
funcpydantic_ai_slim.pydantic_ai._utils.is_model_like(type_:Any) -> bool
Check if something is a pydantic model, dataclass or typedict.
funcpydantic_ai_slim.pydantic_ai._utils.is_str_dict(obj:Any) -> TypeGuard[dict[str, Any]]
Check if obj is a dict, narrowing the type to `dict[str, Any]`.
funcpydantic_ai_slim.pydantic_ai._utils.is_text_like_media_type(media_type:str) -> bool
Check if a media type represents text-like content.
funcpydantic_ai_slim.pydantic_ai._utils.sanitize_tool_name(name:str) -> str
Replace characters outside `[a-zA-Z0-9_-]` with `_`.
funcpydantic_ai_slim.pydantic_ai._uuid.uuid7() -> uuid.UUID
Generate a UUIDv7 (time-sortable UUID) per RFC 9562.
classpydantic_ai_slim.pydantic_ai._warnings.CostCalculationFailedWarning
Warning raised when cost calculation fails.
classpydantic_ai_slim.pydantic_ai._warnings.CostNotFoundWarning
Warning raised when cost is not found.
methodpydantic_ai_slim.pydantic_ai.agent.Agent.deps_type() -> type
The type of dependencies used by the agent.
methodpydantic_ai_slim.pydantic_ai.agent.Agent.description() -> str | None
A human-readable description of the agent.
methodpydantic_ai_slim.pydantic_ai.agent.Agent.name() -> str | None
The name of the agent, used for logging.
funcpydantic_ai_slim.pydantic_ai.agent.abstract.AbstractAgent.on_complete() -> None
Called when the stream has completed.
methodpydantic_ai_slim.pydantic_ai.agent.spec.AgentSpec.from_dict(data:dict[str, Any]) -> AgentSpec
Validate a dictionary into an AgentSpec.
methodpydantic_ai_slim.pydantic_ai.agent.spec.AgentSpec.from_file(path:Path | str, fmt:Literal['yaml', 'json'] | None=None) -> AgentSpec
Load an agent spec from a YAML or JSON file.
methodpydantic_ai_slim.pydantic_ai.agent.spec.AgentSpec.from_text(text:str, fmt:Literal['yaml', 'json']='yaml') -> AgentSpec
Parse YAML or JSON text into an AgentSpec.
classpydantic_ai_slim.pydantic_ai.agent.wrapper.WrapperAgent
Agent which wraps another agent.
classpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability
Abstract base class for agent capabilities.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.after_tool_validate(ctx:RunContext[AgentDepsT], *call:ToolCallPart, *tool_def:ToolDefinition, *args:ValidatedToolArgs) -> ValidatedToolArgs
Modify validated args.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.before_run(ctx:RunContext[AgentDepsT]) -> None
Called before the agent run starts.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.from_spec(*args:Any, **kwargs:Any) -> AbstractCapability[Any]
Create from spec arguments.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.wrap_model_request(ctx:RunContext[AgentDepsT], *request_context:ModelRequestContext, *handler:WrapModelRequestHandler) -> ModelResponse
Wraps the model request.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.wrap_output_process(ctx:RunContext[AgentDepsT], *output_context:OutputContext, *output:Any, *handler:WrapOutputProcessHandler) -> Any
Wraps output processing.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.wrap_output_validate(ctx:RunContext[AgentDepsT], *output_context:OutputContext, *output:RawOutput, *handler:WrapOutputValidateHandler) -> Any
Wraps output validation.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.wrap_run(ctx:RunContext[AgentDepsT], *handler:WrapRunHandler) -> AgentRunResult[Any]
Wraps the entire agent run.
methodpydantic_ai_slim.pydantic_ai.capabilities.abstract.AbstractCapability.wrap_tool_execute(ctx:RunContext[AgentDepsT], *call:ToolCallPart, *tool_def:ToolDefinition, *args:ValidatedToolArgs, *handler:WrapToolExecuteHandler) -> Any
Wraps tool execution.
classpydantic_ai_slim.pydantic_ai.capabilities.image_generation.ImageGeneration
Image generation capability.
classpydantic_ai_slim.pydantic_ai.capabilities.mcp.MCP
MCP server capability.
classpydantic_ai_slim.pydantic_ai.capabilities.thinking.Thinking
Enables and configures model thinking/reasoning.
classpydantic_ai_slim.pydantic_ai.capabilities.toolset.Toolset
A capability that provides a toolset.
classpydantic_ai_slim.pydantic_ai.capabilities.web_fetch.WebFetch
URL fetching capability.
classpydantic_ai_slim.pydantic_ai.capabilities.web_search.WebSearch
Web search capability.
classpydantic_ai_slim.pydantic_ai.capabilities.x_search.XSearch
X (Twitter) search capability.
classpydantic_ai_slim.pydantic_ai.common_tools.duckduckgo.DuckDuckGoResult
A DuckDuckGo search result.
classpydantic_ai_slim.pydantic_ai.common_tools.duckduckgo.DuckDuckGoSearchTool
The DuckDuckGo search tool.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaAnswerResult
An Exa answer result with citations.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaAnswerTool
The Exa answer tool.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaContentResult
Content retrieved from a URL.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaFindSimilarTool
The Exa find similar tool.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaGetContentsTool
The Exa get contents tool.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaSearchResult
An Exa search result with content.
classpydantic_ai_slim.pydantic_ai.common_tools.exa.ExaSearchTool
The Exa search tool.
classpydantic_ai_slim.pydantic_ai.common_tools.tavily.TavilySearchResult
A Tavily search result.
classpydantic_ai_slim.pydantic_ai.common_tools.tavily.TavilySearchTool
The Tavily search tool.
classpydantic_ai_slim.pydantic_ai.common_tools.web_fetch.WebFetchResult
Result of fetching a web page.
classpydantic_ai_slim.pydantic_ai.concurrency.AbstractConcurrencyLimiter
Abstract base class for concurrency limiters.
methodpydantic_ai_slim.pydantic_ai.concurrency.AbstractConcurrencyLimiter.acquire(source:str) -> None
Acquire a slot, waiting if necessary.
methodpydantic_ai_slim.pydantic_ai.concurrency.AbstractConcurrencyLimiter.release() -> None
Release a slot.
classpydantic_ai_slim.pydantic_ai.durable_exec.dbos._utils.StepConfig
Configuration for a step in the DBOS workflow.
classpydantic_ai_slim.pydantic_ai.durable_exec.prefect._types.TaskConfig
Configuration for a task in Prefect.
classpydantic_ai_slim.pydantic_ai.durable_exec.temporal._logfire.LogfirePlugin
Temporal client plugin for Logfire.
classpydantic_ai_slim.pydantic_ai.embeddings.Embedder
High-level interface for generating text embeddings.
methodpydantic_ai_slim.pydantic_ai.embeddings.Embedder.count_tokens(text:str) -> int
Count the number of tokens in the given text.
methodpydantic_ai_slim.pydantic_ai.embeddings.Embedder.embed_documents(documents:str | Sequence[str], *settings:EmbeddingSettings | None=None) -> EmbeddingResult
Embed one or more document texts.
methodpydantic_ai_slim.pydantic_ai.embeddings.Embedder.embed_query(query:str | Sequence[str], *settings:EmbeddingSettings | None=None) -> EmbeddingResult
Embed one or more query texts.
classpydantic_ai_slim.pydantic_ai.embeddings.base.EmbeddingModel
Abstract base class for embedding models.
methodpydantic_ai_slim.pydantic_ai.embeddings.base.EmbeddingModel.count_tokens(text:str) -> int
Count the number of tokens in the given text.
methodpydantic_ai_slim.pydantic_ai.embeddings.base.EmbeddingModel.model_name() -> str
The name of the embedding model.
methodpydantic_ai_slim.pydantic_ai.embeddings.base.EmbeddingModel.settings() -> EmbeddingSettings | None
Get the default settings for this model.
classpydantic_ai_slim.pydantic_ai.embeddings.bedrock.BedrockEmbeddingModel
Bedrock embedding model implementation.
methodpydantic_ai_slim.pydantic_ai.embeddings.bedrock.BedrockEmbeddingModel.base_url() -> str
The base URL for the provider API.
methodpydantic_ai_slim.pydantic_ai.embeddings.bedrock.BedrockEmbeddingModel.model_name() -> BedrockEmbeddingModelName
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.bedrock.BedrockEmbeddingModel.system() -> str
The embedding model provider.
classpydantic_ai_slim.pydantic_ai.embeddings.cohere.CohereEmbeddingModel
Cohere embedding model implementation.
methodpydantic_ai_slim.pydantic_ai.embeddings.cohere.CohereEmbeddingModel.model_name() -> CohereEmbeddingModelName
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.cohere.CohereEmbeddingModel.system() -> str
The embedding model provider.
classpydantic_ai_slim.pydantic_ai.embeddings.google.GoogleEmbeddingModel
Google embedding model implementation.
methodpydantic_ai_slim.pydantic_ai.embeddings.google.GoogleEmbeddingModel.model_name() -> GoogleEmbeddingModelName
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.google.GoogleEmbeddingModel.system() -> str
The embedding model provider.
funcpydantic_ai_slim.pydantic_ai.embeddings.infer_embedding_model(model:EmbeddingModel | KnownEmbeddingModelName | str, *provider_factory:Callable[[str], Provider[Any]]=infer_provider) -> EmbeddingModel
Infer the model from the name.
classpydantic_ai_slim.pydantic_ai.embeddings.openai.OpenAIEmbeddingModel
OpenAI embedding model implementation.
methodpydantic_ai_slim.pydantic_ai.embeddings.openai.OpenAIEmbeddingModel.model_name() -> OpenAIEmbeddingModelName
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.openai.OpenAIEmbeddingModel.system() -> str
The embedding model provider.
classpydantic_ai_slim.pydantic_ai.embeddings.result.EmbeddingResult
The result of an embedding operation.
classpydantic_ai_slim.pydantic_ai.embeddings.test.TestEmbeddingModel
A mock embedding model for testing.
methodpydantic_ai_slim.pydantic_ai.embeddings.test.TestEmbeddingModel.model_name() -> str
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.test.TestEmbeddingModel.system() -> str
The embedding model provider.
classpydantic_ai_slim.pydantic_ai.embeddings.voyageai.VoyageAIEmbeddingModel
VoyageAI embedding model implementation.
methodpydantic_ai_slim.pydantic_ai.embeddings.voyageai.VoyageAIEmbeddingModel.base_url() -> str
The base URL for the provider API.
methodpydantic_ai_slim.pydantic_ai.embeddings.voyageai.VoyageAIEmbeddingModel.model_name() -> VoyageAIEmbeddingModelName
The embedding model name.
methodpydantic_ai_slim.pydantic_ai.embeddings.voyageai.VoyageAIEmbeddingModel.system() -> str
The embedding model provider.
classpydantic_ai_slim.pydantic_ai.exceptions.AgentRunError
Base class for errors occurring during an agent run.
classpydantic_ai_slim.pydantic_ai.exceptions.ModelAPIError
Raised when a model provider API request fails.
classpydantic_ai_slim.pydantic_ai.exceptions.ModelRetry
Exception to raise to request a model retry.
classpydantic_ai_slim.pydantic_ai.exceptions.UnexpectedModelBehavior
Error caused by unexpected Model behavior, e.g.
classpydantic_ai_slim.pydantic_ai.exceptions.UserError
Error caused by a usage mistake by the application developer — You!
classpydantic_ai_slim.pydantic_ai.ext.langchain.LangChainToolset
A toolset that wraps LangChain tools.
funcpydantic_ai_slim.pydantic_ai.ext.langchain.tool_from_langchain(langchain_tool:LangChainTool) -> Tool
Creates a Pydantic AI tool proxy from a LangChain tool.
funcpydantic_ai_slim.pydantic_ai.format_prompt.format_as_xml(obj:Any, root_tag:str | None=None, item_tag:str='item', none_str:str='null', indent:str | None=' ', include_field_info:Literal['once'] | bool=False) -> str
Format a Python object as XML.
classpydantic_ai_slim.pydantic_ai.function_signature.FunctionParam
A single parameter in a function signature.
classpydantic_ai_slim.pydantic_ai.mcp.BaseResource
Base class for MCP resources.
classpydantic_ai_slim.pydantic_ai.mcp.EmbeddedResource
A resource embedded into a prompt or tool call result.
classpydantic_ai_slim.pydantic_ai.mcp.Icon
An icon for display in user interfaces.
classpydantic_ai_slim.pydantic_ai.mcp.MCPError
Raised when an MCP server returns an error response.
methodpydantic_ai_slim.pydantic_ai.mcp.MCPError.from_mcp_sdk(error:mcp_exceptions.McpError) -> MCPError
Create an MCPError from an MCP SDK McpError.
classpydantic_ai_slim.pydantic_ai.mcp.MCPToolset
A toolset for connecting to an MCP server.
methodpydantic_ai_slim.pydantic_ai.mcp.MCPToolset.direct_call_tool(name:str, args:dict[str, Any], *metadata:dict[str, Any] | None=None, *use_task:bool=False) -> Any
Call a tool on the server directly.
classpydantic_ai_slim.pydantic_ai.mcp.Prompt
A prompt or prompt template that the server offers.
methodpydantic_ai_slim.pydantic_ai.mcp.Prompt.from_mcp_sdk(mcp_prompt:mcp_types.Prompt) -> Prompt
Convert from MCP SDK Prompt to PydanticAI Prompt.
classpydantic_ai_slim.pydantic_ai.mcp.PromptArgument
An argument for a prompt template.
classpydantic_ai_slim.pydantic_ai.mcp.PromptMessage
A message returned as part of a prompt result.
classpydantic_ai_slim.pydantic_ai.mcp.Resource
A resource that can be read from an MCP server.
methodpydantic_ai_slim.pydantic_ai.mcp.Resource.from_mcp_sdk(mcp_resource:mcp_types.Resource) -> Resource
Convert from MCP SDK Resource to PydanticAI Resource.
classpydantic_ai_slim.pydantic_ai.mcp.ResourceAnnotations
Additional properties describing MCP entities.
classpydantic_ai_slim.pydantic_ai.mcp.ServerCapabilities
Capabilities that an MCP server supports.
funcpydantic_ai_slim.pydantic_ai.mcp.load_mcp_toolsets(config_path:str | Path) -> list[AbstractToolset[Any]]
Load `MCPToolset`s from a configuration file.
classpydantic_ai_slim.pydantic_ai.messages.AudioUrl
A URL to an audio file.
methodpydantic_ai_slim.pydantic_ai.messages.AudioUrl.format() -> AudioFormat
The file format of the audio file.
classpydantic_ai_slim.pydantic_ai.messages.BaseToolCallPart
A tool call from a model.
methodpydantic_ai_slim.pydantic_ai.messages.BaseToolCallPart.args_as_dict(*raise_if_invalid:bool=False) -> dict[str, Any]
Return the arguments as a Python dictionary.
methodpydantic_ai_slim.pydantic_ai.messages.BaseToolCallPart.args_as_json_str() -> str
Return the arguments as a JSON string.
methodpydantic_ai_slim.pydantic_ai.messages.BaseToolCallPart.has_content() -> bool
Return `True` if the tool call has content.
classpydantic_ai_slim.pydantic_ai.messages.BaseToolReturnPart
Base class for tool return parts.
methodpydantic_ai_slim.pydantic_ai.messages.BaseToolReturnPart.has_content() -> bool
Return `True` if the tool return has content.
classpydantic_ai_slim.pydantic_ai.messages.BinaryContent
Binary content, e.g.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.base64() -> str
Return the binary data as a base64-encoded string.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.data_uri() -> str
Convert the `BinaryContent` to a data URI.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.format() -> str
The file format of the binary content.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.from_data_uri(data_uri:str) -> BinaryContent
Create a `BinaryContent` from a data URI.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.from_path(path:PathLike[str]) -> BinaryContent
Create a `BinaryContent` from a path.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.is_audio() -> bool
Return `True` if the media type is an audio type.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.is_image() -> bool
Return `True` if the media type is an image type.
methodpydantic_ai_slim.pydantic_ai.messages.BinaryContent.is_video() -> bool
Return `True` if the media type is a video type.
classpydantic_ai_slim.pydantic_ai.messages.BinaryImage
Binary content that's guaranteed to be an image.
classpydantic_ai_slim.pydantic_ai.messages.CachePoint
A cache point marker for prompt caching.
classpydantic_ai_slim.pydantic_ai.messages.DocumentUrl
The URL of the document.
methodpydantic_ai_slim.pydantic_ai.messages.DocumentUrl.format() -> DocumentFormat
The file format of the document.
classpydantic_ai_slim.pydantic_ai.messages.FilePart
A file response from a model.
methodpydantic_ai_slim.pydantic_ai.messages.FilePart.has_content() -> bool
Return `True` if the file content is non-empty.
classpydantic_ai_slim.pydantic_ai.messages.FileUrl
Abstract base class for any URL-based file.
methodpydantic_ai_slim.pydantic_ai.messages.FileUrl.format() -> str
The file format.
methodpydantic_ai_slim.pydantic_ai.messages.FileUrl.identifier() -> str
The identifier of the file, such as a unique ID.
classpydantic_ai_slim.pydantic_ai.messages.ImageUrl
A URL to an image.
methodpydantic_ai_slim.pydantic_ai.messages.ImageUrl.format() -> ImageFormat
The file format of the image.
classpydantic_ai_slim.pydantic_ai.messages.ModelResponse
A response from a model, e.g.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.cost() -> genai_types.PriceCalculation
Calculate the cost of the usage.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.files() -> list[BinaryContent]
Get the files in the response.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.images() -> list[BinaryImage]
Get the images in the response.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.text() -> str | None
Get the text in the response.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.thinking() -> str | None
Get the thinking in the response.
methodpydantic_ai_slim.pydantic_ai.messages.ModelResponse.tool_calls() -> list[ToolCallPart]
Get the tool calls in the response.
classpydantic_ai_slim.pydantic_ai.messages.NativeToolCallPart
A tool call to a native tool.
classpydantic_ai_slim.pydantic_ai.messages.NativeToolReturnPart
A tool return message from a native tool.
classpydantic_ai_slim.pydantic_ai.messages.PartEndEvent
An event indicating that a part is complete.
classpydantic_ai_slim.pydantic_ai.messages.PartStartEvent
An event indicating that a new part has started.
classpydantic_ai_slim.pydantic_ai.messages.RetryPromptPart
A message back to a model asking it to try again.
classpydantic_ai_slim.pydantic_ai.messages.TextContent
String content that is tagged with additional metadata.
classpydantic_ai_slim.pydantic_ai.messages.TextPart
A plain text response from a model.
methodpydantic_ai_slim.pydantic_ai.messages.TextPart.has_content() -> bool
Return `True` if the text content is non-empty.
classpydantic_ai_slim.pydantic_ai.messages.ThinkingPart
A thinking response from a model.
classpydantic_ai_slim.pydantic_ai.messages.ToolCallPart
A tool call from a model.
methodpydantic_ai_slim.pydantic_ai.messages.UploadedFile.format() -> str
A general-purpose media-type-to-format mapping.
methodpydantic_ai_slim.pydantic_ai.messages.UploadedFile.identifier() -> str
The identifier of the file, such as a unique ID.
classpydantic_ai_slim.pydantic_ai.messages.UserPromptPart
A user prompt, generally written by the end user.
classpydantic_ai_slim.pydantic_ai.messages.VideoUrl
A URL to a video.
methodpydantic_ai_slim.pydantic_ai.messages.VideoUrl.format() -> VideoFormat
The file format of the video.
methodpydantic_ai_slim.pydantic_ai.messages.VideoUrl.is_youtube() -> bool
True if the URL has a YouTube domain.
classpydantic_ai_slim.pydantic_ai.models.DownloadedItem
The downloaded data and its type.
classpydantic_ai_slim.pydantic_ai.models.Model
Abstract class for a model.
methodpydantic_ai_slim.pydantic_ai.models.Model.base_url() -> str | None
The base URL for the provider API, if available.
methodpydantic_ai_slim.pydantic_ai.models.Model.label() -> str
Human-friendly display label for the model.
methodpydantic_ai_slim.pydantic_ai.models.Model.model_name() -> str
The model name.
methodpydantic_ai_slim.pydantic_ai.models.Model.profile() -> ModelProfile
The model profile.
methodpydantic_ai_slim.pydantic_ai.models.Model.provider() -> Provider[InterfaceClient] | None
The provider for this model, if any.
methodpydantic_ai_slim.pydantic_ai.models.Model.request(messages:list[ModelMessage], model_settings:ModelSettings | None, model_request_parameters:ModelRequestParameters) -> ModelResponse
Make a request to the model.
methodpydantic_ai_slim.pydantic_ai.models.Model.settings() -> ModelSettings | None
Get the model settings.
methodpydantic_ai_slim.pydantic_ai.models.Model.system() -> str
The model provider, ex: openai.
classpydantic_ai_slim.pydantic_ai.models.ModelRequestContext
Context for model request hooks.
classpydantic_ai_slim.pydantic_ai.models.StreamedResponse
Streamed response from an LLM when calling a tool.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.cancel() -> None
Cancel the stream, stopping token generation.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.close_stream() -> None
Close the underlying HTTP/gRPC connection.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.model_name() -> str
Get the model name of the response.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.provider_name() -> str | None
Get the provider name.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.provider_url() -> str | None
Get the provider base URL.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.timestamp() -> datetime
Get the timestamp of the response.
methodpydantic_ai_slim.pydantic_ai.models.StreamedResponse.usage() -> RequestUsage
Get the usage of the response so far.
classpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicCompaction
Compaction capability for Anthropic models.
classpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicModel
A model that uses the Anthropic API.
methodpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicModel.model_name() -> AnthropicModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicModel.profile() -> AnthropicModelProfile
The model profile.
methodpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.anthropic.AnthropicModelSettings
Settings used for an Anthropic model request.
classpydantic_ai_slim.pydantic_ai.models.bedrock.BedrockConverseModel
A model that uses the Bedrock Converse API.
methodpydantic_ai_slim.pydantic_ai.models.bedrock.BedrockConverseModel.model_name() -> str
The model name.
methodpydantic_ai_slim.pydantic_ai.models.bedrock.BedrockConverseModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.bedrock.BedrockModelSettings
Settings for Bedrock models.
classpydantic_ai_slim.pydantic_ai.models.cerebras.CerebrasModel
A model that uses Cerebras's OpenAI-compatible API.
classpydantic_ai_slim.pydantic_ai.models.cerebras.CerebrasModelSettings
Settings used for a Cerebras model request.
funcpydantic_ai_slim.pydantic_ai.models.check_allow_model_requests() -> None
Check if model requests are allowed.
classpydantic_ai_slim.pydantic_ai.models.cohere.CohereModel
A model that uses the Cohere API.
methodpydantic_ai_slim.pydantic_ai.models.cohere.CohereModel.model_name() -> CohereModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.cohere.CohereModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.cohere.CohereModelSettings
Settings used for a Cohere model request.
funcpydantic_ai_slim.pydantic_ai.models.concurrency.limit_model_concurrency(model:Model | KnownModelName, limiter:AnyConcurrencyLimit) -> Model
Wrap a model with concurrency limiting.
funcpydantic_ai_slim.pydantic_ai.models.create_async_http_client(*timeout:int=DEFAULT_HTTP_TIMEOUT, *connect:int=5) -> httpx.AsyncClient
Create an HTTPX async client.
classpydantic_ai_slim.pydantic_ai.models.function.AgentInfo
Information about an agent.
classpydantic_ai_slim.pydantic_ai.models.function.DeltaThinkingPart
Incremental change to a thinking part.
classpydantic_ai_slim.pydantic_ai.models.function.DeltaToolCall
Incremental change to a tool call.
classpydantic_ai_slim.pydantic_ai.models.function.FunctionModel
A model controlled by a local function.
methodpydantic_ai_slim.pydantic_ai.models.function.FunctionModel.model_name() -> str
The model name.
methodpydantic_ai_slim.pydantic_ai.models.function.FunctionModel.system() -> str
The system / model provider.
funcpydantic_ai_slim.pydantic_ai.models.get_user_agent() -> str
Get the user agent string for the HTTP client.
classpydantic_ai_slim.pydantic_ai.models.google.GoogleModelSettings
Settings used for a Gemini model request.
classpydantic_ai_slim.pydantic_ai.models.groq.GroqModel
A model that uses the Groq API.
methodpydantic_ai_slim.pydantic_ai.models.groq.GroqModel.model_name() -> GroqModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.groq.GroqModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.groq.GroqModelSettings
Settings used for a Groq model request.
methodpydantic_ai_slim.pydantic_ai.models.huggingface.HuggingFaceModel.base_url() -> str
The base URL of the provider.
methodpydantic_ai_slim.pydantic_ai.models.huggingface.HuggingFaceModel.model_name() -> HuggingFaceModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.huggingface.HuggingFaceModel.system() -> str
The system / model provider.
funcpydantic_ai_slim.pydantic_ai.models.infer_model(model:Model | KnownModelName | str, provider_factory:Callable[[str], Provider[Any]]=infer_provider) -> Model
Infer the model from the name.
classpydantic_ai_slim.pydantic_ai.models.mcp_sampling.MCPSamplingModel
A model that uses MCP Sampling.
methodpydantic_ai_slim.pydantic_ai.models.mcp_sampling.MCPSamplingModel.model_name() -> str
The model name.
methodpydantic_ai_slim.pydantic_ai.models.mcp_sampling.MCPSamplingModel.system() -> str
The system / model provider, returns `'MCP'`.
classpydantic_ai_slim.pydantic_ai.models.mistral.MistralModel
A model that uses Mistral.
methodpydantic_ai_slim.pydantic_ai.models.mistral.MistralModel.model_name() -> MistralModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.mistral.MistralModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.mistral.MistralModelSettings
Settings used for a Mistral model request.
classpydantic_ai_slim.pydantic_ai.models.openai.OpenAIChatModel
A model that uses the OpenAI API.
methodpydantic_ai_slim.pydantic_ai.models.openai.OpenAIChatModel.model_name() -> OpenAIModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.openai.OpenAIChatModel.profile() -> OpenAIModelProfile
The model profile.
methodpydantic_ai_slim.pydantic_ai.models.openai.OpenAIChatModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.openai.OpenAIChatModelSettings
Settings used for an OpenAI model request.
classpydantic_ai_slim.pydantic_ai.models.openai.OpenAICompaction
Compaction capability for OpenAI Responses API.
classpydantic_ai_slim.pydantic_ai.models.openai.OpenAIResponsesModel
A model that uses the OpenAI Responses API.
methodpydantic_ai_slim.pydantic_ai.models.openai.OpenAIResponsesModel.model_name() -> OpenAIModelName
The model name.
methodpydantic_ai_slim.pydantic_ai.models.openai.OpenAIResponsesModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.openrouter.OpenRouterModelSettings
Settings used for an OpenRouter model request.
classpydantic_ai_slim.pydantic_ai.models.openrouter.OpenRouterUsageConfig
Configuration for OpenRouter usage.
classpydantic_ai_slim.pydantic_ai.models.test.TestModel
A model specifically for testing purposes.
methodpydantic_ai_slim.pydantic_ai.models.test.TestModel.model_name() -> str
The model name.
methodpydantic_ai_slim.pydantic_ai.models.test.TestModel.system() -> str
The model provider.
classpydantic_ai_slim.pydantic_ai.models.test.TestStreamedResponse
A structured response that streams test data.
methodpydantic_ai_slim.pydantic_ai.models.test.TestStreamedResponse.model_name() -> str
Get the model name of the response.
methodpydantic_ai_slim.pydantic_ai.models.test.TestStreamedResponse.provider_name() -> str
Get the provider name.
methodpydantic_ai_slim.pydantic_ai.models.test.TestStreamedResponse.provider_url() -> str | None
Get the provider base URL.
methodpydantic_ai_slim.pydantic_ai.models.test.TestStreamedResponse.timestamp() -> datetime
Get the timestamp of the response.
classpydantic_ai_slim.pydantic_ai.models.wrapper.WrapperModel
Model which wraps another model.
methodpydantic_ai_slim.pydantic_ai.models.wrapper.WrapperModel.settings() -> ModelSettings | None
Get the settings from the wrapped model.
classpydantic_ai_slim.pydantic_ai.models.xai.XaiModelSettings
Settings specific to xAI models.
classpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse
Implementation of `StreamedResponse` for xAI SDK.
methodpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse.model_name() -> str
Get the model name of the response.
methodpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse.provider_name() -> str
The model provider.
methodpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse.provider_url() -> str
Get the provider base URL.
methodpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse.system() -> str
The model provider system name.
methodpydantic_ai_slim.pydantic_ai.models.xai.XaiStreamedResponse.timestamp() -> datetime
Get the timestamp of the response.
classpydantic_ai_slim.pydantic_ai.models.zai.ZaiModel
A model that uses Z.AI's OpenAI-compatible API.
classpydantic_ai_slim.pydantic_ai.models.zai.ZaiModelSettings
Settings used for a Z.AI model request.
classpydantic_ai_slim.pydantic_ai.native_tools.AbstractNativeTool
A native tool that can be used by an agent.
methodpydantic_ai_slim.pydantic_ai.native_tools.AbstractNativeTool.label() -> str
Human-readable label for UI display.
methodpydantic_ai_slim.pydantic_ai.native_tools.AbstractNativeTool.unique_id() -> str
A unique identifier for the native tool.
classpydantic_ai_slim.pydantic_ai.native_tools.MemoryTool
A native tool that allows your agent to use memory.
classpydantic_ai_slim.pydantic_ai.native_tools.WebFetchTool
Allows your agent to access contents from URLs.
funcpydantic_ai_slim.pydantic_ai.profiles.amazon.amazon_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for an Amazon model.
classpydantic_ai_slim.pydantic_ai.profiles.anthropic.AnthropicModelProfile
Profile for models used with `AnthropicModel`.
funcpydantic_ai_slim.pydantic_ai.profiles.anthropic.anthropic_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for an Anthropic model.
funcpydantic_ai_slim.pydantic_ai.profiles.cohere.cohere_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Cohere model.
funcpydantic_ai_slim.pydantic_ai.profiles.deepseek.deepseek_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a DeepSeek model.
classpydantic_ai_slim.pydantic_ai.profiles.google.GoogleModelProfile
Profile for models used with `GoogleModel`.
funcpydantic_ai_slim.pydantic_ai.profiles.google.google_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Google model.
funcpydantic_ai_slim.pydantic_ai.profiles.grok.grok_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Grok model.
classpydantic_ai_slim.pydantic_ai.profiles.groq.GroqModelProfile
Profile for models used with GroqModel.
funcpydantic_ai_slim.pydantic_ai.profiles.groq.groq_model_profile(model_name:str) -> ModelProfile
Get the model profile for a Groq model.
funcpydantic_ai_slim.pydantic_ai.profiles.merge_profile(base:ModelProfile | None, *overrides:ModelProfile | None) -> ModelProfile
Merge profiles via dict-spread.
funcpydantic_ai_slim.pydantic_ai.profiles.meta.meta_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Meta model.
funcpydantic_ai_slim.pydantic_ai.profiles.mistral.mistral_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Mistral model.
funcpydantic_ai_slim.pydantic_ai.profiles.moonshotai.moonshotai_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a MoonshotAI model.
classpydantic_ai_slim.pydantic_ai.profiles.openai.OpenAIModelProfile
Profile for models used with `OpenAIChatModel`.
funcpydantic_ai_slim.pydantic_ai.profiles.openai.openai_model_profile(model_name:str) -> ModelProfile
Get the model profile for an OpenAI model.
funcpydantic_ai_slim.pydantic_ai.profiles.openai.validate_openai_profile(profile:ModelProfile) -> None
Validate an OpenAI-compatible profile after resolution.
funcpydantic_ai_slim.pydantic_ai.profiles.qwen.qwen_model_profile(model_name:str) -> ModelProfile | None
Get the model profile for a Qwen model.
classpydantic_ai_slim.pydantic_ai.profiles.zai.ZaiModelProfile
Profile for Z.AI (Zhipu AI) GLM models.
classpydantic_ai_slim.pydantic_ai.providers.Provider
Abstract class for a provider.
methodpydantic_ai_slim.pydantic_ai.providers.Provider.base_url() -> str
The base URL for the provider API.
methodpydantic_ai_slim.pydantic_ai.providers.Provider.client() -> InterfaceClient
The client for the provider.
methodpydantic_ai_slim.pydantic_ai.providers.Provider.model_profile(model_name:str) -> ModelProfile | None
The model profile for the named model, if available.
methodpydantic_ai_slim.pydantic_ai.providers.Provider.name() -> str
The provider name.
classpydantic_ai_slim.pydantic_ai.providers.anthropic.AnthropicProvider
Provider for Anthropic API.
classpydantic_ai_slim.pydantic_ai.providers.azure.AzureProvider
Provider for Azure OpenAI API.
classpydantic_ai_slim.pydantic_ai.providers.bedrock.BedrockModelProfile
Profile for models used with BedrockModel.
classpydantic_ai_slim.pydantic_ai.providers.bedrock.BedrockProvider
Provider for AWS Bedrock.
classpydantic_ai_slim.pydantic_ai.providers.cerebras.CerebrasProvider
Provider for Cerebras API.
classpydantic_ai_slim.pydantic_ai.providers.cohere.CohereProvider
Provider for Cohere API.
classpydantic_ai_slim.pydantic_ai.providers.deepseek.DeepSeekProvider
Provider for DeepSeek API.
classpydantic_ai_slim.pydantic_ai.providers.fireworks.FireworksProvider
Provider for Fireworks AI API.
classpydantic_ai_slim.pydantic_ai.providers.github.GitHubProvider
Provider for the retired GitHub Models API.
classpydantic_ai_slim.pydantic_ai.providers.groq.GroqProvider
Provider for Groq API.
classpydantic_ai_slim.pydantic_ai.providers.heroku.HerokuProvider
Provider for Heroku API.
classpydantic_ai_slim.pydantic_ai.providers.huggingface.HuggingFaceProvider
Provider for Hugging Face.
funcpydantic_ai_slim.pydantic_ai.providers.infer_provider(provider:str) -> Provider[Any]
Infer the provider from the provider name.
funcpydantic_ai_slim.pydantic_ai.providers.infer_provider_class(provider:str) -> type[Provider[Any]]
Infers the provider class from the provider name.
classpydantic_ai_slim.pydantic_ai.providers.litellm.LiteLLMProvider
Provider for LiteLLM API.
classpydantic_ai_slim.pydantic_ai.providers.mistral.MistralProvider
Provider for Mistral API.
classpydantic_ai_slim.pydantic_ai.providers.moonshotai.MoonshotAIProvider
Provider for MoonshotAI platform (Kimi models).
classpydantic_ai_slim.pydantic_ai.providers.nebius.NebiusProvider
Provider for Nebius AI Studio API.
classpydantic_ai_slim.pydantic_ai.providers.ollama.OllamaProvider
Provider for local or remote Ollama API.
classpydantic_ai_slim.pydantic_ai.providers.openai.OpenAIProvider
Provider for OpenAI API.
classpydantic_ai_slim.pydantic_ai.providers.openrouter.OpenRouterModelProfile
Profile for models used with OpenRouterModel.
classpydantic_ai_slim.pydantic_ai.providers.openrouter.OpenRouterProvider
Provider for OpenRouter API.
classpydantic_ai_slim.pydantic_ai.providers.ovhcloud.OVHcloudProvider
Provider for OVHcloud AI Endpoints.
classpydantic_ai_slim.pydantic_ai.providers.sambanova.SambaNovaProvider
Provider for SambaNova AI models.
methodpydantic_ai_slim.pydantic_ai.providers.sambanova.SambaNovaProvider.base_url() -> str
Return the base URL.
methodpydantic_ai_slim.pydantic_ai.providers.sambanova.SambaNovaProvider.client() -> AsyncOpenAI
Return the AsyncOpenAI client.
methodpydantic_ai_slim.pydantic_ai.providers.sambanova.SambaNovaProvider.model_profile(model_name:str) -> ModelProfile | None
Get model profile for SambaNova models.
methodpydantic_ai_slim.pydantic_ai.providers.sambanova.SambaNovaProvider.name() -> str
Return the provider name.
classpydantic_ai_slim.pydantic_ai.providers.sentence_transformers.SentenceTransformersProvider
Provider for Sentence Transformers API.
methodpydantic_ai_slim.pydantic_ai.providers.sentence_transformers.SentenceTransformersProvider.base_url() -> str
The base URL for the provider API.
methodpydantic_ai_slim.pydantic_ai.providers.sentence_transformers.SentenceTransformersProvider.client() -> Any
The client for the provider.
methodpydantic_ai_slim.pydantic_ai.providers.sentence_transformers.SentenceTransformersProvider.name() -> str
The provider name.
classpydantic_ai_slim.pydantic_ai.providers.together.TogetherProvider
Provider for Together AI API.
classpydantic_ai_slim.pydantic_ai.providers.vercel.VercelProvider
Provider for Vercel AI Gateway API.
classpydantic_ai_slim.pydantic_ai.providers.voyageai.VoyageAIProvider
Provider for VoyageAI API.
classpydantic_ai_slim.pydantic_ai.providers.xai.XaiProvider
Provider for xAI API (native xAI SDK).
classpydantic_ai_slim.pydantic_ai.providers.zai.ZaiProvider
Provider for Z.AI (Zhipu AI) API.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.response() -> _messages.ModelResponse
Get the current state of the response.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.run_id() -> str
The unique identifier for the agent run.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.stream_text(*delta:bool=False, *debounce_by:float | None=0.1) -> AsyncIterator[str]
Stream the text result as an async iterable.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.timestamp() -> datetime
Get the timestamp of the response.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.usage() -> RunUsage
Return the usage of the whole run.
methodpydantic_ai_slim.pydantic_ai.result.AgentStream.validate_response_output(message:_messages.ModelResponse, *allow_partial:bool=False) -> OutputDataT
Validate a structured result message.
classpydantic_ai_slim.pydantic_ai.retries.RetryConfig
The configuration for tenacity-based retrying.
classpydantic_ai_slim.pydantic_ai.run.AgentRunResult
The final result of an agent run.
methodpydantic_ai_slim.pydantic_ai.run.AgentRunResult.all_messages(*output_tool_return_content:str | None=None) -> list[_messages.ModelMessage]
Return the history of _messages.
methodpydantic_ai_slim.pydantic_ai.run.AgentRunResult.new_messages(*output_tool_return_content:str | None=None) -> list[_messages.ModelMessage]
Return the messages produced during this run.
methodpydantic_ai_slim.pydantic_ai.run.AgentRunResult.run_id() -> str
The unique identifier for the agent run.
methodpydantic_ai_slim.pydantic_ai.run.AgentRunResult.timestamp() -> datetime
Return the timestamp of last response.
methodpydantic_ai_slim.pydantic_ai.run.AgentRunResult.usage() -> _usage.RunUsage
Return the usage of the whole run.
classpydantic_ai_slim.pydantic_ai.settings.ModelSettings
Settings to configure an LLM.
methodpydantic_ai_slim.pydantic_ai.template.TemplateStr.render(deps:AgentDepsT | None=None) -> str
Render the template against the given deps object.
classpydantic_ai_slim.pydantic_ai.tool_manager.ToolManager
Manages tools for an agent run step.
classpydantic_ai_slim.pydantic_ai.tools.Tool
A tool function for an agent.
methodpydantic_ai_slim.pydantic_ai.tools.Tool.prepare_tool_def(ctx:RunContext[ToolAgentDepsT]) -> ToolDefinition | None
Get the tool definition.
classpydantic_ai_slim.pydantic_ai.tools.ToolDefinition
Definition of a tool passed to a model.
methodpydantic_ai_slim.pydantic_ai.tools.ToolDefinition.defer() -> bool
Whether calls to this tool will be deferred.
classpydantic_ai_slim.pydantic_ai.toolsets.abstract.ToolsetTool
Definition of a tool available on a toolset.
classpydantic_ai_slim.pydantic_ai.toolsets.combined.CombinedToolset
A toolset that combines multiple toolsets.
classpydantic_ai_slim.pydantic_ai.ui._adapter.StateDeps
Dependency type that holds state.
classpydantic_ai_slim.pydantic_ai.ui._adapter.StateHandler
Protocol for state handlers in agent runs.
methodpydantic_ai_slim.pydantic_ai.ui._adapter.StateHandler.state() -> Any
Get the current state of the agent run.
classpydantic_ai_slim.pydantic_ai.ui._adapter.UIAdapter
Base class for UI adapters.
classpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream
Base class for UI event stream transformers.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.encode_event(event:EventT) -> str
Encode a protocol-specific event as a string.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_builtin_tool_call_end(part:NativeToolCallPart) -> AsyncIterator[EventT]
Handle the end of a `NativeToolCallPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_builtin_tool_call_start(part:NativeToolCallPart) -> AsyncIterator[EventT]
Handle a `NativeToolCallPart` at start.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_builtin_tool_return(part:NativeToolReturnPart) -> AsyncIterator[EventT]
Handle a `NativeToolReturnPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_compaction(part:CompactionPart) -> AsyncIterator[EventT]
Handle a `CompactionPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_file(part:FilePart) -> AsyncIterator[EventT]
Handle a `FilePart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_final_result(event:FinalResultEvent) -> AsyncIterator[EventT]
Handle a `FinalResultEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_function_tool_call(event:FunctionToolCallEvent) -> AsyncIterator[EventT]
Handle a `FunctionToolCallEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_function_tool_result(event:FunctionToolResultEvent) -> AsyncIterator[EventT]
Handle a `FunctionToolResultEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_part_delta(event:PartDeltaEvent) -> AsyncIterator[EventT]
Handle a PartDeltaEvent.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_part_end(event:PartEndEvent) -> AsyncIterator[EventT]
Handle a `PartEndEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_part_start(event:PartStartEvent) -> AsyncIterator[EventT]
Handle a `PartStartEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_run_result(event:AgentRunResultEvent) -> AsyncIterator[EventT]
Handle an `AgentRunResultEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_text_delta(delta:TextPartDelta) -> AsyncIterator[EventT]
Handle a `TextPartDelta`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_text_end(part:TextPart, followed_by_text:bool=False) -> AsyncIterator[EventT]
Handle the end of a `TextPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_text_start(part:TextPart, follows_text:bool=False) -> AsyncIterator[EventT]
Handle the start of a `TextPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_thinking_delta(delta:ThinkingPartDelta) -> AsyncIterator[EventT]
Handle a `ThinkingPartDelta`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_thinking_end(part:ThinkingPart, followed_by_thinking:bool=False) -> AsyncIterator[EventT]
Handle the end of a `ThinkingPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_thinking_start(part:ThinkingPart, follows_thinking:bool=False) -> AsyncIterator[EventT]
Handle the start of a `ThinkingPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_tool_availability_delta(event:ToolAvailabilityDeltaEvent) -> AsyncIterator[EventT]
Handle a `ToolAvailabilityDeltaEvent`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_tool_call_delta(delta:ToolCallPartDelta) -> AsyncIterator[EventT]
Handle a `ToolCallPartDelta`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_tool_call_end(part:ToolCallPart) -> AsyncIterator[EventT]
Handle the end of a `ToolCallPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.handle_tool_call_start(part:ToolCallPart) -> AsyncIterator[EventT]
Handle the start of a `ToolCallPart`.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.new_message_id() -> str
Generate and store a new message ID.
methodpydantic_ai_slim.pydantic_ai.ui._event_stream.UIEventStream.on_error(error:Exception) -> AsyncIterator[EventT]
Handle errors that occur during streaming.
classpydantic_ai_slim.pydantic_ai.ui._web.api.ChatRequestExtra
Extra data extracted from chat request.
classpydantic_ai_slim.pydantic_ai.ui._web.api.ConfigureFrontend
Response model for frontend configuration.
funcpydantic_ai_slim.pydantic_ai.ui._web.api.health(request:Request) -> Response
Health check endpoint.
funcpydantic_ai_slim.pydantic_ai.ui._web.api.options_chat(request:Request) -> Response
Handle CORS preflight requests.
funcpydantic_ai_slim.pydantic_ai.ui._web.api.post_chat(request:Request) -> Response
Handle chat requests via Vercel AI Adapter.
funcpydantic_ai_slim.pydantic_ai.ui._web.app.index(request:Request) -> Response
Serve the chat UI from filesystem cache or CDN.

About this data

These signatures were extracted from the public source of pydantic/pydantic-ai using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries