Slow Endpoint Hunter
This loop identifies and optimizes slow API endpoints by continuously benchmarking, analyzing performance bottlenecks, and applying targeted improvements until response times meet predefined budgets.
Goal
Optimize slow endpoints
How to Run
Run this loop in your preferred coding agent environment to systematically optimize slow endpoints through automated performance analysis and iterative improvements.
- 01
Install Dependencies
Ensure you have necessary tools installed (e.g., Postman, curl, or custom benchmarking scripts) for measuring endpoint performance.
- 02
Configure Benchmark Thresholds
Set clear response time budgets per endpoint in your configuration or environment variables.
- 03
Initiate Loop
Execute the kickoff prompt in your coding agent. The agent will handle the rest, iterating up to 10 times or until optimization goals are met.
Workflow Steps
- 01
Run 'endpoint benchmark' to measure current endpoint response times against defined budgets
- 02
Identify slowest endpoints exceeding thresholds
- 03
Analyze root cause (database queries, inefficient algorithms, external service latency, etc.)
- 04
Implement targeted optimization for one identified endpoint
- 05
Re-run benchmark to validate improvement
- 06
If endpoints still exceed budget and iterations remain, repeat process; else exit successfully
Kickoff Prompt
Start the "Slow Endpoint Hunter" loop. Goal: Optimize slow endpoints Max iterations: 10 Between iterations run: endpoint benchmark Exit when: Endpoints within budget Analyze our application's API endpoints for performance bottlenecks. Begin by running the 'endpoint benchmark' command to measure response times. Identify any endpoints exceeding their performance budgets and prioritize optimizing them. For each iteration, select the slowest endpoint, diagnose its bottleneck, apply a targeted fix, then re-benchmark to confirm improvement. Continue this cycle until all endpoints are within budget or we reach 10 iterations. Document each optimization applied. Self-pace this loop. After each iteration, run `endpoint benchmark` and evaluate the output, and only continue if the exit condition is not met (Endpoints within budget). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Always backup code before making changes
- ·Do not modify more than one endpoint per iteration cycle
- ·Avoid database schema changes without explicit approval
- ·Log all performance changes for auditability
Flow Diagram
Related loops — Performance
Performance
Bundle Size Reducer
Iteratively reduces JavaScript bundle size by analyzing dependencies, identifying large modules, and applying targeted optimizations until a specified size target is met.
Performance
Frontend Speed Optimizer
Automatically improves frontend page speed by iteratively analyzing Lighthouse reports and applying targeted optimizations. This loop runs until your target Lighthouse performance score is achieved.
Performance
Database Latency Reducer
An automated loop designed to systematically identify and resolve database performance bottlenecks to reduce query response times. This agent analyzes execution plans, optimizes slow queries, and applies indexing strategies while maintaining data integrity and safety.