@agora-protocol/sdk
v0.3.3
Published
ACP SDK: public API re-exporting all @agora-protocol/* modules + ACPRoom and ACPClient facades + createInProcessPair helper + acp-showcase / acp-ws-pair runnable bin demos
Downloads
309
Maintainers
Readme
@agora-protocol/sdk
One-stop SDK for the ACP Protocol v0.3 — the universal conversation layer for AI agent communication. Re-exports every @agora-protocol/* module plus the ACPRoom and ACPClient facades.
Install
npm install @agora-protocol/sdkQuick start (two-agent room in-process)
import { randomUUID } from "node:crypto";
import {
ACPRoom,
CORE_INTENTS,
generateEd25519KeyPair,
InMemorySyncTransport,
type RoomInstance,
} from "@agora-protocol/sdk";
const alice = generateEd25519KeyPair();
const bob = generateEd25519KeyPair();
const room: RoomInstance = {
room_id: randomUUID(),
config: {
type: "1:1",
mode: "sync",
privacy_level: "open",
language: "en",
max_turns: 10,
extensions: [],
},
rules: {
structured_layer_required: true,
allowed_intents: [...CORE_INTENTS],
max_turns: 10,
turn_timeout_seconds: 300,
max_natural_length_chars: 2000,
language_preference: "en",
privacy_level: "open",
mode: "sync",
compaction_interval_turns: 15,
active_extensions: [],
},
state: "active",
participants: ["alice:org", "bob:org"],
created_at: new Date().toISOString(),
};
const aliceRoom = new ACPRoom({
room,
agentId: "alice:org",
privateKey: alice.privateKey,
peerPublicKey: bob.publicKey,
});
const bobRoom = new ACPRoom({
room,
agentId: "bob:org",
privateKey: bob.privateKey,
peerPublicKey: alice.publicKey,
});
const [tA, tB] = InMemorySyncTransport.createPair();
aliceRoom.attachTransport(tA);
bobRoom.attachTransport(tB);
const sent = aliceRoom.send("Hi Bob — quote for 5000 units please.", {
intent: "proposal",
requires_response: true,
});
if ("error" in sent) throw new Error(sent.error);What's inside
ACPRoom— high-level facade overRoomControllerwith transport attachment and event wiring.ACPClient— agent-level wrapper that owns a keypair, manages multiple rooms, and exposes discovery.- Re-exports from
@agora-protocol/core,@agora-protocol/crypto,@agora-protocol/room-engine,@agora-protocol/session,@agora-protocol/transport,@agora-protocol/registry,@agora-protocol/gateway,@agora-protocol/reputation,@agora-protocol/observability,@agora-protocol/extensions,@agora-protocol/sandbox.
Runnable examples
The monorepo ships several real-LLM and transport demos under packages/sdk/examples/:
quickstart-verify.ts— minimal in-process two-agent room with hash-chain verification (no LLM, no network).conformance-demo.ts— runs the conformance suite, writes anACP Compliantcertificate.cli-bridge.ts— two Claude-backed agents negotiating via in-process rooms.tri-party-bridge.ts— three participants, agreements + partial-accept.python-auditor-bridge.ts— cross-language 3-party negotiation (TypeScript buyer + seller + Python+LangChain auditor signed via delegated key).full-negotiation.ts— full ACP flow (discovery → handshake → room → agreement → close).remote-bridge/—ws://andhttp://2-process bridges with MITM / netdown / replay / split-brain injectors.gateway-demo/— non-ACP external agent bridged via the Gateway.production-e2e/— 2-container Docker harness with TLS end-to-end and configurable soak (448 rounds, 0 failures in the archived run).
Certify your implementation
pnpm exec tsx packages/sdk/examples/conformance-demo.ts
# writes run-conformance-<timestamp>.{json,md} to examples/e2e-workspaces/License
MIT
