agentrust-sdk
v0.11.0
Published
Trust infrastructure for AI agent transactions — identity, contracts, escrow, discovery, negotiation, credentials, SLA, benchmarks
Maintainers
Readme
agentrust-sdk
Trust infrastructure for AI agent transactions. Identity verification, cryptographic contracts, escrow payments, reputation scoring, dispute resolution.
Install
npm install agentrust-sdkQuick Start
import { AgentTrust } from "agentrust-sdk";
const trust = new AgentTrust({
apiKey: process.env.AGENTRUST_KEY,
agentId: process.env.AGENT_ID,
});
// Discover suppliers
const suppliers = await trust.analytics.discover({
category: "packaging",
max_price_eur: 0.20,
min_score: 60,
});
// Create contract
const contract = await trust.contracts.create({
counterparty: suppliers.results[0].agent_id,
terms: {
items: [{ reference: "XK200", quantity: 10000, unit_price_eur: 0.15, total_eur: 1500 }],
delivery: { deadline_days: 5 },
payment: { total_eur: 1500, method: "escrow", currency: "EUR" },
penalties: { partial_delivery: "pro_rata_refund" },
},
});
// Escrow and release
const escrow = await trust.payments.escrow({ contractId: contract.id });
await trust.payments.release(escrow.id);Resources
| Resource | Methods |
|----------|---------|
| trust.identity | verify, register, createAgent, listAgents, updateAgent, suspendAgent, reactivateAgent |
| trust.contracts | create, sign, get, list, complete, cancel, amend, acceptAmendment, rejectAmendment, history, amendments |
| trust.payments | escrow, release, refund, get, list |
| trust.reputation | get, history, compare |
| trust.disputes | open, addEvidence, get, list |
| trust.analytics | overview, benchmarks, leaderboard, myStats, discover, addCatalogItem, verifyCompany, search |
| trust.platform | health, status, listKeys, createKey, revokeKey, rotateKey, webhookDeliveries, getNotifications, setNotifications, dataExport |
Webhook Verification
import { verifyWebhookSignature } from "agentrust-sdk";
app.post("/webhooks", (req, res) => {
if (!verifyWebhookSignature(req.rawBody, req.headers["x-agentrust-signature"], WEBHOOK_SECRET)) {
return res.status(401).send("Invalid signature");
}
// Process event
});Multi-Currency
Supports EUR, USD, GBP. Set in contract terms.
Error Handling
import { AgentTrustApiError } from "agentrust-sdk";
try {
await trust.contracts.create({ ... });
} catch (err) {
if (err instanceof AgentTrustApiError) {
console.log(err.code); // "missing_field"
console.log(err.statusCode); // 400
console.log(err.requestId); // "req_..."
}
}