{"_id":"@agenitry/sdk","_rev":"3-2851642155bf0465a30d7841694bf022","name":"@agenitry/sdk","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@agenitry/sdk","version":"0.1.0","keywords":["agenitry","audit","ai-agents","ledger","compliance","observability"],"author":{"name":"Concya"},"license":"MIT","_id":"@agenitry/sdk@0.1.0","maintainers":[{"name":"agenitry","email":"ola@agenitry.com"}],"homepage":"https://github.com/concya/agenitry#readme","bugs":{"url":"https://github.com/concya/agenitry/issues"},"dist":{"shasum":"48c4454bfa992d8a47b0853a7981634d6e5a564e","tarball":"https://registry.npmjs.org/@agenitry/sdk/-/sdk-0.1.0.tgz","fileCount":6,"integrity":"sha512-dbXu3kYUoLSQC3ukQWs14mLNJo1hLExccMfP2Fyl04qytw2+RMdHLh6OX5N2facJVZwC2is8FXBlkgc4GJK+XA==","signatures":[{"sig":"MEUCIFUEf3MsT9X/w5zGqPk2SrVTTUWHa9apf4QRuYFg9Co2AiEAtPI0VGv2YEyYarfX3kXDq8BKhGjXJSykuiboQl2jbkA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32814},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"a4080a51e705e8afb00014d933690f311409051a","scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"agenitry","email":"ola@agenitry.com"},"repository":{"url":"git+https://github.com/concya/agenitry.git","type":"git","directory":"sdk"},"_npmVersion":"10.9.3","description":"Official SDK for the Agenitry audit-trail API — log AI agent actions, query events, and pull stats in two lines of code.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1775875643593_0.4208216008576262","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agenitry/sdk","version":"0.1.1","keywords":["agenitry","audit","ai-agents","ledger","compliance","observability"],"author":{"name":"Concya"},"license":"MIT","_id":"@agenitry/sdk@0.1.1","maintainers":[{"name":"agenitry","email":"ola@agenitry.com"}],"homepage":"https://github.com/concya/agenitry#readme","bugs":{"url":"https://github.com/concya/agenitry/issues"},"dist":{"shasum":"ebe8e1e41b64f7a3663d66e04b62c3696866a6fb","tarball":"https://registry.npmjs.org/@agenitry/sdk/-/sdk-0.1.1.tgz","fileCount":6,"integrity":"sha512-V9hU91fRxGYlG+d5myX8BkoiqEHKLMFViHlrBRwMnSQ+szbFOyjMdlGNLbtfEvFhca+NlhNezlfnptIImpmtWA==","signatures":[{"sig":"MEUCIAtswssMKh2t1CvWEAMwPjd+g4zGY3u5AJB+cVQPafYOAiEAqggw//zy8RpNQbKR+f8frqR1GRuPZhQII5+evP6JmQ4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32586},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"a4080a51e705e8afb00014d933690f311409051a","scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"agenitry","email":"ola@agenitry.com"},"repository":{"url":"git+https://github.com/concya/agenitry.git","type":"git","directory":"sdk"},"_npmVersion":"10.9.3","description":"Official SDK for the Agenitry audit-trail API — log AI agent actions, query events, and pull stats in two lines of code.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1775875784485_0.165399388680324","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agenitry/sdk","version":"0.1.2","description":"Official SDK for the Agenitry audit-trail API — log AI agent actions, query events, and pull stats in two lines of code.","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"keywords":["agenitry","audit","ai-agents","ledger","compliance","observability"],"author":{"name":"Concya"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/concya/agenitry.git","directory":"sdk"},"devDependencies":{"tsup":"^8.3.5","typescript":"^5.6.3","vitest":"^2.1.8"},"_id":"@agenitry/sdk@0.1.2","gitHead":"a4080a51e705e8afb00014d933690f311409051a","bugs":{"url":"https://github.com/concya/agenitry/issues"},"homepage":"https://github.com/concya/agenitry#readme","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-pmZBmIPYadP93Q3Pjo/Mw+bDu6A1pOg86MEVDwwMmsnHOYkBYyMk6dR6whMAERYoL5nr2HGF8uEQBm5pMTAvpw==","shasum":"7ead79ca43d109deae2c40732ca473a6495ba73f","tarball":"https://registry.npmjs.org/@agenitry/sdk/-/sdk-0.1.2.tgz","fileCount":6,"unpackedSize":34787,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICC5zteJSq448IQbUhclbchnM6DSb+7u9uox9P0UXjf2AiAGhHV6EiNK9wumFhn84KfqiPeeSNQWaVc7qozlxSYfWw=="}]},"_npmUser":{"name":"agenitry","email":"ola@agenitry.com"},"directories":{},"maintainers":[{"name":"agenitry","email":"ola@agenitry.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.2_1775905220325_0.23552629051912155"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-11T02:47:23.449Z","modified":"2026-04-11T11:00:20.615Z","0.1.0":"2026-04-11T02:47:23.749Z","0.1.1":"2026-04-11T02:49:44.620Z","0.1.2":"2026-04-11T11:00:20.503Z"},"bugs":{"url":"https://github.com/concya/agenitry/issues"},"author":{"name":"Concya"},"license":"MIT","homepage":"https://github.com/concya/agenitry#readme","keywords":["agenitry","audit","ai-agents","ledger","compliance","observability"],"repository":{"type":"git","url":"git+https://github.com/concya/agenitry.git","directory":"sdk"},"description":"Official SDK for the Agenitry audit-trail API — log AI agent actions, query events, and pull stats in two lines of code.","maintainers":[{"name":"agenitry","email":"ola@agenitry.com"}],"readme":"# Agenitry SDK\n\n**Every AI agent takes actions. None of them leave a paper trail.**\n\nWhen your voice agent books a reservation, changes a price, or captures an order — there's no proof it happened. No audit log. No compliance record. No way to verify.\n\nAgenitry fixes that in 5 lines.\n\n```bash\nnpm install @agenitry/sdk\n```\n\n```ts\nimport { Agenitry } from \"@agenitry/sdk\";\n\nconst agent = new Agenitry({ apiKey: \"ag_your_key\", venueId: \"my-venue\" });\n\nagent.log({ action: \"order_captured\", amount: 42.50 });\n```\n\nThat's it. Every event is now immutable, timestamped, and verifiable at a unique URL:\n\n```\nhttps://agenitry.com/verify/evt_abc123?venue=my-venue\n```\n\n**You log it. Anyone can verify it.** That's the entire product.\n\n---\n\n## The 5-line integration\n\n```ts\nimport { Agenitry } from \"@agenitry/sdk\";\n\nconst agent = new Agenitry({ apiKey: \"ag_your_key\", venueId: \"my-venue\" });\n\n// Log an event — fire-and-forget, never blocks, never throws\nagent.log({ action: \"order_captured\", amount: 42.50 });\n\n// That's it. The event is now immutable and verifiable.\n```\n\n### Verify it worked\n\nAfter logging, every event gets a permanent verify URL. Open it in a browser — no auth required:\n\n```\nhttps://agenitry.com/verify/evt_abc123?venue=my-venue\n```\n\nThis is your proof. Share it with auditors, compliance teams, or customers. The event cannot be edited or deleted.\n\n---\n\n## Quick start\n\n### 1. Get an API key\n\nSign up at [agenitry.com/signup](https://agenitry.com/signup) — you'll get an API key and venue ID instantly.\n\n### 2. Install\n\n```bash\nnpm install @agenitry/sdk\n```\n\n### 3. Log events\n\n```ts\nimport { Agenitry } from \"@agenitry/sdk\";\n\nconst agent = new Agenitry({\n  apiKey: \"ag_your-api-key\",\n  venueId: \"my-venue\",\n});\n\n// Fire-and-forget (recommended for hot paths)\nagent.log({ action: \"order_captured\", amount: 125.00 });\n\n// With context\nagent.log({\n  action: \"reservation_booked\",\n  amount: 0,\n  direction: \"inbound\",\n  context: { table: \"12\", guests: 4, time: \"7:30pm\" },\n  reason: \"AI booked reservation via phone\",\n});\n\n// Await confirmation when you need the event ID\nconst result = await agent.log(\n  { action: \"comp_issued\", amount: 15.00 },\n  { await: true },\n);\nconsole.log(result.id);     // \"evt_abc123\"\nconsole.log(result.verify_url); // \"https://agenitry.com/verify/evt_abc123?venue=my-venue\"\n```\n\n### 4. Query events\n\n```ts\nconst { events } = await agent.events({ limit: 10 });\n```\n\n### 5. Pull stats\n\n```ts\nconst stats = await agent.stats({ period: \"7d\" });\nconsole.log(stats.event_count);    // 42\nconsole.log(stats.total_inbound);  // 1250.00\n```\n\n---\n\n## Event actions\n\nThe six canonical event types your agent can log:\n\n| Action | Description |\n|---|---|\n| `order_captured` | AI captured an order |\n| `reservation_booked` | AI booked a reservation |\n| `price_changed` | AI changed a price |\n| `item_86d` | AI marked an item as unavailable |\n| `comp_issued` | AI issued a comp (free item) |\n| `purchase_order` | AI placed a purchase order |\n\n## Event directions\n\nEvery event has a direction that describes the flow of money or resources:\n\n| Direction | Meaning | When to use |\n|---|---|---|\n| `inbound` | Money/resources flowing **in** | Revenue, orders captured, reservations booked |\n| `outbound` | Money/resources flowing **out** | Comps, refunds, purchase orders, costs |\n| `internal` | No money movement, just a state change | Price adjustments, items marked unavailable |\n\n### Which direction for each action?\n\n| Action | Typical direction | Why |\n|---|---|---|\n| `order_captured` | `inbound` | Customer pays → money flows in |\n| `reservation_booked` | `inbound` | Future revenue committed |\n| `price_changed` | `internal` | No money moves — just a price update |\n| `item_86d` | `internal` | No money moves — just an availability change |\n| `comp_issued` | `outbound` | You're giving something away → money flows out |\n| `purchase_order` | `outbound` | You're buying something → money flows out |\n\n### Examples\n\n```ts\n// Revenue flows in\nagent.log({ action: \"order_captured\", amount: 42.50, direction: \"inbound\" });\n\n// A comp flows out\nagent.log({ action: \"comp_issued\", amount: 15.00, direction: \"outbound\" });\n\n// A price change is internal — no money moved yet\nagent.log({ action: \"price_changed\", amount: 29.99, direction: \"internal\" });\n```\n\n---\n\n## Error handling\n\n**Fire-and-forget mode** (the default) never throws — errors are silently swallowed so your hot paths stay fast.\n\n```ts\nimport { Agenitry, AgenitryError } from \"@agenitry/sdk\";\n\ntry {\n  await agent.log({ action: \"order_captured\" }, { await: true });\n} catch (err) {\n  if (err instanceof AgenitryError) {\n    console.error(err.status);  // HTTP status (401, 404, etc.)\n    console.error(err.body);    // Parsed response body\n    console.error(err.code);    // \"API\" | \"NETWORK\" | \"TIMEOUT\"\n  }\n}\n```\n\n## Retry behavior\n\nAutomatic retries on **429** (rate limited) and **5xx** (server errors). Default: 2 retries with exponential backoff.\n\n```ts\nconst agent = new Agenitry({\n  apiKey: \"ag_xxx\",\n  venueId: \"my-venue\",\n  maxRetries: 3,           // More retries\n  retryBaseDelay: 1000,    // Longer backoff\n});\n```\n\n---\n\n## API reference\n\n### `new Agenitry(config)`\n\n| Param | Type | Required | Default |\n|---|---|---|---|\n| `apiKey` | `string` | ✅ | — |\n| `venueId` | `string` | ✅ | — |\n| `agentId` | `string` | ❌ | `\"default\"` |\n| `baseUrl` | `string` | ❌ | `\"https://api.agenitry.com\"` |\n| `maxRetries` | `number` | ❌ | `2` |\n| `retryBaseDelay` | `number` | ❌ | `500` |\n\n### `agent.log(payload, options?)`\n\n| Param | Type | Required |\n|---|---|---|\n| `payload.action` | `EventAction` | ✅ |\n| `payload.amount` | `number` | ❌ |\n| `payload.currency` | `string` | ❌ |\n| `payload.direction` | `EventDirection` | ❌ |\n| `payload.context` | `Record<string, unknown>` | ❌ |\n| `payload.reason` | `string` | ❌ |\n| `payload.agent_id` | `string` | ❌ |\n| `options.await` | `boolean` | ❌ (default: `false`) |\n\n### `agent.events(params?)`\n\n| Param | Type | Default |\n|---|---|---|\n| `params.agent_id` | `string` | — |\n| `params.action` | `EventAction` | — |\n| `params.limit` | `number` | `50` |\n| `params.offset` | `number` | `0` |\n\n### `agent.stats(params?)`\n\n| Param | Type | Default |\n|---|---|---|\n| `params.period` | `\"today\" \\| \"7d\" \\| \"30d\" \\| \"all\"` | `\"today\"` |\n\n---\n\n## Zero dependencies\n\nThe SDK has **zero runtime dependencies** — it uses the native `fetch` API. Works in Node.js 18+, browsers, Deno, Bun, Cloudflare Workers, and Vercel Edge Functions.\n\n## License\n\nMIT","readmeFilename":"README.md"}