Developer guide

← Home

Write-up: I built a signed handoff layer for AI agents (and you can verify it offline) — design notes and the full walkthrough.

Start here: 3 steps (~1 minute), or no code

No code: use the browser quickstart. It verifies your email, creates two demo agents, signs a scoped handoff, and shows the receipt. Demo keys are generated on the server and discarded; use the CLI/SDK when private keys must stay on your machine.

The command path below does the same thing locally with your own keys:

  1. Install and register. Run pip install theoc-agentgrid-protocol, then agrid register --email you@example.com. It is free and open — no invite token or card — but a real email is required. Check your inbox for a 6-digit code.
  2. Verify and see a receipt. agrid verify 123456 creates your agk_... key, stores it locally without printing it, and immediately runs a real handoff: two agents, an online and offline card check, a signed delegation, and its immutable receipt. Back up the key. Pass --no-quickstart to skip the demo.
  3. Check the work. agrid card <agent_id> verifies a public card offline; agrid receipts <agent_id> reads the immutable receipts. Use agrid quickstart any time for another demo.
pip install theoc-agentgrid-protocol
agrid register --email you@example.com
agrid verify 123456          # code emailed to you; first handoff runs automatically
agrid card <agent_id>      # an ag_... ID from step 2
agrid receipts <agent_id>  # the worker ID from step 2

Already have a key? Use agrid login or set AGENTGRID_API_KEY. Need a framework drop-in? Copy examples/langgraph_handoff.py from the repository into your LangGraph, CrewAI, or OpenAI Agents SDK project. Stuck? Jump to the FAQ.

Pre-email legacy account? Your own CLI will surface the update command when you run agrid doctor, agrid quickstart, agrid statement, agrid receipts, or agrid login. The API also returns legacy_upgrade_available and next_step from GET /v1/clients/me. To upgrade, run agrid update --email you@example.com, then agrid verify <code>.

Registration details

pip install theoc-agentgrid-protocol
agrid register --email you@example.com
agrid verify 123456          # code emailed to you; first handoff runs automatically
agrid doctor

agrid register is open self-service — no invite token or operator approval — but --email is required. We send a single-use 6-digit code that expires in 15 minutes; agrid verify confirms it and only then creates your agk_... key under ~/.agentgrid/credentials.json without printing it. Until then the account has no usable key. If the code expires, run agrid resend (one code per 60 seconds). The same email is used to recover a mistyped Client ID on a payment form. Use agrid login if you already have a key, or set AGENTGRID_API_KEY in the environment.

Your first verified handoff

from agentgrid_protocol import AgentGrid

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

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

The private key for each agent is generated locally and never sent to the service. Only the public key is registered. The handoff signature covers canonical JSON, and AgentGrid checks it against the from-agent's registered key before storing a receipt.

How scoped delegation works

Every handoff is a canonical JSON payload signed by the from-agent's local Ed25519 key. It includes v, handoff_id, both agent IDs, task_hash, scope, created_at, and parent_handoff_id. AgentGrid verifies that signature against the registered public key before it stores anything.

For nested delegation, parent_handoff_id must point to a handoff whose to_agent_id is the agent now delegating. An agent cannot invent a parent chain to claim permissions it never received.

The enforcement model is deliberately small. Only two scope keys are checked:

Scope keyRule for a child handoff
allowedMust be a subset of the parent's allowed list.
max_actionsMust be less than or equal to the parent's value.

Other keys you put in scope are signed and stored verbatim but are not constrained. A child may omit either key; the service accepts that and stores only what you sent. Attempts to widen a chain are rejected with HTTP 400 Delegation scope may not be widened. See the scoped handoff recipe for a working parent/child example.

What a receipt records

Receipts are public by agent ID and immutable at the database level. GET /v1/agents/{id}/receipts returns the newest handoffs where the agent was either the sender or the receiver (up to 100 per call).

FieldMeaning
handoff_idUnique ID of the signed delegation.
from_agent_id / to_agent_idSender and receiver.
parent_handoff_idThe handoff this one narrows, if any.
task_hashSHA-256 of the task text; the raw text is never stored.
scopeThe signed permission scope.
signature / signer_public_keyEd25519 signature and the from-agent's raw public key, in unpadded base64url.
created_atUTC timestamp covered by the signature.

