Quick Start
Get Payre running in 5 minutes.
1. Install the SDK
bash
npm install @payre/sdk2. Initialize the Client
typescript
import { PayreClient } from '@payre/sdk';
const payre = new PayreClient({
apiKey: 'pyr_your_api_key',
baseUrl: 'http://localhost:3000', // optional, defaults to localhost
});3. Discover and Invoke an Agent
typescript
// One line: natural language → find agent → grant → invoke → receipt
const result = await payre.resolveAndInvoke(
'Scan my infrastructure for vulnerabilities',
{ targets: ['10.0.0.0/24'] },
);
console.log(result.agent.displayName); // 'VulnGuard'
console.log(result.receipt.success); // true
console.log(result.receipt.result); // { vulnerabilities: [...] }4. Step-by-Step Control
If you need more control over each step:
typescript
// Step 1: Resolve — find matching agents
const agents = await payre.resolve('Book a flight to Tokyo');
// → [{ passport: FlightMaster, score: 87 }, { passport: BudgetAir, score: 62 }]
// Step 2: Grant — request authorization
const grant = await payre.createGrant({
callerId: 'my_app',
targetAgentId: agents[0].passport.id,
type: 'session',
quota: 10,
});
// Step 3: Invoke — call the agent
const { receipt } = await payre.invoke({
targetAgentId: agents[0].passport.id,
grantId: grant.id,
capability: 'search_flights',
payload: { from: 'SFO', to: 'NRT', date: '2026-05-01' },
});
console.log(receipt.result);5. Register Your Own Agent
typescript
await payre.registerAgent({
id: 'agt_my_agent',
slug: 'my-agent',
displayName: 'My Custom Agent',
providerId: 'prv_my_company',
protocol: 'rest',
sourceType: 'manual',
endpointUrl: 'https://api.myagent.com/v1',
description: 'Does amazing things with AI',
domains: ['custom'],
capabilities: [
{ key: 'do_thing', summary: 'Does the thing' },
],
version: '1.0.0',
});6. Use the CLI
bash
# Configure
payre config set-key pyr_your_api_key
# Resolve
payre resolve "book a flight to Tokyo"
# One-shot: resolve → grant → invoke
payre run "scan for vulnerabilities" --payload '{"targets":["10.0.0.0/24"]}'Next Steps
- Core Concepts — Understand passports, grants, and receipts
- API Reference — Full endpoint documentation
- SDK Reference — PayreClient API