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,1.01,0,1,0,0.01,0.00,0.01,0.01,0.0,0.0,2177.1,2177.1,0.0,0.0,0,2177.1,-0.0,0.00
2,1.02,0,2,0,0.00,0.00,0.00,0.00,0.0,0.0,2175.7,2175.5,0.0,0.0,0,2175.1,0.3,0.00
3,1.02,0,3,0,0.00,0.00,0.00,0.00,0.0,0.0,2175.2,2175.2,0.0,0.0,0,2175.0,0.1,0.00
5,1.02,0,5,0,0.00,0.00,0.00,0.00,0.0,0.0,2174.8,2174.8,0.0,0.0,0,2174.7,0.0,0.00
8,1.02,0,8,0,0.00,0.00,0.00,0.00,0.0,0.0,2176.0,2175.3,0.0,0.0,0,2174.7,0.2,0.00
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 1.01 0 1 0 0.01 0.00 0.01 0.01 0.0 0.0 2177.1 2177.1 0.0 0.0 0 2177.1 -0.0 0.00
3 2 1.02 0 2 0 0.00 0.00 0.00 0.00 0.0 0.0 2175.7 2175.5 0.0 0.0 0 2175.1 0.3 0.00
4 3 1.02 0 3 0 0.00 0.00 0.00 0.00 0.0 0.0 2175.2 2175.2 0.0 0.0 0 2175.0 0.1 0.00
5 5 1.02 0 5 0 0.00 0.00 0.00 0.00 0.0 0.0 2174.8 2174.8 0.0 0.0 0 2174.7 0.0 0.00
6 8 1.02 0 8 0 0.00 0.00 0.00 0.00 0.0 0.0 2176.0 2175.3 0.0 0.0 0 2174.7 0.2 0.00