Performance Overview
Understand what drives OpenClaw agent performance and where to focus your optimization efforts. Learn the key metrics, main bottlenecks, and quick wins that deliver the highest impact.
Why Performance Matters for AI Agents
Unlike traditional software where operations take milliseconds, AI agent tasks often span seconds to minutes due to LLM inference latency. Performance optimization in OpenClaw means:
- Reduced operating cost — fewer tokens = lower API bills
- Better user experience — faster responses keep users engaged
- Higher throughput — serve more concurrent users with the same infrastructure
- Predictability — consistent latency profiles make SLAs achievable
Key Performance Metrics
Use these five metrics as your performance dashboard when tuning OpenClaw deployments:
| Metric | What it measures | Typical value | Target |
|---|---|---|---|
| Task latency (P50) | Median time from input to completed output | 2s – 60s | < 10s for simple tasks |
| Task latency (P95) | 95th percentile — worst-case users experience | 10s – 120s | < 30s |
| Throughput | Concurrent tasks per minute | 1 – 50 | Scales with max_workers |
| Token cost | $ per 1M tokens consumed | $0.15 – $30 | Minimize with caching + model selection |
| Memory per instance | RAM consumed per agent instance | 50MB – 500MB | < 256MB/instance |
| Tool call overhead | Extra latency per tool invocation | 10ms – 500ms | < 50ms/call |
Measure these with the built-in profiler: openclaw run "task" --profile --output-metrics metrics.json.
Performance Profiles: Dev vs Production
OpenClaw ships with two built-in performance profiles. Use dev locally and production in deployment:
# config.yaml
performance_profile: production # or "dev"
# Under the hood, "production" applies:
# cache.enabled: true
# parallelism.max_workers: 8
# max_tokens: 2048
# timeout.task: 30
# memory.summarize_after: 20 # auto-compress long context| Setting | dev | production |
|---|---|---|
| Response caching | off | on (TTL 3600s) |
| Parallel tool calls | 2 workers | 8 workers |
| Context summarization | off | after 20 turns |
| max_tokens | 4096 | 2048 |
| Request timeout | 60s | 30s |
Main Performance Bottlenecks
1. LLM API Latency (dominates 60-80% of total time)
Every LLM inference call adds 1–15 seconds depending on model and provider. Mitigation strategies:
- Use faster tier models (GPT-4o-mini, Claude Haiku) for reasoning steps that don't require frontier capability
- Enable semantic caching — cache responses to similar prompts (typical cache hit rate: 30-60%)
- Enable streaming so partial results appear immediately
- Reduce system prompt size — every token in the system prompt is sent with every LLM call
2. Sequential Tool Calls
By default, tools execute one at a time. If your agent calls three independent APIs, that's 3× the latency. Enable parallel execution to fan out independent tool calls simultaneously:
parallelism:
enabled: true
max_workers: 4
timeout_per_tool: 103. Unbounded Context Growth
Long conversations accumulate tokens. At 16K tokens, GPT-4o costs 16× more and runs 4× slower than at 1K tokens. Use token optimization — summarize old turns and use RAG to retrieve only relevant context.
4. Synchronous Tool I/O
Web requests, file reads, and database queries are I/O bound. OpenClaw's async runtime handles these efficiently, but plugins written with blocking calls will serialize unnecessarily. Always use async I/O in custom tools.
5. Cold Start Overhead
Loading config, initializing plugins, and connecting to APIs adds 0.5–3s on every fresh agent launch. In production, keep agent processes warm with a keepalive task or use the --daemon flag.
Quick Wins — High Impact, Low Effort
# config.yaml — apply all quick wins at once
llm:
model: gpt-4o-mini # 10x cheaper + faster than gpt-4o for most tasks
max_tokens: 2048 # Cap response length
cache:
enabled: true
ttl: 3600 # Reuse responses for 1 hour
parallelism:
max_workers: 4 # Run independent tools simultaneously
timeout:
task: 30 # Fail fast — don't let stuck tasks drain credits
memory:
summarize_after: 15 # Auto-compress context after 15 turnsOptimization Roadmap
Apply these in order — earlier steps give the most bang for your buck:
- Switch to a faster model — use GPT-4o-mini or Claude Haiku where possible
- Enable caching — zero code changes, free performance
- Enable parallel execution — one config line
- Reduce system prompt — audit and trim unnecessary instructions
- Add context summarization — prevents context explosion in long sessions
- Profile and identify hotspots — use
--profileflag - Custom tool optimization — add async I/O, connection pooling
Identify Where Time is Spent
Run any task with --profile to get a breakdown:
openclaw run "your task" --profile
# Example output:
# ─────────────────────────────────────────────
# Task completed in 8.2s
# LLM calls: 5.9s (72%) ← main target
# Tool calls: 1.8s (22%)
# Overhead: 0.5s (6%)
# ─────────────────────────────────────────────
# Tokens used: 1,847 input + 312 output = 2,159 total
# Estimated cost: $0.0004
# Cache hits: 1/3 LLM calls (33%)Once you know where time is spent, see the relevant deep-dive: Benchmarks, Caching, Parallel Execution, Token Optimization, or Profiling.
Optimization Prioritization
Not all performance improvements deliver equal value. Token optimization typically reduces costs by 10-30% with low implementation effort. Caching reduces latency for repeated operations dramatically but only helps when repetition exists in your workload. Parallelism reduces wall-clock time but increases cost proportionally. Profiling reveals where time actually goes, which is rarely where intuition suggests. Start with profiling to diagnose the actual bottleneck, then apply targeted optimizations in this order: caching (if applicable), token optimization (always applicable), then parallelism (if throughput is constrained). Measure after each change to confirm it improved the intended metric before moving to the next optimization.