import { Agent, openai, EventBus, SessionProfiler, DEFAULT_ARCHITECTURES } from "@radaros/core";
const eventBus = new EventBus();
const profiler = new SessionProfiler({
modelArch: DEFAULT_ARCHITECTURES["llama-3.1-70b"],
kvWarningThresholdGb: 100,
});
profiler.attach(eventBus);
const agent = new Agent({
name: "assistant",
model: openai("gpt-4o"),
eventBus,
});
// Run some sessions
await agent.run("Hello!", { sessionId: "s1" });
await agent.run("Tell me more", { sessionId: "s1" });
await agent.run("Quick question", { sessionId: "s2" });
// Get live stats
const stats = profiler.getSessionStats();
console.log(stats.byCategory); // { light: 2, medium: 0, heavy: 0, extreme: 0 }
console.log(stats.totalTokens); // actual token count from API
console.log(stats.estimatedKvGb); // tokens × kvBytesPerToken