Skip to main content

agent-toolprint (Python)

Python port of @p-vbordei/agent-toolprint. Byte-deterministic-compatible: passes the same conformance vectors.

agent-toolprint is a double-signed receipt format for AI-agent tool invocations. The agent signs. The tool counter-signs. Anyone with the public keys can verify offline — no host, no service, no chain.

pip install agent-toolprint

30-second example

import asyncio, base64, os, uuid
from datetime import datetime, timezone
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from agent_toolprint import (
    Plaintext, VerifyOptions,
    countersign_tool, did_key_from_ed25519_pubkey, did_key_resolver,
    sha256_hash, sign_agent, verify,
)

def gen():
    sk = Ed25519PrivateKey.generate()
    return (
        sk.private_bytes(serialization.Encoding.Raw, serialization.PrivateFormat.Raw, serialization.NoEncryption()),
        sk.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw),
    )

async def main():
    agent_sk, agent_pk = gen()
    tool_sk, tool_pk = gen()
    args, response = {"query": "bun docs"}, {"results": ["https://bun.sh/docs"]}
    receipt = {
        "v": "tp/0.1",
        "id": str(uuid.uuid4()),
        "ts": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
        "agent": {"did": did_key_from_ed25519_pubkey(agent_pk), "key_id": "agent"},
        "tool":  {"did": did_key_from_ed25519_pubkey(tool_pk),  "key_id": "tool"},
        "call":   {"name": "search", "args_hash":     sha256_hash(args)},
        "result": {"status": "ok",   "response_hash": sha256_hash(response)},
        "nonce":  base64.b64encode(os.urandom(32)).decode("ascii"),
    }
    env = countersign_tool(sign_agent(receipt, agent_sk), tool_sk)
    res = await verify(env, VerifyOptions(
        resolver=did_key_resolver,
        plaintext=Plaintext(args=args, args_provided=True, response=response, response_provided=True),
    ))
    print(res.ok)  # True

asyncio.run(main())

Why this exists

The TypeScript reference defines a small, stable receipt protocol (DSSE + JCS + Ed25519, did:key identities). This package is the Python implementation of the same wire format — produced bytes are byte-identical, signatures verify across languages, and the same conformance vectors pass.

Conformance

uv run pytest -v

All 15 TS vectors across SPEC §6 clauses C1–C4 pass here.

License

Apache 2.0 — see LICENSE.

Metadata

Release files for agent-toolprint 0.1.0

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

Source distribution (sdist)

Source distribution for agent-toolprint 0.1.0
File Size Uploaded Provenance
agent_toolprint-0.1.0.tar.gz 17.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-toolprint 0.1.0
File Interpreter ABI Platform
agent_toolprint-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / agent_toolprint-0.1.0.tar.gz

Download URL agent_toolprint-0.1.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2e482df411cea34f34af5386ec5256dfcf1e9c570c0791f18171116b2cdfdc5a
BLAKE2b-256 checksum
How to use checksums
adffa063baf1b1ab521cf767ce2ba31ef8cd2beed8bb8c53f813e9d0bd8792a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / agent_toolprint-0.1.0-py3-none-any.whl

Download URL agent_toolprint-0.1.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31196109793dd370e519c0963c9dca9cfa17e8082da96257e1d466e1abe1c14b
BLAKE2b-256 checksum
How to use checksums
f4c002092c6b5f4ad27e2b9c011a4aa00867fcc6d1ff2ea0e5b99cc192fb161e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Security for agent-toolprint 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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