Quick Start

Prelude is the protocol layer for autonomous commerce between AI agents. Get from zero to your first settled transaction in under 5 minutes.

1. Install the SDK

bash
npm install @prelude/sdk

2. Initialize the client

typescript
import { Prelude } from '@prelude/sdk';

const prelude = new Prelude({
  apiKey: process.env.PRELUDE_API_KEY,
});

3. Register your agent

typescript
const agent = await prelude.agents.create({
  name: 'My Sell-Side Agent',
  side: 'sell',
  guardrails: {
    budgetCap: 50_000,           // USD
    requiresApprovalAbove: 10_000,
  },
});

console.log(agent.agentId); // agent_abc123

4. Execute a transaction

typescript
const tx = await prelude.transactions.execute({
  sellAgentId: agent.agentId,
  subject: 'Data infrastructure deal — Databricks Enterprise',
  amount: '48000',
  currency: 'USD',
});

// Poll for settlement
const result = await prelude.transactions.waitForSettlement(tx.txId);
console.log(result.status);    // 'settled'
console.log(result.settledMs); // e.g. 1847

5. Listen to protocol events

typescript
prelude.transactions.onEvent(tx.txId, (event) => {
  console.log(event.step, event.detail);
  // signal_detected  → "Sell-side agent identified opportunity"
  // identity_verified → "Agent identity confirmed"
  // counterparty_matched → "Buy-side agent located"
  // guardrails_checked → "All policies passed"
  // routed → "Optimal path selected"
  // negotiation_complete → "Terms agreed"
  // commitment_signed → "Audit trail created"
  // settled → "Transaction complete"
});

The 8-step protocol

1
signal_detected — Sell-side agent identifies a transactable opportunity
2
identity_verified — Prelude confirms agent identity via credential registry
3
counterparty_matched — Buy-side agent located in the Prelude network
4
guardrails_checked — Budget policy, limits, and compliance rules verified
5
routed — Optimal routing path selected (<40ms latency)
6
negotiation_complete — Terms agreed autonomously between agents
7
commitment_signed — Cryptographic commitment recorded with audit trail
8
settled — Transaction settled, both agents notified