Documentation
Use `flamegraph-sdk` with your PI agent and stream telemetry to your dashboard with minimal setup.
1. Install
Install the package from npm:
shell
npm install flamegraph-sdk
2. Instrument your agent
Wrap your agent once, then all session events flow automatically.
agent.ts
import { instrumentAgent, LocalCollector } from "flamegraph-sdk";
const collector = new LocalCollector({
serverUrl: process.env.FLAMEGRAPH_URL,
apiKey: process.env.FLAMEGRAPH_API_KEY,
});
instrumentAgent(agent, { collector }); 3. Key options
- serverUrl: Ingest endpoint for your collector API.
- apiKey: Workspace API key from Settings.
- autoFlushIntervalMs: Optional client-side flush interval.
- metadata: Attach feature, engineer, or project context.
4. Recommended workflow
- Generate an API key in dashboard Settings.
- Save it in environment variables, never hardcode in source.
- Run an agent session and open the Sessions page.
- Inspect flamegraph, waste report, and budget violations.