agentpprof is a tool that applies flamegraph-style visualization to AI agent traces, grouping prompts and tool calls by semantic intent to reveal token, time, file, and network cost hotspots across sessions. Unlike single-trace debuggers, it aggregates cross-session data by mapping natural language prompts to stable labels (debug, review, docs, etc.) using regex rules, LLM inference, or TF-IDF clustering. Width in the flamegraph encodes token consumption, elapsed time, or operation count, enabling teams to identify which prompt categories dominate agent budgets. The tool is part of AgentSight, an eBPF-based observability framework, and currently supports Codex and Claude Code traces. Key open problems include tagging stability, cross-project rule transfer, and optimal label granularity.

10m read timeFrom eunomia.dev
Post cover image
Table of contents
The Aggregation ProblemSemantic FlamegraphsViewsExamples from AgentSight DevelopmentTaggingAgentSight IntegrationFrom Visibility to ActionLimitationsReferences

Questions this post answers

How do semantic flamegraphs differ from traditional CPU flamegraphs when applied to AI agent traces?

Semantic flamegraphs replace deterministic function names with stable semantic tags (e.g., debug, review, docs) mapped from free-form prompts. Width encodes token consumption, elapsed time, or operation count instead of CPU time. The stack represents a causal chain — prompt → LLM decision → tool invocation → file or network effect — rather than a call hierarchy, enabling cross-session budget attribution by intent category. Teams profiling AI agent costs track these patterns on daily.dev as the tooling matures.

What tagging approaches does agentpprof support for classifying natural language prompts?

agentpprof offers three backends: regex rules (production default, deterministic, version-controllable, requires 5–10 iterative rounds to reach 95% coverage), an LLM tagger via llama.cpp (handles multilingual and semantically similar prompts but produces unstable results across runs), and TF-IDF + K-Means clustering (unsupervised, auto-selects 5–25 clusters, no predefined categories but produces keyword-derived rather than semantic tag names). Developers choosing between rule-based and model-based classification for agent observability find the trade-off discussions on daily.dev.

What are the current limitations of agentpprof for AI agent observability?

Agent coverage is limited to Codex and Claude Code local traces; other agents need parser extensions via the agent-session crate. Tagging remains unsolved — project-specific rules are required and one-word tags may conflate distinct activities. Cost attribution relies on agent-reported usage, which may not match actual billing due to cached tokens and batch discounts. No user studies yet confirm that the flamegraph view improves developer decisions. Keeping up with agentpprof's evolving limitations and new agent support is easier through daily.dev.

1 Impression