Add concurrent agent limiting to kugetsu CLI

- Add MAX_CONCURRENT_AGENTS (default: 3) to limit concurrent agents
- Implement acquire_agent_slot() and release_agent_slot() with flock
- Wrap cmd_start, cmd_continue, and cmd_delegate with slot management
- cmd_delegate holds slot until background task completes (fire-and-forget + blocking)
- Add basic concurrency tests to test suite
This commit is contained in:
shokollm
2026-03-31 07:25:26 +00:00
parent 0b36bec142
commit 83a4b1243d
10 changed files with 389 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
agents,duration,success,failed,timeout,avg_response,stddev,min_response,max_response,peak_cpu,avg_cpu,peak_mem_mb,avg_mem_mb,peak_mem_pct,avg_mem_pct,peak_procs,baseline_mem,mem_per_agent,cost_score
1,7.01,1,0,0,6.28,0.00,6.28,6.28,0.0,0.0,2546.8,2439.8,0.0,0.0,0,2183.3,363.6,2.55
2,13.02,2,0,0,9.24,4.46,6.09,12.40,0.0,0.0,2889.0,2659.4,0.0,0.0,0,2189.1,350.0,9.11
3,8.02,3,0,0,6.33,1.48,4.75,7.69,0.0,0.0,3233.1,2848.9,0.0,0.0,0,2211.8,340.4,8.19
5,12.04,5,0,0,6.65,2.77,4.71,11.52,0.0,0.0,3911.8,2996.9,0.0,0.0,0,2210.1,340.3,20.49
8,62.50,0,0,8,60.00,0.00,60.00,60.00,0.0,0.0,4033.0,3940.6,0.0,0.0,0,2245.9,223.4,111.69
1 agents duration success failed timeout avg_response stddev min_response max_response peak_cpu avg_cpu peak_mem_mb avg_mem_mb peak_mem_pct avg_mem_pct peak_procs baseline_mem mem_per_agent cost_score
2 1 7.01 1 0 0 6.28 0.00 6.28 6.28 0.0 0.0 2546.8 2439.8 0.0 0.0 0 2183.3 363.6 2.55
3 2 13.02 2 0 0 9.24 4.46 6.09 12.40 0.0 0.0 2889.0 2659.4 0.0 0.0 0 2189.1 350.0 9.11
4 3 8.02 3 0 0 6.33 1.48 4.75 7.69 0.0 0.0 3233.1 2848.9 0.0 0.0 0 2211.8 340.4 8.19
5 5 12.04 5 0 0 6.65 2.77 4.71 11.52 0.0 0.0 3911.8 2996.9 0.0 0.0 0 2210.1 340.3 20.49
6 8 62.50 0 0 8 60.00 0.00 60.00 60.00 0.0 0.0 4033.0 3940.6 0.0 0.0 0 2245.9 223.4 111.69