> workflow / performance
Performance
Meet latency, cost, and throughput budgets for application and AI paths with profile-guided changes — not speculative rewrites.
What should I do next?
Complete the steps and evidence below, clear the human gates, then continue to DevOps.
When to use
- SLOs or cost budgets exist and RC may violate them
- Token spend or context size is unbounded in agent paths
- Load profile for launch is known enough to measure
- You need budget guards before devops wiring
Step-by-step
- Define or confirm SLOs and cost budgets per critical path.
- Measure baselines (p95 latency, error rate, $/request, tokens/request).
- Run performance-review.prompt on hot paths; prefer evidence over intuition.
- Optimize with optimization-pattern: cache, batch, smaller context, cheaper models where quality allows.
- Install budget-guard.hook.sh for agent sessions that can runaway.
- Re-measure; refuse "feels faster" without numbers.
- File an optimization backlog for non-blocking work; waive SLO misses only explicitly.
Decisions to make
- Fix now vs backlog with SLO waiver
- Model downgrade vs prompt/context reduction vs infra scale
- Cache invalidation strategy for AI responses
- Load-test fidelity required before prod
Evidence to collect
- Perf report with before/after metrics
- Budget guard config committed
- Optimization backlog with owners
- SLO waiver record if shipping under budget miss
Role-specific next actions
- PM: Trade feature scope for SLO attainment when budgets are real.
- Architect: Decide caching and model-placement changes that alter ADRs.
- Engineer: Profile, patch, and re-measure; avoid speculative rewrites.
- DevOps: Provide load-test harness and capacity headroom data.
Inputs
- SLOs and cost budgets
- Load profile / traffic assumptions
- Baseline traces and token metrics
Outputs
- Performance report
- Optimization backlog
- Budget guard configuration
Required prompts
- Performance review
Structured review of latency, cost, and throughput regressions.
Required skills
- Performance
Profile-guided performance work.
- Observability
Instrumentation required to measure AI and app paths.
Required MCP servers
- OpenTelemetry MCP
Pull traces/metrics while diagnosing hot paths.
- Grafana MCP
Optional dashboard interrogation during perf work.
Tooling & handbook
- Containing token waste
Cost control for context and tool loops.
- budget-guard hook
Hard stop on runaway agent spend.
- Optimization pattern
Profile-guided improvement pattern.
- Tracing
Trace agent tool calls end-to-end.
Recommended agents & patterns
- Optimization pattern
Primary pattern for this stage.
- Observability agent
Helps interpret traces and metrics.
Human approval gates
- SLO regression requires explicit waiver with owner and expiry
- Unbounded agent loops blocked by budget guards before prod
Automation opportunities
- budget-guard.hook.sh in agent runners
- Canary metrics compared to baseline SLOs
- CI perf smoke on critical paths where feasible
Enterprise best practices
- Chargeback or showback for model spend
- Capacity planning for launch peaks
- Cost anomalies page on-call like latency pages
Common mistakes
- Optimizing before measuring
- Unbounded context windows and tool loops
- Shipping without a cost budget because "AI is strategic"