> For the complete documentation index, see [llms.txt](https://docs.cheqd.io/product/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheqd.io/product/sdk/agent-toolkit.md). Agents can also search and read this documentation through its [MCP server](https://docs.cheqd.io/product/~gitbook/mcp).

# Agent Toolkit (A2A / AP2)

DID-anchored identity, delegation and per-request proof for agentic protocols — A2A and AP2 — built on did:cheqd.

> **Beta — not yet externally reviewed.** The packages below are published and usable, but have not had an independent security review, and the API may still change. See each package's README for current status before depending on it in production.

[`cheqd/agent-toolkit`](https://github.com/cheqd/agent-toolkit) binds `did:cheqd` identity directly into two agentic protocols, so that a message or a payment mandate between agents carries a verifiable, DID-anchored proof of who sent it — not just who an agent claims to be in its profile.

This is a different layer to the [Trust Registries for AI Agents](https://docs.cheqd.io/product/getting-started/ai-agents.md) above: a trust registry proves an agent is *accredited*; Agent Toolkit proves that *this specific message, right now* came from the key that accreditation points to.

## Key Features

* **A2A trust binding** — a client interceptor and server executor gate for the [A2A protocol](https://github.com/a2aproject/A2A), adding a per-request, holder-of-key proof (KYA-OS's `org.kya-os/proof.v1`) over the request, plus an RFC 9421 HTTP Message Signature sibling.
* **AP2 binding** — DID-anchored `cnf` key continuity and mandate-chain verification for the [AP2 protocol](https://github.com/google-agentic-commerce/AP2)'s payment mandates, as a compact SD-JWT-VC + Key Binding JWT presentation.
* **DID-anchored throughout** — agent identity, delegation and revocation all resolve through `did:cheqd`, including reciprocal `did:web` ↔ `did:cheqd` linkage and DID-Linked Resource-based credential status.
* **Cross-language conformance** — the TypeScript and Python implementations are verified interoperable with each other on every push, not just internally consistent.
* **Available in TypeScript and Python**, package-for-package.

## Ideal for Developers Who

* Are building agents on the A2A or AP2 protocols and need the other side to be able to verify *which DID* sent a given message or mandate, not just trust a self-asserted identity.
* Want DID-anchored proof-of-possession on individual protocol messages, as a complement to (not a replacement for) a [Trust Registry](https://docs.cheqd.io/product/getting-started/ai-agents.md) that governs what an accredited agent is allowed to do.
* Need the same guarantees from both a TypeScript and a Python agent in the same system.

## Get started

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>TypeScript (npm)</strong></mark></td><td>Install the core identity package plus the A2A and/or AP2 binding you need, tagged <code>beta</code>.</td><td><a href="https://www.npmjs.com/package/@cheqd/agent-toolkit">https://www.npmjs.com/package/@cheqd/agent-toolkit</a></td></tr><tr><td><mark style="color:blue;"><strong>Python</strong></mark></td><td>Not on PyPI yet — install straight from the repository in the meantime.</td><td><a href="https://github.com/cheqd/agent-toolkit/tree/main/python/packages">https://github.com/cheqd/agent-toolkit/tree/main/python/packages</a></td></tr><tr><td><mark style="color:blue;"><strong>Design decisions</strong></mark></td><td>The full design-decision log and research behind this programme's choices.</td><td><a href="https://github.com/cheqd/agent-toolkit/blob/main/docs/design-decisions.md">https://github.com/cheqd/agent-toolkit/blob/main/docs/design-decisions.md</a></td></tr></tbody></table>

### Install (TypeScript)

```bash
npm install @cheqd/agent-toolkit@beta
npm install @cheqd/agent-toolkit-a2a@beta   # for A2A
npm install @cheqd/agent-toolkit-ap2@beta   # for AP2
```

### Install (Python)

The Python port is feature-complete and cross-language conformant with the TypeScript packages (every tutorial below applies equally to both), but isn't on PyPI yet. Install it straight from the repository instead:

```bash
pip install "cheqd-agent-toolkit @ git+https://github.com/cheqd/agent-toolkit.git#subdirectory=python/packages/core"
pip install "cheqd-agent-toolkit-a2a @ git+https://github.com/cheqd/agent-toolkit.git#subdirectory=python/packages/a2a"   # for A2A
pip install "cheqd-agent-toolkit-ap2 @ git+https://github.com/cheqd/agent-toolkit.git#subdirectory=python/packages/ap2"   # for AP2
```

Once the packages are on PyPI, this becomes a plain `pip install cheqd-agent-toolkit` — watch [the repository's releases](https://github.com/cheqd/agent-toolkit/releases) for that.

## Tutorials

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Setup</strong></mark></td><td>Configure DID resolution and Agent Card verification — the shared setup both bindings build on.</td><td><a href="https://docs.cheqd.io/product/sdk/agent-toolkit/setup.md">Setup</a></td></tr><tr><td><mark style="color:blue;"><strong>A2A: Sign outgoing requests</strong></mark></td><td>Add a DID-anchored, per-request proof to every <code>SendMessage</code> call from an A2A client.</td><td><a href="https://docs.cheqd.io/product/sdk/agent-toolkit/sign-outgoing-requests.md">A2A: Sign outgoing requests</a></td></tr><tr><td><mark style="color:blue;"><strong>A2A: Verify incoming requests</strong></mark></td><td>Reject any A2A request without a verified, DID-anchored proof before your executor runs.</td><td><a href="https://docs.cheqd.io/product/sdk/agent-toolkit/verify-incoming-requests.md">A2A: Verify incoming requests</a></td></tr><tr><td><mark style="color:blue;"><strong>AP2: Issue a mandate presentation</strong></mark></td><td>Issue an Open Payment Mandate as a compact SD-JWT-VC, bound to a holder's key.</td><td><a href="https://docs.cheqd.io/product/sdk/agent-toolkit/issue-mandate-presentation.md">AP2: Issue a mandate presentation</a></td></tr><tr><td><mark style="color:blue;"><strong>AP2: Verify a mandate presentation</strong></mark></td><td>Verify a presented mandate, its key binding, and that it covers the transaction actually being made.</td><td><a href="https://docs.cheqd.io/product/sdk/agent-toolkit/verify-mandate-presentation.md">AP2: Verify a mandate presentation</a></td></tr></tbody></table>

> **Draft tutorials.** These walk through the packages' real, current APIs (the same code paths the conformance suite runs), but the API is not frozen — expect it to change before a stable release.

## Architecture

The core package (`@cheqd/agent-toolkit` / `cheqd-agent-toolkit`) handles DID resolution, reciprocal `did:web` ↔ `did:cheqd` linkage, DID-Linked Resource policy, credential status and key resolution. The A2A and AP2 bindings both depend on the core package and not on each other, so an AP2 integration never needs to install the A2A SDK, and vice versa.

## What this builds on

No new cryptography is proposed here. The A2A binding's proof profile, its canonicalisation and its conformance vectors already exist upstream and are reused unchanged:

* [**KYA-OS**](https://github.com/decentralized-identity/kya-os-mcp) (`@kya-os/mcp`) — the [DIF Trusted AI Agents Working Group](https://identity.foundation/working-groups/trusted-agents.html)'s reference implementation of the `org.kya-os/proof.v1` holder-of-key profile: RFC 8785 (JCS) canonicalisation, SHA-256 request binding, a detached JWS alongside an RFC 9421 HTTP Message Signature, and RFC 7638 `cnf` thumbprint fusion. `@cheqd/agent-toolkit-a2a` is a DID-anchored binding on top of KYA-OS, not a replacement for it — the signer, clock, nonce-cache and fetch providers used in the [setup](https://docs.cheqd.io/product/sdk/agent-toolkit/setup.md) and [A2A](https://docs.cheqd.io/product/sdk/agent-toolkit/sign-outgoing-requests.md) tutorials all come from `@kya-os/mcp` directly.
* [**`@a2a-js/sdk`**](https://github.com/a2aproject/a2a-js) — the A2A protocol's own client/server SDK: `CallInterceptor` on the client, the `AgentExecutor` decorator on the server, `A2A-Extensions` header negotiation, and the pluggable key-resolution seam on `verifyAgentCardSignature`.

## Known gaps

As a beta, the following are tracked as open rather than hidden:

* KMS/HSM-backed signing has a seam (an external `signer` callback can be supplied instead of a raw private key) but is not yet proven against a real KMS or HSM.
* AP2 multi-hop re-delegation is out of scope — single-delegation-hop mandates only.
* No gRPC transport or streaming support yet.
* No external architectural review yet — required before a stable/GA release, not before this beta.

See the [design-decision log](https://github.com/cheqd/agent-toolkit/blob/main/docs/design-decisions.md) and [threat model](https://github.com/cheqd/agent-toolkit/blob/main/docs/security/threat-model.md) for the full, current list.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cheqd.io/product/sdk/agent-toolkit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
