我為 AI Agent 建立可離線驗證的簽名交接層
I built a signed handoff layer for AI agents (and you can verify it offline)
AgentGrid 是一個開源實驗項目,為 AI Agent 提供簽名身份、受限權限交接及不可變收據,並可離線驗證簽名。服務以 Ed25519 簽署 Agent 卡片,核對交接簽名及權限範圍;子級交接只能沿用或收窄上級權限。交接收據記錄任務雜湊值而非原始任務文字,AgentGrid 提供公開 API。
When one AI agent delegates work to another, three questions show up fast:
Which agent is this, really?
What was it allowed to do?
Where is the receipt after the handoff?
Most multi-agent examples I saw answered those questions with a dictionary and a log line. That is fine for a notebook, but it gets brittle when agents cross process boundaries, runs resume days later, or someone outside your system needs to verify what happened.
So I built AgentGrid: a small, standalone service for signed agent identity, scoped handoffs, and immutable receipts. It is not a chatbot and not a framework. It sits underneath LangGraph, CrewAI, the OpenAI Agents SDK, or plain Python — anything that can make an HTTP request.
This post is a technical walkthrough of the design and the shortest runnable demo. I am not claiming adoption numbers; this is an open-source experiment with a public API.
The three pieces
- Signed Agent Cards Each agent registers only its public Ed25519 key. AgentGrid signs a capability card with its own platform key. Anyone can fetch that card and verify the signature offline with the public key at /v1/agents/public-key.
Private keys never leave the agent's machine.
- Scoped handoffs A handoff is canonical JSON signed by the from-agent's private key. The service verifies that signature against the registered public key before it stores anything.
Scope is checked too. A child handoff can only narrow what it inherited: its allowed list must be a subset, and max_actions cannot increase.
- Immutable receipts Every accepted handoff produces a receipt: who handed off to whom, the task hash, the scope, and the timestamp. Receipts are public by agent ID and immutable at the database level. Only a SHA-256 task hash is stored, never the raw task text, so do not put secrets in the task field.
Try the demo without writing code
Open https://agentgrid-pied.vercel.app/quickstart, enter a real email address, and confirm the 6-digit code from your inbox. The page creates two demo agents, signs a scoped handoff, and shows you the immutable receipt. No install, CLI, API key, wallet, or card is needed.
Those demo keys are generated on the server and discarded immediately. For real deployments, use the CLI or SDK so private keys never leave your machine.
Prefer the command line? Two commands
The Python SDK is theoc-agentgrid-protocol; import it as agentgrid_protocol.
pip install theoc-agentgrid-protocol
agrid register --email you@example.com
agrid verify 123456
agrid register creates an unverified client and sends a 6-digit code to your inbox. No API key exists yet. agrid verify confirms the code, stores the key locally under ~/.agentgrid/credentials.json, and immediately runs a real signed handoff. You get a receipt without a fourth command.
Expected output looks like this:
AgentGrid quickstart -> https://agentgrid-pied.vercel.app
- Registered agents: ag_... -> ag_...
- Card verified online=True and offline=True
- Signed handoff accepted: h_...
- Receipts for worker: 1
Done. Open the card at https://agentgrid-pied.vercel.app/a/ag_...
If you want to skip the auto-demo, use agrid verify --no-quickstart, then run agrid quickstart later.
from agentgrid_protocol import AgentGrid
ag = AgentGrid() # reads AGENTGRID_API_KEY or ~/.agentgrid/credentials.json planner = ag.create_agent("Planner", capabilities=["plan"]) print(ag.verify_card(planner.agent_id)) receipt = planner.handoff_to( print(receipt["handoff_id"]) A nested handoff can only narrow the parent scope: sub = ag.create_agent("Sub-worker", capabilities=["read"]) child = worker.handoff_to( print(child["handoff_id"]) If worker.handoff_to(...) attempts to widen max_actions or add a capability that is not in the parent scope, the service rejects it. That is the invariant I wanted: delegation should lose permissions, never gain them. Verifying a card offline agrid card ag_... Under the hood it fetches the public card, fetches the platform keys, canonicalizes the unsigned fields, and checks the Ed25519 signature locally. During key rotation the previous public key stays published, so older cards remain verifiable. What this is not The free tier needs no payment method. The docs and API reference are public, and the repo includes a LangGraph-style handoff_node with notes for CrewAI and OpenAI Agents SDK equivalents. Links If you try the two-command demo, tell me which step felt confusing. Concrete onboarding friction is more useful to me than applause. — TheoC Computations, AgentGrid
worker = ag.create_agent("Worker", capabilities=["read"])
{'agent_id': 'ag_...', 'online': True, 'status': 'ACTIVE', 'offline': True}
worker,
task="summarize the quarterly report",
scope={"allowed": ["read"], "max_actions": 2},
)
print(len(worker.receipts()))
sub,
task="fetch one page",
scope={"allowed": ["read"], "max_actions": 1},
parent_handoff_id=receipt["handoff_id"],
)
The CLI does this for you:
Not a wallet, escrow, or in-app checkout. Payments, where used, happen outside AgentGrid.
Not an agent runtime. It does not plan, reason, or execute your tasks.
Not a secret store. Do not put raw task text, credentials, or personal data in a handoff; only a task hash is stored.
Not an adoption story. I built it, deployed it, and exercised the full loop. That is what I can honestly show today.
Why I built it this way
I wanted the smallest verifiable unit of delegation: a signed identity, a scoped permission boundary, and a receipt anyone can inspect later. The HTTP API is the contract; the Python SDK is just a convenience. That makes the design usable from any language, while the SDK keeps the common Python path short.
Live service: https://agentgrid-pied.vercel.app
Guide: https://agentgrid-pied.vercel.app/guide
API reference: https://agentgrid-pied.vercel.app/docs
OpenAPI: https://agentgrid-pied.vercel.app/openapi.json
GitHub: https://github.com/TheoCComputationsmain/Agentgrid
SDK: https://pypi.org/project/theoc-agentgrid-protocol/
來源:DEV Community · dev.to