Quick Start

Commands
profile run
Run a task with profiling enabled:| Option | Short | Description |
|---|---|---|
--output | -o | Output file path |
--format | -f | Output format: console, json, html |
profile report
Generate a report from existing profiling data:| Option | Short | Description |
|---|---|---|
--output | -o | Output file path |
--format | -f | Output format: console, json, html |
profile benchmark
Benchmark agent performance with multiple iterations:| Option | Short | Default | Description |
|---|---|---|---|
--iterations | -n | 5 | Number of benchmark iterations |
--warmup | -w | 1 | Number of warmup runs |
--output | -o | - | Output file for results (JSON) |
profile flamegraph
Export a flamegraph visualization:| Option | Short | Default | Description |
|---|---|---|---|
--output | -o | profile.svg | Output SVG file |
profile summary
Print a quick profiling summary:Environment Variable
Enable profiling globally without CLI commands:Integration with agents.yaml
Profile agents defined in YAML:Advanced Usage
Combine with py-spy
For production-grade flamegraphs:Continuous Profiling
Profile multiple runs and aggregate:CI/CD Integration
Add profiling to your CI pipeline:Output Formats
Console Output
Human-readable format printed to terminal:JSON Output
Machine-readable format for processing:HTML Output
Interactive report with styling:- Summary metrics dashboard
- Statistical analysis table
- Slowest operations list
- API calls breakdown
- Streaming metrics (TTFT, total time)
Best Practices
Use warmup runs for benchmarks
Use warmup runs for benchmarks
Always include warmup runs to account for JIT compilation and caching:
Profile in production-like environment
Profile in production-like environment
Run benchmarks with similar data sizes and network conditions as production.
Track P95/P99 for latency-sensitive applications
Track P95/P99 for latency-sensitive applications
Mean latency can hide outliers. Focus on percentiles:
Compare before/after changes
Compare before/after changes
Save baseline benchmarks and compare after code changes:
Troubleshooting
No profiling data
No profiling data
Ensure profiling is enabled:
High variance in benchmarks
High variance in benchmarks
Increase iterations and warmup:
Missing API call data
Missing API call data
API calls are only tracked when using profiled functions or context managers in your code.

