Skip to content

API Reference

Classes:

Name Description
PydanticAIAgent

Adapter class to wrap a Pydantic AI Agent for use with FastAPIAgents and resolve runtime dependencies.

PydanticAIAgent

Adapter class to wrap a Pydantic AI Agent for use with FastAPIAgents and resolve runtime dependencies.

Parameters:

Name Type Description Default
agent Agent

The Pydantic AI Agent with deps_type specified.

required
deps Optional[Callable[[], Any]]

Optional function to resolve runtime dependencies.

None

Example:

from fastapi_agents.pydantic_ai import PydanticAIAgent
from pydantic_ai import Agent

agent = Agent("openai:gpt-4o-mini")
pydantic_ai_agent = PydanticAIAgent(agent)

Raises:

Type Description
ValueError

If the agent has deps_type specified, but deps resolver is not provided.

ValueError

If the agent does not have deps_type specified, but deps resolver is provided.

Returns:

Name Type Description
PydanticAIAgent

A Pydantic AI Agent with runtime dependency resolution.