provrun.tools
A tool is a function in the PydanticAI form: an async function whose first
argument is RunContext[RunDeps]. Each tool has an execution mode. Only
in_process runs now; client_round_trip is for Foundry function tools,
which provrun runs when Foundry asks, and remote_mcp is for tools that run
elsewhere and are imported into the evidence.
The registry finds tools in two places:
- the entry point group
provrun.tools, one function for each entry - a tools folder, in which each module lists its tools in
TOOLS
The PydanticAI backend records every tool through its evidence capability, so each
call writes tool_called.
class RunDeps
RunDeps(sandbox: Sandbox, run: ProvrunContext)What a tool gets through ctx.deps: the sandbox and the run.
| Parameter | Type | Default | Description |
|---|---|---|---|
sandbox |
Sandbox | required | The agent’s filesystem sandbox, over /input, /output and /scratch |
run |
ProvrunContext | required | The provrun run context; a tool writes evidence through run.recorder |
class Tool
Tool(name: str, fn: Callable[..., Any], mode: str = 'in_process')One tool: the name an agent spec gives it, its function and its execution mode.
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
str | required | The name in an agent spec’s tools |
fn |
Callable[…, Any] | required | The function, in the PydanticAI form |
mode |
str | 'in_process' |
One of TOOL_MODES; only in_process runs now |
class ToolRegistry
ToolRegistry(folders: list[Path] | None = None)The tools that agents can call, by name.
| Parameter | Type | Default | Description |
|---|---|---|---|
folders |
list[Path] | None | None |
Tools folders to load as well as the entry points |
ToolRegistry.add
ToolRegistry.add(tool: Tool) -> NoneAdd one tool. Raises ValueError for a mode not in TOOL_MODES.
| Parameter | Type | Default | Description |
|---|---|---|---|
tool |
Tool | required | The tool; one with the same name is replaced |
ToolRegistry.load_folder
ToolRegistry.load_folder(folder: Path) -> NoneImport each module in folder, and add the tools in its TOOLS list.
A module whose name starts with _ is skipped. Raises ValueError for a module with no TOOLS.
| Parameter | Type | Default | Description |
|---|---|---|---|
folder |
Path | required | A folder of modules, each with a TOOLS list of functions or Tools |
ToolRegistry.get
ToolRegistry.get(names: list[str]) -> list[Tool]Find tools by name. Raises ValueError for a name that is not here.
| Parameter | Type | Default | Description |
|---|---|---|---|
names |
list[str] | required | The tool names, as an agent spec lists them |
| returns | list[Tool] | The tools, in the order named |