Skip to main content

Testimony Records from Pydantic AI

pip install testimony-pydantic-ai

Or one file: copy testimony_pydantic_ai.py and testimony_emit.py next to your agent. There is nothing else to install and nothing here depends on OMEM.

from pydantic_ai import Agent
from testimony_pydantic_ai import Recorder

def decide(req):
    # req.action, req.arguments, req.tool_call_id, req.risk_class.
    # Your approval UI, queue or ticket goes here. The identity has to come
    # from your authentication layer; this adapter has none to find.
    if req.action == "close_account":
        return req.refuse("a balance is outstanding")
    return req.approve(approver={"id": "r.okonkwo@example.com", "kind": "human"},
                       identity_source="auth-session")

rec = Recorder(
    agent={"id": "support-agent", "kind": "agent"},
    risk={"issue_refund": "high", "close_account": "high",
          "search_docs": "low"},
    decide=decide,
)
result = rec.run_sync(agent, "Refund order 8842")
rec.write("record.jsonl")
$ testimony-validate record.jsonl
Conformance: TR-4

Why this one exists, in a line of their own type signature

Pydantic AI already has the pause. DeferredToolRequests carries the calls waiting for a person and DeferredToolResults carries the answers. Those answers are typed:

approvals: dict[str, bool | DeferredToolApprovalResult]

A bare True approves. That is not a criticism of the design, which is cleaner than most: ToolApproved carries override_args, so the framework already understands that what was approved and what the model proposed can differ. But a boolean has nowhere to put a person. Ten agent systems were read against a published rubric, and this is where almost all of them stop: of the eight systems that take or gate actions, one could name the person who approved one, six could not because nothing on the approval path identifies a person, and in the eighth it could not be determined from outside the vendor.

So this adapter never writes one. It requires an approver and a source for that approver's identity, or it refuses to record an approval at all.

What the approver allowed, not what the model asked for

pydantic-ai#6968 is the framework side of a defect that is also open in Haystack and named from the other direction in AutoGen: an approver shown one set of arguments while another set executes has not approved the action that happened.

req.approve(..., arguments=...) becomes the framework's override_args, and the record then carries both: arguments is what the person allowed and proposed_arguments is what the model asked for. A reader can see the difference instead of inferring it from which version was deployed.

Colorado asks for this from 1 January 2027

Proposed Rule 7.7 under Colorado's Automated Decision-Making Technology Act requires a deployer to retain a record showing, when a human reviews an automated decision: the reviewer's identity, review timestamps, the primary evidence available to them, whether they approved, modified or overrode the output, and a written justification. The rules were filed on 11 August 2026 and take effect with the act on 1 January 2027 if adopted. They are not law yet.

A reading of ten widely deployed agent systems found that of the eight which take or gate consequential actions, one can identify the person who approved one, and that one is the reference implementation of this specification, which is disclosed rather than left to be found.

What this framework can show, measured, including the awkward one

Pydantic AI is the only one of six that can say it does not know whether an effect occurred: BaseToolReturnPart.outcome is a literal of success, failed, denied and interrupted, and denied separates a policy refusal from a runtime error. Nothing else read comes close on that question.

On whether a reviewer modified an action it cannot say, and this was reproduced rather than reasoned about. A reviewer shown {'ticket': 0, 'amount': 0} approved with override args {'ticket': 41, 'amount': 1}, the tool executed the override, and the message history records the original arguments as the call. The executed arguments appear nowhere as a call. Rule 7.7 asks for that distinction twice.

Read 9 September 2026 at machinetestimony.org/approval-binding/, with the file and line behind every verdict.

What it will not do

It will not fail open. If your decide returns anything that is not a decision it issued, the run raises and no tool executes. openai-agents-python#4845 is that mistake in a shipped SDK: a callable predicate returned None from an unhandled branch, None read as "no approval needed", and the gate opened.

It will not classify risk from anything the model produced. Risk comes from a table you own, and a tool missing from it raises rather than defaulting.

It will not invent an approver, let the acting agent approve its own action, or accept an identity source the proposing model could have written.

It will not answer a deferred external call. Those are results only the caller can supply, and inventing one would put a fact in the record that never happened.

A refusal becomes a ToolDenied carrying your reason, so the model is told why rather than told nothing, and it is recorded with the same standing as a permission.

Tests

tests/tests_pydantic_ai_testimony.py, 35 checks, against a real Agent with the framework's own FunctionModel. No network and no API key: only the model is scripted. The tools, requires_approval, the pause and the resume are the real ones. CI installs the library and fails if the suite skips.

MIT. Copyright 2026 Garnet Taurus Ltd. The specification: https://datatracker.ietf.org/doc/draft-clifford-testimony-record/

Metadata

Release files for testimony-pydantic-ai 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testimony-pydantic-ai 0.2.1
File Size Uploaded Provenance
testimony_pydantic_ai-0.2.1.tar.gz 40.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for testimony-pydantic-ai 0.2.1
File Interpreter ABI Platform
testimony_pydantic_ai-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 82.3 kB

Release files / testimony_pydantic_ai-0.2.1.tar.gz

Download URL testimony_pydantic_ai-0.2.1.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
566950799cdb810a087afa553dc453a0991bb6d92dc9a5f5e1061d7510c75e6f
BLAKE2b-256 checksum
How to use checksums
5cdee1b3b1b717da4242d27675b6a30a5fa5ea1299ddd4accaa1db9f78722218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release files / testimony_pydantic_ai-0.2.1-py3-none-any.whl

Download URL testimony_pydantic_ai-0.2.1-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7bbad723a8414bd83c8b294817acf9429ac91f519bf26739d6988180f588d49
BLAKE2b-256 checksum
How to use checksums
08a7e60ae82ca16aaf46f6b9e7dd0be282f44cb7202a8cc2f48383d1d09d588d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Security for testimony-pydantic-ai 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for testimony_pydantic_ai-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page