A receipt proves three things: the from-agent's key signed that exact payload, the signer public key identifies which registered agent signed it, and task_hash lets you confirm the task you think was delegated without the service storing the text. It does not prove that the task completed, that the text was confidential, or that a human was involved. Treat the hash as an integrity check, not a secret. In the snippet below, task_text is the string you originally passed to handoff_to() on your own machine.

import hashlib
from agentgrid_protocol import AgentGrid, canonical
from agentgrid_protocol.crypto import b64d
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey

ag = AgentGrid()                       # no auth needed for public reads
r = ag.receipts("ag_...")["receipts"][0]

# 1. Compare a task you still hold locally with the stored hash.
print(hashlib.sha256(task_text.encode("utf-8")).hexdigest() == r["task_hash"])

# 2. Verify the handoff signature offline.
payload = {
    "v": 1,
    "handoff_id": r["handoff_id"],
    "from_agent_id": r["from_agent_id"],
    "to_agent_id": r["to_agent_id"],
    "task_hash": r["task_hash"],
    "scope": r["scope"],
    "created_at": r["created_at"],
    "parent_handoff_id": r["parent_handoff_id"] or "",
}
Ed25519PublicKey.from_public_bytes(b64d(r["signer_public_key"])).verify(
    b64d(r["signature"]), canonical(payload)
)
print("handoff signature: VALID")

Rebuild the payload with "v": 1 even though the stored receipt does not expose that field; it was part of the signed envelope. CLI equivalent: agrid receipts <agent_id>.

Copy-paste recipes

Verify a card offline

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

ag = AgentGrid()                  # no auth needed for public reads
card = ag.card("ag_...")          # any public agent ID
keys = ag.public_keys()           # includes previous_public_key during rotation
message = canonical(unsigned_card(card))
signature = b64d(card["signature"])

for key_b64 in (keys.get("public_key", ""), keys.get("previous_public_key", "")):
    if not key_b64:
        continue
    try:
        Ed25519PublicKey.from_public_bytes(b64d(key_b64)).verify(signature, message)
        print("offline signature: VALID")
        break
    except Exception:
        continue
else:
    print("offline signature: INVALID")

A card signature proves AgentGrid issued that card. Handoffs are signed separately by the from-agent's own local Ed25519 key. During rotation the previous platform key stays published so older cards remain verifiable. CLI equivalent: agrid card <agent_id>.

Record a scoped handoff

from agentgrid_protocol import AgentGrid

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

receipt = planner.handoff_to(
    worker,
    task="summarize the quarterly report",
    scope={"allowed": ["read"], "max_actions": 2},
)
print(receipt["handoff_id"], receipt["scope"])

# A child handoff may only narrow the parent's scope:
sub = ag.create_agent("Sub-worker", capabilities=["read"])
child = worker.handoff_to(
    sub,
    task="fetch one page",
    scope={"allowed": ["read"], "max_actions": 1},
    parent_handoff_id=receipt["handoff_id"],
)
print(child["handoff_id"])

allowed must be a subset of the parent's allowed, and max_actions cannot increase — attempts to widen a chain are rejected. Only a SHA-256 task hash is stored, never the raw task text.

Read a receipt

from agentgrid_protocol import AgentGrid

ag = AgentGrid()
data = ag.receipts("ag_...")       # public: no API key needed
for r in data["receipts"]:
    print(r["handoff_id"], r["from_agent_id"], "->", r["to_agent_id"])
    print("  task hash:", r["task_hash"])
    print("  scope:", r["scope"], "created:", r["created_at"])
print("total:", data["count"])

Receipts are immutable at the database level and readable by anyone who knows the agent ID. They contain the task hash, not the raw task. CLI equivalent: agrid receipts <agent_id>.

Useful endpoints

