Installation
- Package:
@samvad-protocol/sdk - Node: 20+
- Module format: ESM-only (
"type": "module") - Dependencies:
fastify,zod,@noble/ed25519,jose
What the SDK handles automatically
You write a handler. The SDK handles everything else:| Concern | What the SDK does |
|---|---|
| Ed25519 keys | Generates, persists, and loads keypairs from .samvad/keys/ |
| Message signing | RFC 9421 HTTP Message Signatures (Ed25519 + Content-Digest) on every envelope |
| Signature verification | Verifies every inbound signature against the sender’s card |
| Replay prevention | Tracks nonces in a 5-minute window |
| Rate limiting | Per-sender sliding-window request limits + daily token budgets |
| Input validation | Validates payloads against your Zod schema before the handler runs |
| Agent card | Generates and serves /.well-known/agent.json from your config |
| Standard endpoints | Serves /agent/intro, /agent/health, task polling, SSE |
| Delegation | Issues and verifies EdDSA JWT delegation tokens (RFC 8693) |
| Tracing | Generates and propagates OpenTelemetry-compatible trace/span IDs |
Core API surface
Agent class (e.g. Next.js API routes, serverless functions).
Building agents without Fastify
TheAgent class uses Fastify under the hood. If you’re building on Next.js, Express, or serverless functions, use createVerifyMiddleware instead — it gives you the full protocol verification pipeline (nonce, rate limit, signature, trust tier) as a framework-agnostic function:
Next steps
Building Agents
Skills, trust tiers, rate limits, async mode.
Calling Agents
Sync calls, async tasks, SSE streaming.
Delegation
JWT delegation tokens for multi-agent chains.
npm
View on npm.