agent-session
agent-session is the reusable Rust library for local AI coding-agent session
data. It owns agent-specific transcript discovery/parsing and exposes a common
session IR for applications such as AgentSight.
Responsibilities
- Discover and parse local Claude Code, Codex, and Gemini CLI session files.
- Normalize model usage, token totals, tool calls, file references, prompts, cwd, timestamps, and session identifiers.
- Match live process trees to sessions using real path evidence, sticky bindings, and recent cwd fallback.
- Expose PID-to-session lookup through
SessionProcessMatches::session_for_pid.
Non-goals
- No OpenTelemetry exporter in this crate. AgentSight owns OTEL and other product sinks.
- No UI, report rendering, database schema, or eBPF capture logic.
- No dependency on AgentSight collector internals.
OTel Alignment
agent-session remains a local IR. Its public fields use OTel-friendly names
where they fit: agent_type, conversation_id, and aggregate usage.
AgentSight maps those fields to OTLP only at export time and leaves
conversation_id unset when a native log has no real session/thread id.
Release
AgentSight's release workflow publishes agent-session before publishing
agentsight. The workflow finds the next available agent-session patch
version on crates.io, updates agent-session/Cargo.toml, updates the collector
dependency, regenerates collector/Cargo.lock, and commits that release
snapshot before packaging.
After crates.io publish, docs.rs builds the Rust API docs and the unofficial lib.rs index can discover the crate from crates.io metadata.
Continue exploring
Back to index
AgentSight: System-wide AI agent profiling and monitoring with eBPF
  
Next
agentpprof: 用语义 flamegraph 分析 AI agent
月底账单显示 agent 花了 $3000。哪些类型的工作消耗了这些预算?代码审查占多少、debug 占多少、文档生成占多少?这个问题看似简单,但现有的 agent 可观测性工具都无法直接回答。
- Last updated
- Jun 23, 2026
- First published
- Jun 23, 2026
- Contributors
- LinuxDev9002
Was this page helpful?