MethodPathPurpose
POST/v1/clients/registerRegister a free client (open self-service) with a required email
GET/v1/clients/meAccount status, including the legacy-account upgrade signal
PATCH/v1/clients/me/emailSet or update the recovery email
POST/v1/clients/me/upgrade-emailStart self-service email verification for a pre-email account
POST/v1/agentsCreate an agent with its public key
GET/v1/agents/{id}.jsonGet the signed Agent Card
GET/v1/agents/{id}/verifyOnline signature check
GET/v1/agents/public-keyPlatform key for offline checks
POST/v1/agents/{id}/handoffsRecord a signed handoff
GET/v1/agents/{id}/receiptsRead immutable receipts
GET/v1/billing/statementInvoice, overage, and hard caps

Full request and response schemas are in the API reference.

Limits and billing

Every tier permits overage up to 3× its included agents and handoffs; beyond that, new agents and handoffs return HTTP 402 until the next cycle or an upgrade. Overage is $1 per 1,000 extra handoffs plus $0.10 per extra agent per day, written to an immutable ledger. GET /v1/billing/statement returns an invoice_id and the amount due in USD. To upgrade, register first with the email you will use to pay, get your Client ID, then open the payment link for your tier and enter that exact AgentGrid Client ID in the form's required field. Use the same email on the payment form so we can fix a mistyped Client ID automatically. Your tier upgrades automatically once payment is confirmed. The invoice ID is only for operator reconciliation; no payment details ever enter AgentGrid.

Enterprise uses the shared self-service form; enter an amount between ₹212,500 and ₹425,000 ($2,500–$5,000 at the fixed ₹85 = $1 rate) and the same AgentGrid Client ID.

FAQ

These are the questions new users hit most often. If yours is not here, tell us — this list grows from real feedback.

Do I need an invite token or approval?

No. agrid register is open self-service. You do need a real email: a 6-digit code is sent there and the API key is created only after you confirm it.

I signed up before email verification. How do I update?

If your client has a key but no email on file, run agrid update --email you@example.com with that key still saved locally. We email a 6-digit code and your current key stops working until you confirm it. Then run agrid verify <code>: it stores a replacement key and runs your first signed handoff automatically. If you lost the old key, register a new free client instead.

Does email verification prove I am human?

It proves you control the inbox at signup, which blocks random bot signups and makes every account reachable. It is not a biometric or CAPTCHA-style proof. Unverified signups have no key and cannot call the API.

Where is my API key? The CLI did not print it.

By design. The service shows the agk_... key once and the CLI writes it to ~/.agentgrid/credentials.json. Back up that file or the key; there is no secret recovery endpoint. If you lose it, register a new free client.

What does agrid quickstart actually do?

It creates two agents with locally generated Ed25519 keys, verifies the planner's card online and offline, signs a real handoff with a scope, and reads the resulting receipt. Nothing is simulated. Private keys never leave your machine.

Why verify a card "offline"?

Because the platform's public key is published at /v1/agents/public-key. You can check a card's signature without asking AgentGrid, which matters when the service is unreachable or when a third party receives a card. See the recipe.

Can a child agent widen the scope it inherited?

No. A child's allowed list must be a subset of its parent's and its max_actions cannot be higher. See the recipe.

Are receipts public? Is my task text exposed?

Receipts are public by agent ID — anyone with the ID can read them. They store a SHA-256 task hash, not the raw task. Treat the hash as an integrity check, not a secret, and do not put sensitive text in the task field.

Do I need a payment method to start?

No. The free tier needs no card. Payments are entirely external; AgentGrid has no wallet, escrow, checkout, or automatic deduction. See pricing.

What happens when I hit the free limits?

Overage is metered (not blocked) up to 3× the included agents and handoffs, at $1 per 1,000 extra handoffs plus $0.10 per extra agent per day. Past 3×, new writes return HTTP 402 until the next cycle or an upgrade. agrid statement shows the current totals.

How do I upgrade, and how do I change my email?

Register with the email you will pay with, get your Client ID, open the external payment link for your tier, and enter that exact Client ID in the form. The same email lets the operator fix a mistyped ID. To change it later, call PATCH /v1/clients/me/email with your API key.

Can I use a language other than Python?

Yes. AgentGrid is an HTTP API; the Python SDK is optional. Start from OpenAPI or the API reference.

API reference · OpenAPI · Health