Skip to content
Pyrula

PydanticAI

Two adapters: one for tools, one for whole agents. Needs pip install pyrula-agents[pydantic-ai].

from_pydantic_ai_tool wraps a PydanticAI Tool as a Pyrula @tool, schema and all.

from pyrula.agents.integrations import from_pydantic_ai_tool
lookup = from_pydantic_ai_tool(my_pydantic_tool, timeout=30.0)

Tools declared with takes_ctx=True get a minimal run context with deps and run_id wired from the Pyrula turn.

pydantic_ai_agent wraps a PydanticAI agent as a Pyrula @agent. The PydanticAI agent runs inside the turn and its final validated output becomes the turn result.

from pyrula.agents.integrations import pydantic_ai_agent
planner = pydantic_ai_agent(my_pydantic_agent, name="planner")

The wrapped agent takes a prompt and optional deps; when deps is omitted it uses the turn’s ctx.deps. With stream=True (the default) it runs run_stream and forwards each PydanticAI event into the run stream as framework:event. Otherwise it runs the agent and returns its output.