@adcp/sdk

Official TypeScript/JavaScript SDK for the Ad Context Protocol (AdCP). Use its buyer client to call agents, server framework to build them, and conformance tools to test them. The SDK supports MCP and A2A, with both immediate and asynchronous task results.
For AI Agents
Start with docs/llms.txt — the full protocol spec in one file (tools, types, error codes, examples). Building a server? See docs/guides/BUILD-AN-AGENT.md. Calling an AdCP agent as a buyer? Load skills/call-adcp-agent/SKILL.md — wire contract, async flow, and error-recovery priors that aren't in the type signatures. Setting up request signing? See docs/guides/SIGNING-GUIDE.md. For type signatures, use docs/TYPE-SUMMARY.md. Skip src/lib/types/*.generated.ts — they're machine-generated and will burn context.
These docs are also available in node_modules/@adcp/sdk/docs/ after install.
The Core Concept
AdCP operations are distributed and asynchronous by default. An agent might:
- Complete your request immediately (synchronous)
- Need time to process and send results via webhook (asynchronous)
- Ask for clarifications before proceeding
- Send periodic status updates as work progresses
Your code stays the same. You write handlers once, and they work for both sync completions and webhook deliveries.
Installation
npm install @adcp/sdk # 16.x, AdCP 3.2
npm install @adcp/sdk@beta # 17.x beta, AdCP 3.3.0-rc.3 (development/staging)
npm install @adcp/[email protected] # 13.x, maintained AdCP 3.1 line
npm install @adcp/[email protected] # 7.11.x, AdCP 3.0
SDK 17 beta adopts the signed AdCP 3.3.0-rc.3 bundle and includes the breaking
HTML-markup display_tag mapping. See the beta release notes
and 16 → 17 migration guide. Keep production on SDK 16.
AdCP 2 reached end of life on August 1, 2026. This checkout supports AdCP 3 agents only; review the AdCP 2 retirement guide before upgrading an integration that still calls AdCP 2 sellers.
Upgrading to SDK 16? Read the SDK 16 release notes and release-bound upgrade worksheet. The npm latest tag tracks SDK 16 (AdCP 3.2); SDK 13 stays available on adcp-3.1 as the maintained AdCP 3.1 line. SDK 16 requires Node.js ^20.19.0 || >=22.12.0. Earlier migration guides: SDK 15 OAuth, 13-to-14, 12-to-14, 12-to-13, MIGRATION-v8.md, and 8.0-to-8.1.
Narrow type imports (@adcp/sdk/types/<tool>)
Adopters who only need a single AdCP tool's types can import a per-tool slice instead of the full surface. Each slice is a self-contained .d.ts covering the tool's Request / Response / Success / Error / Submitted types and every type they reference:
import type { SyncAccountsRequest } from '@adcp/sdk/types/sync-accounts';
Why bother: the full @adcp/sdk type surface is ~45,000 lines and crashes tsc at Node's default 4 GB heap under strict + skipLibCheck:false. A single per-tool slice peaks at ~50 MB. That's the difference between adopters chasing the cryptic FATAL: mark-compact Node flag and just having their build pass.
Slices use kebab-case filenames matching the schema cache (sync_accounts → @adcp/sdk/types/sync-accounts). Requires moduleResolution: "node16" / "nodenext" / "bundler" on the adopter side. A machine-readable index of available slices ships at @adcp/sdk/types/per-tool-index.json.
TypeScript footprint in monorepos