TECHNOLOGY

Pydantic AI tool approval can carry reviewed argument overrides

In this article
THE QUICK TAKE

Preserve the original pending call, correlate the decision by tool-call identity and review any argument override as the action that will execute.

Preserve the proposed action for review

A research agent proposes updating a shared annotation file, but a person must review the destination and content first. Pydantic AI’s deferred-tool guide can end the run with approval requests containing tool name, validated arguments and tool-call identity. Persist that proposal with its conversation state. Asking the model to recreate the action after review can produce a different destination or payload.

Distinguish permission from reviewed editing

The tool API defines ToolApproved with optional override_args. A reviewer can therefore approve an adjusted action rather than merely accept the original arguments. Display and retain the effective arguments that the tool will receive. An approval label beside the original proposal is misleading when the application silently supplies a different destination or changed content through the override.

Return decisions under the original call identity

Approval results map to the tool-call identifiers emitted by the preceding run. A denial can carry a message for the model through ToolDenied. Keep those identifiers intact when decisions arrive asynchronously or a review screen contains several calls. Do not match solely by tool name: repeated invocations of the same update tool can refer to different files and require different reviewer decisions.

Continue from the pending conversation

The history guide explains deferred results at the current conversation frontier. Resume using the original history or conversation together with correlated results. The continuation resolves pending work; it should not be treated as a new unconnected instruction asking the model to guess what was previously approved. Task contracts can identify the expected revised artifact and the conditions under which the update is acceptable.

Keep application authorization inside the execution boundary

Approval guards the model’s behavior, while a tool must still enforce the caller’s authority over the target resource. The deferred-tool documentation explicitly warns about client-submitted approvals and stateless endpoints. Tool observations should link the reviewed proposal, effective arguments, decision and actual write result. This gives a concrete record of what a person reviewed without turning an approval object into evidence that every client-supplied target is authorized.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles