Performance Benchmarks
PraisonAI Agents includes built-in benchmarks to measure import time, memory usage, and verify lazy imports are working correctly.Performance Targets
| Metric | Target | Hard Fail | Description |
|---|---|---|---|
| Import Time | less than 200ms | greater than 300ms | Time to import praisonaiagents |
| Memory Usage | less than 30MB | greater than 45MB | Memory after import |
| Lazy Imports | All lazy | Any eager | Heavy deps not loaded |
Running Benchmarks
Import Time Benchmark
Memory Benchmark
Lazy Import Check
Using the Benchmark Scripts
The package includes benchmark scripts in thebenchmarks/ directory:
CI/CD Integration
Add performance checks to your CI pipeline:Optimization Tips
Reduce Import Time
- Use specific imports instead of star imports
- Import only what you need
- Defer imports in your own code
Reduce Memory Usage
- Use the lite package for minimal footprint
- Avoid loading unnecessary features
- Clear chat history when not needed
Benchmark Results
Typical results on a modern system:| Metric | Target | Typical | Status |
|---|---|---|---|
| Import Time | < 200ms | ~140ms | ✅ |
| Instantiation | < 50μs | ~8μs | ✅ |
| Memory/Agent | < 10KB | ~4KB | ✅ |
| Heavy Deps | Lazy | Lazy | ✅ |
Performance Improvements Over Time
| Metric | v0.4.x | v0.5.0+ | Improvement |
|---|---|---|---|
| Import Time | 820ms | 140ms | 83% faster |
| Memory | 93MB | 33MB | 64% less |
| litellm loaded | Eager | Lazy | Zero overhead |
| rich loaded | Eager | Lazy | Zero overhead |
Key Performance Features
- Lazy Loading: Heavy dependencies (litellm, rich, chromadb) are only loaded when needed
- Silent Mode Default:
output="silent"is the default foragent.run(), avoiding rich imports - Centralized Caching: Thread-safe lazy import caching via
_lazy.py - Fast Instantiation: Agent creation takes ~8μs with minimal function calls

