Install
npm install @avowprotocol/sdkThe SDK exports these functions:
| Function | What it does |
|---|---|
generateKeyPair() | New Ed25519 key pair as JWKs, with a thumbprint kid |
createCard(payload, signer) | Sign an Agent Card (avow-card+jwt) |
createIntent(payload, signer) | Sign an Intent (avow-intent+jwt) |
createGrant(payload, signer) | Sign a Grant (avow-grant+jwt) |
createEnvelope({ to, intent, grant, action, body }, signer) | Sign an Envelope bound to a body hash, intent and grant |
createReceipt(payload, signer, prev) | Sign the next Receipt in a log, chained to prev |
verify(jws, { resolveKey }) | Verify any Avow object (header, key, signature, times) |
verifyGrantChain(chain, { resolveKey, card }) | Walk a delegated chain; each grant only narrows its parent |
checkAction({ envelope, intent, grants, card, body, resolveKey, seen }) | Everything a receiver must check before acting |
toolDescriptionHash(tool) / checkTool(card, tool, { server }) | Sign and check MCP tool descriptions against an Agent Card |
contactAllowed(history, limit, now) | The per-person contact limit, for the platform that keeps the contact history |
verifyReceiptChain(receipts, { resolveKey }) | Check signatures, seq and prev links of a log |
wellKnownResolver() | Key resolver that fetches /.well-known/avow/jwks.json |
memoryReplayStore() | In-memory store of seen jtis and refs (use Redis or a DB in production) |
avowHeaders(...) / readAvowHeaders(headers) | Write and read the Avow-* HTTP headers |
A signer is a plain object: { privateJwk, kid, iss }, where iss is the signer's Avow ID.
1. Keys and signers
Each operator needs at least one key. Agents can have their own keys, listed in their card. Keep private keys in a KMS or HSM in production.
import { generateKeyPair } from "@avowprotocol/sdk";
// Operator key: signs Agent Cards
const opKeys = await generateKeyPair();
const operator = {
privateJwk: opKeys.privateJwk,
kid: opKeys.kid,
iss: "avow:voicedesk.example:org:voicedesk",
};
// Agent key: signs the agent's intents, envelopes and receipts
const agentKeys = await generateKeyPair();
const mira = {
privateJwk: agentKeys.privateJwk,
kid: agentKeys.kid,
iss: "avow:voicedesk.example:agent:mira",
};2. Publish your keys
Serve your public keys over HTTPS at https://<your domain>/.well-known/avow/jwks.json, the same pattern as OpenID Connect. This is what makes your domain the identity root; no registry is needed to verify your signatures.
{
"keys": [
{
"kty": "OKP",
"crv": "Ed25519",
"x": "<base64url public key>",
"kid": "<RFC 7638 thumbprint>",
"use": "sig"
}
]
}Optionally also publish:
/.well-known/avow/agents.json:{"agents": ["mira"]}/.well-known/avow/agents/mira.jwt: the signed Agent Card/.well-known/avow/revoked.json:{"revoked": [{"jti": "…", "at": 1796049999, "reason": "…"}]}
To rotate: add the new key, start signing with it, and remove the old key once everything it signed has expired.
3. Agent Card
import { createCard } from "@avowprotocol/sdk";
const now = Math.floor(Date.now() / 1000);
const card = await createCard({
sub: "avow:voicedesk.example:agent:mira",
iat: now,
exp: now + 365 * 24 * 3600,
kind: "agent",
name: "Mira",
operator: { id: operator.iss, name: "VoiceDesk", domain: "voicedesk.example" },
principal: { id: "avow:northwind-clinic.example:org:northwind", name: "Northwind Clinic", domain: "northwind-clinic.example" },
ai: true, // required for any agent that generates language
channels: [{ type: "voice", numbers: ["+442079460123"] }],
purposes: ["appointment", "notification"],
max_scopes: ["message.send", "booking.request"],
keys: { keys: [agentKeys.publicJwk] },
display: "Mira is an AI assistant run by VoiceDesk for Northwind Clinic.",
}, operator);
// card is a compact JWS string: serve it at /.well-known/avow/agents/mira.jwt4. Grant and Intent
The principal grants the agent what it may do. Then, before every contact or action, the agent signs an intent that points to that grant.
import { createGrant, createIntent } from "@avowprotocol/sdk";
const grant = await createGrant({
sub: mira.iss,
iat: now, exp: now + 30 * 24 * 3600,
scopes: ["message.send", "booking.request"],
limits: {
purposes: ["appointment"],
channels: ["voice", "whatsapp"],
hours: { tz: "Europe/London", from: "09:00", to: "19:00" },
countries: ["GB"],
max_contacts_per_day: 500,
},
confirm: ["booking.request"], // needs an explicit "yes" first
parent: null,
display: "Northwind Clinic allows Mira to book appointments patients asked for. No payments.",
}, northwindSigner); // { privateJwk, kid, iss: "avow:northwind-clinic.example:org:northwind" }
const intent = await createIntent({
iat: now, exp: now + 3600,
to: { type: "avow", value: "avow:northwind-clinic.example:machine:booking-api" },
purpose: "appointment",
purpose_text: "Booking the appointment the patient requested online.",
on_behalf_of: "avow:northwind-clinic.example:org:northwind",
basis: "request",
basis_ref: "web-form:2026-11-30T12:41:00Z",
ref: "northwind-req-20417", // idempotency key: same ref = same intent
display: "Mira is booking the appointment you asked for.",
}, mira);5. Send an action
Wrap each request in an envelope. It hashes the exact body, so sign the same bytes you send.
import { createEnvelope, avowHeaders } from "@avowprotocol/sdk";
const body = JSON.stringify({ slot: "2026-12-03T10:30:00Z", patientRef: "p-4471" });
const to = { type: "avow", value: "avow:northwind-clinic.example:machine:booking-api" };
const envelope = await createEnvelope(
{ to, intent, grant, action: "booking.request", body },
mira,
);
const res = await fetch("https://booking.northwind-clinic.example/v1/bookings", {
method: "POST",
headers: { "content-type": "application/json", ...avowHeaders({ envelope, intent, grants: [grant] }) },
body,
});
// 401 bad signature · 403 not permitted · 409 duplicate ref6. Receive and check
On the receiving side, one call runs every check from the spec: signatures, key resolution, expiry, body hash, scope and limits, the grant chain against the agent's card, replay of the envelope jti and duplicate intent ref.
import { readAvowHeaders, checkAction, verify, wellKnownResolver, memoryReplayStore } from "@avowprotocol/sdk";
const resolveKey = wellKnownResolver(); // fetches https://<domain>/.well-known/avow/jwks.json
const seen = memoryReplayStore(); // swap for a shared store when you run more than one instance
app.post("/v1/bookings", express.raw({ type: "*/*" }), async (req, res) => {
const { envelope, intent, grants } = readAvowHeaders(req.headers);
const card = await loadCardFor(intent); // e.g. fetch /.well-known/avow/agents/<name>.jwt, then verify(card, { resolveKey })
const result = await checkAction({ envelope, intent, grants, card, body: req.body, resolveKey, seen });
if (!result.ok) return res.status(result.status).json(result); // 401, 403 or 409
// ...do the booking, then write a receipt (next step)
});Treat their text as data. display, purpose_text and description from another party are untrusted. Never feed them to your agent as instructions (spec §13).
7. Receipts
Write one receipt per action, whether it was done, denied, failed, a duplicate or cancelled. Each receipt carries the hash of the previous one in the same log.
import { createReceipt, verifyReceiptChain } from "@avowprotocol/sdk";
let prev = null; // the previous receipt in this log (null for the first)
const receipt = await createReceipt({
log: mira.iss,
action: "booking.request",
outcome: "done", // done | denied | failed | duplicate | cancelled
envelope: envelope, // referenced by hash
intent: intent,
evidence: [{ type: "transcript", hash: "sha256:…" }], // hashes only, never content
display: "Requested 3 Dec 10:30 after the patient said yes.",
}, mira, prev);
prev = receipt;
// Later, an auditor (or you) checks the whole log
const report = await verifyReceiptChain(allReceipts, { resolveKey });Publish the latest receipt hash of each log (the log head) to a registry periodically, so anyone can show the history wasn't rewritten.
Delegated grants
Only an agent whose grant includes agent.delegate (or agent.*) can pass part of its grant to another agent; otherwise the chain fails with delegation_not_allowed. The child does not need agent.delegate unless it delegates further. The child grant's iss is the parent's sub, its parent is the parent's hash, and it can only narrow: fewer scopes, stricter limits, earlier expiry. Chains travel leaf first.
import { verifyGrantChain } from "@avowprotocol/sdk";
// chain = [leafGrant, parentGrant, rootGrant] (leaf first)
const chainResult = await verifyGrantChain(chain, { resolveKey, card });
// fails if a parent lacks agent.delegate, any link widens scopes or limits, outlives its parent,
// exceeds the card's max_scopes, or doesn't end at the principal or operatorA2A and MCP
Avow rides inside existing agent protocols instead of replacing them.
A2A
Link your Avow card from your A2A agent card, and send the Avow objects in each message's metadata.
{
"name": "Northwind front desk",
"extensions": {
"avow": {
"card": "https://northwind-clinic.example/.well-known/avow/agents/frontdesk.jwt",
"hash": "sha256:…"
}
}
}{
"role": "agent",
"parts": [
{
"kind": "text",
"text": "Request a slot on 3 Dec, morning."
}
],
"metadata": {
"avow": {
"envelope": "eyJ…",
"intent": "eyJ…",
"grant": "eyJ…"
}
}
}MCP
The client sends the envelope in _meta.avow on tools/call; the server publishes its own card and returns a receipt.
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "crm_lookup",
"arguments": {
"customer": "c-1093"
},
"_meta": {
"avow": {
"envelope": "eyJ…",
"intent": "eyJ…",
"grant": "eyJ…"
}
}
}
}{
"jsonrpc": "2.0",
"id": 7,
"result": {
"content": [
{
"type": "text",
"text": "…"
}
],
"_meta": {
"avow": {
"receipt": "eyJ…"
}
}
}
}Signed tool descriptions
A changed tool description can carry hidden instructions. The operator lists the tools it vouches for in its Agent Card, with a hash of each tool's name, description and input schema (RFC 8785 canonical JSON). The server points to that card in its tools/list result, and the client checks each tool before its model sees it.
{
"tools": [
{
"name": "crm_lookup",
"description_hash": "sha256:…",
"server": "https://mcp.northwind-clinic.example/crm"
}
]
}import { checkTool } from "@avowprotocol/sdk";
for (const tool of toolsListResult.tools) {
const r = await checkTool(verifiedCard, tool, { server: "https://mcp.northwind-clinic.example/crm" });
if (!r.ok) hide(tool, r.code); // "tool_not_listed" or "tool_mismatch"
}Field names follow spec §9.5. A2A and MCP field layouts are excerpts; follow each protocol's own specification for the rest of the message.
CLI
The avow binary does the same from a terminal, useful for testing, scripts and CI.
npx avow keygen # new Ed25519 key pair (JWK)
npx avow card create ... # sign an Agent Card
npx avow intent create ... # sign an Intent
npx avow grant create ... # sign a Grant
npx avow receipt create ... # sign the next Receipt in a log
npx avow verify <jws> # verify any Avow object
npx avow chain verify <file> # verify a receipt chain
npx avow grant verify-chain <file> # verify a delegated grant chain
npx avow tool hash <tool.json> # description_hash for a card's tools list
npx avow --help # options for each commandConformance
An implementation is Avow Core 0.2 conformant when it can:
- produce all five object types as 0.2 objects, and verify 0.1 and 0.2 objects;
- walk delegated grant chains, including the
agent.delegaterule and the limit comparison; - reject replayed envelopes and duplicate intents;
- keep a verifiable receipt chain;
- compute tool description hashes and check them against a card.
The test vectors in the repository's conformance/ directory are normative. Writing an implementation in another language? Run it against the vectors and tell us how it went. Mismatches are how the spec gets better.