|
6 | 6 |
|
7 | 7 | # AgentOS |
8 | 8 |
|
9 | | -**Open-source TypeScript runtime for production AI agents — unified graph orchestration (AgentGraph / workflow / mission), multimodal RAG, 37 channel adapters, 5-tier guardrails, 21 LLM providers.** |
| 9 | +**TypeScript runtime for autonomous AI agents — multimodal RAG, cognitive memory, streaming guardrails, voice pipeline, and emergent multi-agent orchestration.** |
10 | 10 |
|
11 | 11 | [](https://www.npmjs.com/package/@framers/agentos) |
12 | 12 | [](https://github.com/framersai/agentos/actions) |
@@ -194,11 +194,29 @@ const assistant = agent({ |
194 | 194 | const session = assistant.session('tcp-demo'); |
195 | 195 | const reply = await session.send('Now compare TCP and UDP.'); |
196 | 196 | console.log(reply.text); |
| 197 | +console.log(await session.usage()); |
197 | 198 |
|
198 | 199 | // Legacy format — still supported: |
199 | 200 | // const result = await generateText({ model: 'openai:gpt-4o', prompt: '...' }); |
200 | 201 | ``` |
201 | 202 |
|
| 203 | +If you want durable helper-level usage accounting outside the full runtime, enable |
| 204 | +the opt-in usage ledger: |
| 205 | + |
| 206 | +```typescript |
| 207 | +import { generateText, getRecordedAgentOSUsage } from '@framers/agentos'; |
| 208 | + |
| 209 | +await generateText({ |
| 210 | + provider: 'openai', |
| 211 | + prompt: 'Explain HTTP keep-alive.', |
| 212 | + usageLedger: { enabled: true, sessionId: 'readme-demo' }, |
| 213 | +}); |
| 214 | + |
| 215 | +console.log(await getRecordedAgentOSUsage({ enabled: true, sessionId: 'readme-demo' })); |
| 216 | +``` |
| 217 | + |
| 218 | +With `enabled: true`, AgentOS writes to the shared home ledger at `~/.framers/usage-ledger.jsonl` unless you provide `usageLedger.path` or one of the ledger env vars. |
| 219 | + |
202 | 220 | Built-in image providers: `openai`, `openrouter`, `stability`, and `replicate`. |
203 | 221 |
|
204 | 222 | Use `providerOptions` when you need provider-native controls without leaving the |
|
0 commit comments