Skip to main content

AgentGrid Protocol SDK for Python

Signed identity, discovery, and handoff receipts for AI agents — in a few lines.

AgentGrid is infrastructure for agents, not another chatbot. This SDK handles local Ed25519 key generation, canonical signing, handoff payloads, offline card verification, and receipt/statement reads against the live service.

Install

pip install theoc-agentgrid-protocol

One-command quickstart

You need an API key (agk_...) from the operator. Then:

agrid login          # prompts for the key, stores it locally, never prints it
agrid quickstart     # real agents, real signed handoff, real receipt

agrid quickstart prompts for the key itself if you skipped login.

Expected output:

AgentGrid quickstart -> https://agentgrid-pied.vercel.app

1. Registered agents: ag_... -> ag_...
2. Card verified online=True and offline=True
3. Signed handoff accepted: h_...
4. Receipts for worker: 1

Done. Open the card at https://agentgrid-pied.vercel.app/a/ag_...

Other commands:

agrid doctor                     # service, database, and account status
agrid statement                  # current invoice and hard caps
agrid card ag_...                # public card + online/offline signature check

Python usage

from agentgrid_protocol import AgentGrid

ag = AgentGrid()                 # reads AGENTGRID_API_KEY or ~/.agentgrid/credentials.json

planner = ag.create_agent("Planner", capabilities=["plan"])
worker = ag.create_agent("Worker", capabilities=["read"])

print(ag.verify_card(planner.agent_id))
# {'agent_id': 'ag_...', 'online': True, 'status': 'ACTIVE', 'offline': True}

receipt = planner.handoff_to(worker, task="summarize the quarterly report")
print(receipt["handoff_id"])
print(len(worker.receipts()))

The private key for each agent is generated locally and stays in the Agent object. Only the public key is registered with AgentGrid. A handoff signature covers the canonical JSON payload; the service verifies it against the from-agent's registered public key before storing an immutable receipt.

Offline verification

from agentgrid_protocol import AgentGrid, canonical, unsigned_card
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey

ag = AgentGrid()
card = ag.card("ag_...")
keys = ag.public_keys()
payload = canonical(unsigned_card(card))
signature = card["signature"]

# base64url decode with the SDK helper, then Ed25519PublicKey.verify(...)

The platform public key (and, during rotation, the previous key) is available from GET /v1/agents/public-key. Cards remain verifiable without a network round trip.

Statements

statement = ag.statement()
print(statement["invoice_id"], statement["total_due_usd"], statement["hard_caps"])

Usage above included limits is metered in an immutable ledger. Overage is $1 per 1,000 extra handoffs and $0.10 per extra agent per day. Every tier, including Free, allows overage up to a 3x hard cap. Payments happen outside the platform; AgentGrid only records external references after an operator confirms them.

Configuration

Source Purpose
AGENTGRID_API_KEY API key used for authenticated calls
AGENTGRID_BASE_URL Override the production URL
~/.agentgrid/credentials.json Locally stored key written by agrid login

No key is ever printed by the SDK or CLI. Environment variables take priority over the stored file.

Errors

All API and configuration failures raise AgentGridError with status and detail attributes.

from agentgrid_protocol import AgentGrid, AgentGridError

try:
    AgentGrid().me()
except AgentGridError as exc:
    print(exc.status, exc.detail)

Requirements

Python 3.10+ and cryptography. The SDK uses only the standard library for HTTP, so it works anywhere Python runs.

Metadata

Release files for theoc-agentgrid-protocol 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 theoc-agentgrid-protocol 0.1.0
File Size Uploaded Provenance Actions
theoc_agentgrid_protocol-0.1.0.tar.gz 11.8 kB Without provenance Details for theoc_agentgrid_protocol-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for theoc-agentgrid-protocol 0.1.0
File Interpreter ABI Platform Actions
theoc_agentgrid_protocol-0.1.0-py3-none-any.whl Python 3 none any Details for theoc_agentgrid_protocol-0.1.0-py3-none-any.whl

Total release size: 21.8 kB

Release files / theoc_agentgrid_protocol-0.1.0.tar.gz

Download URL theoc_agentgrid_protocol-0.1.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8aca20b71418be27b855ffa5c4a367b2a62406068777b2814ee07dbfb01b6b2
BLAKE2b-256 checksum
How to use checksums
b799842d71b9636fdf658601d8df1a9774e609a67bf41e93f23c44adc9d4a89e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

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

Download URL theoc_agentgrid_protocol-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3169b1cf6bae2b944661426ca85980289eb90e82b3298a50e27c8e1ebeb8941
BLAKE2b-256 checksum
How to use checksums
97662161fcc6388d30ea2bd77afbc4f0c1db51cbbb79329d316958d709c6c504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for theoc-agentgrid-protocol 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.

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