Documentation Index
Fetch the complete documentation index at: https://kensa.sh/docs/llms.txt
Use this file to discover all available pages before exploring further.
Auto-instrumentation
Zero code changes. kensa auto-instruments your agent at startup. Install the extra for your provider:What gets captured
Each scenario runs in its own subprocess. kensa captures traces as JSONL and translates them to its internal format. Traces include:- LLM calls (model, tokens, cost, latency)
- Tool invocations (name, arguments, results)
- Span hierarchy (parent/child relationships)
Passive trace collection
Usekensa capture to record one real agent invocation as a trace, without writing a scenario first:
kensa capture runs your agent in a subprocess with KENSA_TRACE_DIR set and the runner’s sitecustomize.py injected via PYTHONPATH, so instrumentation happens automatically. Feed the resulting trace into kensa generate to synthesize scenarios grounded in real inputs.
For environments where the runner can’t inject sitecustomize (non-Python entry points, python -S, embedded interpreters), call instrument() from your agent code as an escape hatch:
KENSA_TRACE_DIR=traces/ before invoking the process.
OTel compatibility
Spans are standard OpenTelemetry, so anything that reads OTel spans can read them. kensa writes them as JSONL locally, which is whatkensa run and kensa analyze consume.
Cache-aware cost tracking
kensa readscache_read token counts from spans and subtracts them from prompt token costs. Each scenario’s cost reflects actual token usage, not cached replay. Cached tokens are tracked separately in the TokenCounts model and visible in reports.