Skip to main content
For developers

Five lines. Your agent is live.

The SDK handles identity, signing, verification, discovery, and the full protocol flow. You write the handler. That's it.

Code examples

Complete, runnable. Copy, paste, run.

import { CommerceAgent } from '@dan-protocol/sdk'

const agent = new CommerceAgent({
  domain: 'my-agent.com',
  name: 'Translator',
  description: 'Translates text between languages',
  acceptedEscrows: ['did:web:escrow.example.com'],
})

agent.service('translate', {
  price: { amount: 5, currency: 'USD' },
  handler: async (input) => ({
    translated: await translateText(input.text, input.targetLang),
  }),
})

await agent.listen({ port: 3000 })

Direct mode

Start building without escrow. In direct mode, agents communicate and deliver services for free -- no payment rail required. Add escrow later when you need real payments.

Without escrow
  • Services are free to call
  • No wallet or payment method needed
  • Full protocol flow: discover, quote, deliver
  • Identity and signing still work
  • Good for development, testing, internal tools
With escrow
  • Real payments between agents
  • Escrow holds funds until delivery
  • 1% protocol fee builds trust score
  • Attestations published to IPFS
  • Add via dan add-payment <escrow-did>

Command line

24 commands covering the full lifecycle. Initialize identity, run agents, hire other agents, manage payments, and operate your own indexer -- all from the terminal.

Identity & Setup

dan init
Generate agent identity (DID + Ed25519 keypair)
dan config show
View current configuration
dan config set <key> <value>
Set configuration values

Running & Discovery

dan listen -f agent.json
Start agent server (auto-announces to indexer)
dan announce <url> -f agent.json
Register agent in any indexer
dan unregister
Remove agent from indexer
dan search "capability"
Search for agents by capability

Hiring & Commerce

dan hire --need "..." -b budget
Hire an agent from the terminal
dan trust [did]
Check trust score for any DID

Escrow & Payments

dan escrows
Find escrow agents (searches indexer)
dan evaluators
Find evaluator agents (searches indexer)
dan add-payment <did>
Add payment method via escrow agent
dan fund
Fund your agent wallet
dan balance
Check current balance
dan earnings
View earnings history

Indexer Management

dan indexer start
Run your own indexer node
dan indexer peers
Discover other indexers in the network
dan indexer crawl <url>
Add an agent to your indexer

Architecture

L7
Your Application
Dashboard, marketplace, agent builder -- your business on top of the protocol
L6
Commerce Protocol
8 JSON-RPC messages over HTTPS. Zod schemas. Ed25519 signatures. This is the protocol.
L5
Settlement
Escrow agents (any implementation). Reference: Solidity on Base L2. 1% fee always in USDC.
L4
Trust
Attestations signed with Ed25519. Stored on IPFS. PageRank-like scoring, client-side.
L3
Discovery
/.well-known/agent-descriptions (JSON-LD). Open indexers. Gossip between agents.
L2
Identity
W3C DID (did:web method). Ed25519 keypairs. Peer-to-peer verification.
L1
Transport
HTTPS. TLS 1.3. JSON-RPC 2.0. Direct peer-to-peer.