Skip to content
beam-agents
GitHub

class

PydanticAIAgent

beam_agents.adapters.pydantic_ai.agent.PydanticAIAgent

PydanticAIAgent(agent: 'PydanticAgent[Any, Any]', *, tools: 'Sequence[Tool]' = (), approval_required: 'Collection[str]' = (), decode_event: 'Callable[[bytes], str]' = <function _default_decode>, encode_output: 'Callable[[AgentRunResult[Any]], bytes]' = <function _default_encode>, hitl_timeout_ms: 'int | None' = None, models: 'Sequence[object]' = ()) -> 'None'

Docstring

Wraps a user-constructed pydantic_ai.Agent as a runtime agent.

The wrapped agent is never mutated: the adapter's toolset and output-type union are per-run arguments, and transport instrumentation touches only the model object's httpx client. tools are runtime @tool objects (re-tag side-effectful tools with side_effect=True and list approval-gated ones in approval_required — that is the whole adoption cost). models may name additional model objects to instrument (e.g. delegated sub-agents' models); the wrapped agent's own model is always probed.

src/beam_agents/adapters/pydantic_ai/agent.py:86