provrun.backends.pydantic_ai
The agent sees three folders:
/input the staged inputs, read-only
/output what the run hands back, writable
/scratch working space, writable, not part of the bundleprovrun, not the agent, writes the evidence. One PydanticAI capability,
evidence_capability, sees every step of the run:
- each model request, streamed or not, writes
model_called; - each call of a function tool, from any toolset or capability, writes
tool_called; - a call that waits for approval, or is deferred, writes
tool_calledwithdeferredset, and writes it again when it runs; - the output tool, when the agent answers through one, writes
tool_calledwithoutput_toolset. In a streamed request it is written before themodel_calledwhose response asked for it, because PydanticAI checks the output while the stream is still open; - each tool that the provider ran itself, and returned in a response, writes
tool_calledwithprovider_runset and confidenceparsed, because provrun sees only the provider’s account of it.
The backend itself has text output and no provider tools, so it never makes the last two; they matter to other callers of the capability.
After the run, the whole message history is imported as one
trace_imported event with confidence parsed.
evidence_capability
evidence_capability(ctx: RunContext) -> AbstractCapabilityMake the PydanticAI capability that writes provrun’s evidence for one run.
Code other than the backend can pass it to its own agent, streamed or not.
| Parameter | Type | Default | Description |
|---|---|---|---|
ctx |
RunContext | required | The run whose recorder takes the evidence: model_called, tool_called and the rest the module lists |
| returns | AbstractCapability | A capability to pass in an agent’s capabilities; it needs provrun[pydantic-ai] |
class PydanticAIBackend
PydanticAIBackend(model: Any = None, registry: ToolRegistry | None = None)A PydanticAI agent with a filesystem sandbox over the run’s folders.
The sandbox mounts the input, output and scratch folders. It needs provrun[pydantic-ai].
| Parameter | Type | Default | Description |
|---|---|---|---|
model |
Any | None |
A PydanticAI Model to use instead of agent.model, for tests; None infers it from agent.model |
registry |
ToolRegistry | None | None |
Where the agent’s tools are found by name; None is a ToolRegistry of the entry points |
PydanticAIBackend.execute
async PydanticAIBackend.execute(ctx: RunContext, agent: AgentSpec, run: RunSpec) -> RunResultRun the agent in the sandbox, and import its message history as trace_imported.
It writes the output to response.txt in the output folder unless the agent wrote that file. Raises ValueError for a tool that the registry lacks or that is not in_process.
| Parameter | Type | Default | Description |
|---|---|---|---|
ctx |
RunContext | required | The run; its recorder takes the evidence the module lists |
agent |
AgentSpec | required | The agent to run; its tools are found in the registry |
run |
RunSpec | required | The staged inputs and the run’s folders, mounted at /input, /output and /scratch |
| returns | RunResult | The agent’s output as text, and its token and request counts |