@agent-os-lab/agent-sdk 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/USAGE.md +17 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -260,6 +260,18 @@ const page = await client.listBillingEvents({
260
260
  });
261
261
  ```
262
262
 
263
+ Use `getUsage` for aggregate tenant run usage without pulling billing events:
264
+
265
+ ```ts
266
+ const { usage } = await client.getUsage({
267
+ agentId: "support-agent",
268
+ from: "2026-05-01T00:00:00.000Z",
269
+ to: "2026-05-31T23:59:59.999Z",
270
+ });
271
+
272
+ console.log(usage.runs, usage.completedRuns, usage.estimatedCost);
273
+ ```
274
+
263
275
  ## Create A Bot-Owned Agent And Wiki
264
276
 
265
277
  For tenant product setup flows, use `createBotBundle` to create a Bot with its own Agent, optional Wiki, and optional channel account in one call. The SDK creates the Wiki first, passes the generated `wikiId` into Agent creation, creates the Bot bound to that Agent, then creates the channel account bound to the Bot.
package/USAGE.md CHANGED
@@ -255,6 +255,23 @@ const page = await client.listBillingEvents({
255
255
 
256
256
  Each event includes `sequence`, `billingSubjectId`, `source`, `sourceId`, resource ids such as `agentId`/`wikiId`/`runId`, `cost`, `currency`, `totalTokens`, and the raw `payload`.
257
257
 
258
+ Use `getUsage` when you only need aggregate run usage instead of the billing event stream:
259
+
260
+ ```ts
261
+ const { usage } = await client.getUsage({
262
+ agentId: "support-agent",
263
+ from: "2026-05-01T00:00:00.000Z",
264
+ to: "2026-05-31T23:59:59.999Z",
265
+ });
266
+
267
+ console.log(usage.runs);
268
+ console.log(usage.completedRuns);
269
+ console.log(usage.estimatedCost);
270
+ console.log(usage.unpricedRuns);
271
+ ```
272
+
273
+ `getUsage` is server-only and returns tenant-scoped aggregate counts from the cost ledger. The optional `agentId`, `from`, and `to` filters are exact agent id and inclusive timestamp bounds. It does not return raw usage events or billing ledger rows.
274
+
258
275
  ## Creating A Bot Bundle
259
276
 
260
277
  Use `createBotBundle` when a tenant application wants a productized setup flow for a Bot-owned Agent. The SDK creates the resources in order: Wiki, Agent, Bot, then Bot channel account. If `wiki` is present, the new Agent is created with `wikiId` already bound.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-os-lab/agent-sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",