Repository navigation
Description
Overview
Optimize agent execution latency and memory footprint to ensure full multi-agent analysis completes in under 30 seconds on developer machines.
Part of Milestone v4.0.0 — Phase 21 of the Multi-Agent SRE Architecture.
⚠️ IMPORTANT CONTRIBUTOR & PR INSTRUCTIONS
TARGET BRANCH: All Pull Requests implementing this phase MUST target branch
v4.0.0(DO NOT targetmain).
PR TITLE:perf(agents): Phase 21 - Concurrency, Latency & Resource Tuning
PR SCOPE: Token budgeting, log clipping, and parameter tuning.
1. Description of What Has to Be Done
Running 4 local LLM prompts (Runtime, Config, Resource, Lead SRE) on an 8GB or 16GB developer laptop can easily exceed 60 seconds if prompts contain unneeded tokens. In Phase 21, contributors tune prompts, implement log clipping, and set optimal Ollama options.
Contributors must:
- Implement log head/tail clipping in
agents/tools/kubernetes.py: only send the first 20 and last 80 lines of logs, discarding the repetitive middle lines. - Minify specialist agent system prompts by 40% without losing diagnostic accuracy.
- Configure Ollama options: set
num_ctx: 4096to avoid default 8192 context buffer allocations in GPU VRAM. - Benchmark multi-agent execution with
llama3.1:8band verify analysis completes in < 30 seconds.
2. Desired Outcome & Expected Behavior
Expected Performance
- Memory footprint during analysis: < 6GB RAM.
- End-to-end council execution duration: < 30 seconds.
3. The Implementation Plan & Architectural Blueprint
Files to Create and Modify
[MODIFY] agents/specialists/base.py: Minify system prompts and configurenum_ctx.[MODIFY] agents/tools/kubernetes.py: Implement head/tail log clipping.[NEW] agents/tests/test_perf_budget.py: Token budget and clipping tests.
4. Detailed Task Breakdown
-
Task 21.1: Implement Log Head/Tail Bounding
- If log lines > 100, keep first 20 lines, insert
... [X lines omitted] ..., and keep last 80 lines.
- If log lines > 100, keep first 20 lines, insert
-
Task 21.2: Optimize Ollama Chat Parameters
- Set
options={"num_ctx": 4096, "temperature": 0.1, "num_predict": 512}.
- Set
-
Task 21.3: Verification Tests (
test_perf_budget.py)- Assert prompt token counts stay within budget.
5. Verification & Acceptance Checklist
- Run
python3 -m unittest agents/tests/test_perf_budget.py— all tests pass. - Multi-agent analysis completes in < 30s.
- PR targets branch
v4.0.0.
Activity
perf(agents): Phase 21 - Concurrency, Latency & Resource Tuning