stratus-sdk 0.6.0 → 0.6.3
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 +53 -1
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
[usestratus.dev](https://usestratus.dev)
|
|
12
12
|
|
|
13
|
+
[](https://www.npmjs.com/package/stratus-sdk)
|
|
14
|
+
[](https://github.com/tylergibbs1/stratus/actions/workflows/ci.yml)
|
|
15
|
+
|
|
13
16
|
A TypeScript agent framework for Azure OpenAI. Build multi-agent systems with tools, handoffs, guardrails, streaming, structured output, and more.
|
|
14
17
|
|
|
15
|
-
`agents` `tools` `streaming` `structured output` `handoffs` `subagents` `guardrails` `hooks` `tracing` `sessions` `abort signals`
|
|
18
|
+
`agents` `tools` `streaming` `structured output` `handoffs` `subagents` `guardrails` `hooks` `tracing` `sessions` `abort signals` `todo tracking` `cost tracking`
|
|
16
19
|
|
|
17
20
|
## Install
|
|
18
21
|
|
|
@@ -331,6 +334,55 @@ try {
|
|
|
331
334
|
}
|
|
332
335
|
```
|
|
333
336
|
|
|
337
|
+
### Todo Tracking
|
|
338
|
+
|
|
339
|
+
Track task progress during agent execution:
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
import { todoTool, TodoList } from "stratus-sdk";
|
|
343
|
+
|
|
344
|
+
const todos = new TodoList();
|
|
345
|
+
todos.onUpdate((items) => {
|
|
346
|
+
for (const item of items) {
|
|
347
|
+
const icon = item.status === "completed" ? "+" : item.status === "in_progress" ? ">" : "-";
|
|
348
|
+
console.log(`${icon} ${item.content}`);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
const agent = new Agent({
|
|
353
|
+
name: "planner",
|
|
354
|
+
instructions: "Break tasks into steps and track progress with todo_write.",
|
|
355
|
+
model,
|
|
356
|
+
tools: [todoTool(todos)],
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
await run(agent, "Set up a new TypeScript project");
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Usage & Cost Tracking
|
|
363
|
+
|
|
364
|
+
Track token usage and estimate costs:
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
import { createCostEstimator } from "stratus-sdk";
|
|
368
|
+
|
|
369
|
+
const estimator = createCostEstimator({
|
|
370
|
+
inputTokenCostPer1k: 0.01,
|
|
371
|
+
outputTokenCostPer1k: 0.03,
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const result = await run(agent, "Hello", { costEstimator: estimator });
|
|
375
|
+
console.log(result.usage.totalTokens); // token counts
|
|
376
|
+
console.log(result.totalCostUsd); // estimated cost
|
|
377
|
+
console.log(result.numTurns); // model call count
|
|
378
|
+
|
|
379
|
+
// Set budget limits
|
|
380
|
+
const result = await run(agent, "Hello", {
|
|
381
|
+
costEstimator: estimator,
|
|
382
|
+
maxBudgetUsd: 0.50, // throws MaxBudgetExceededError if exceeded
|
|
383
|
+
});
|
|
384
|
+
```
|
|
385
|
+
|
|
334
386
|
### Tool Choice & Tool Use Behavior
|
|
335
387
|
|
|
336
388
|
Control how the model uses tools:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stratus-sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
"import": "./dist/azure/index.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
21
|
+
"files": ["dist"],
|
|
24
22
|
"scripts": {
|
|
25
23
|
"build": "tsc -p tsconfig.build.json",
|
|
26
24
|
"typecheck": "tsc --noEmit",
|