@cognipeer/agent-sdk 0.6.4 → 0.6.5

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.
package/README.md CHANGED
@@ -333,7 +333,7 @@ Exported helpers (`agent-sdk/src/index.ts`):
333
333
  **Agent factories:**
334
334
  - `createSmartAgent(options)`
335
335
  - `createAgent(options)`
336
- - `createTool({ name, description?, schema, func, needsApproval?, approvalPrompt?, approvalDefaults?, maxExecutionsPerRun? })`
336
+ - `createTool({ name, description?, schema, func, needsApproval?, approvalPrompt?, approvalDefaults?, maxExecutionsPerRun?, cache?, retry? })`
337
337
 
338
338
  **Native providers (no LangChain):**
339
339
  - `createProvider(config)` – factory for all six providers
@@ -348,11 +348,25 @@ Exported helpers (`agent-sdk/src/index.ts`):
348
348
 
349
349
  **Utilities:**
350
350
  - `buildSystemPrompt(extra?, planning?, name?)`
351
+ - `setTokenCounter`, `getTokenCounter`, `defaultTokenCounter` – swap in a real tokenizer (tiktoken, etc.) globally or per-invoke
351
352
  - Node factories (`nodes/*`), context helpers, token utilities, and full TypeScript types (`SmartAgentOptions`, `SmartState`, `AgentInvokeResult`, etc.).
352
353
 
353
- `SmartAgentOptions` accepts the usual suspects (`model`, `tools`, `limits`, `runtimeProfile`, `customProfile`, `useTodoList`, `summarization`, `reasoning`, `usageConverter`, `tracing`). See `docs/api/` for detailed type references.
354
+ `SmartAgentOptions` accepts the usual suspects (`model`, `tools`, `limits`, `runtimeProfile`, `customProfile`, `useTodoList`, `summarization`, `reasoning`, `usageConverter`, `tracing`, `tokenCounter`, `costEstimator`). See `docs/api/` for detailed type references.
354
355
 
355
- Tools can also declare `maxExecutionsPerRun` to cap successful executions for that tool within a single agent run. Leave it unset or set it to `null` for unlimited usage. This is separate from global limits such as `limits.maxToolCalls` and `limits.maxParallelTools`.
356
+ **Budget surfaces** (`limits`):
357
+ - `maxToolCalls`, `maxParallelTools`, `maxContextTokens` – classic loop budgets
358
+ - `maxTotalOutputTokens` – cap on cumulative completion tokens
359
+ - `maxCostUsd` – cumulative USD cost (requires `costEstimator`)
360
+ - `maxWallClockMs` – overall wall-clock budget (also available as `InvokeConfig.timeoutMs`)
361
+
362
+ **Tool-level controls** (`createTool`):
363
+ - `maxExecutionsPerRun` – cap successful executions of that tool within a single run
364
+ - `cache` – opt-in per-invoke result cache (`true` or `{ keyFn?, ttlMs? }`)
365
+ - `retry` – per-tool retry policy `{ maxRetries?, backoffMs?, shouldRetry?, circuitBreakerThreshold? }`
366
+
367
+ **Provider-level controls** (`createProvider`):
368
+ - `retry` – automatic 429 / 5xx retry with exponential backoff and `Retry-After` support
369
+ - `prompt_caching: { enabled: true }` – Anthropic `cache_control` and Bedrock `cachePoint` breakpoints for ~90% input-token savings on long tool-heavy runs
356
370
 
357
371
  ## Tracing & observability
358
372