perf(agent): reduce LLM workflow overhead - #138
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe agent pipeline now supplies column digests, uses a four-tool LLM workflow, performs coverage improvement in deterministic supervisor code, compacts valid configurations, and records compact audit and configuration-size metrics. ChangesAgent workflow redesign
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in the reviewed changes. Sequence Diagram(s)sequenceDiagram
participant Agent
participant build_and_audit
participant Supervisor
participant map_coverage
participant propose_config_edit
Agent->>build_and_audit: validate derived configuration
build_and_audit-->>Agent: return compact audit observation
Agent-->>Supervisor: return configuration and audit result
Supervisor->>map_coverage: inspect coverage gaps
map_coverage-->>Supervisor: return coverage feedback
Supervisor->>propose_config_edit: generate ranked candidate edits
propose_config_edit-->>Supervisor: return candidate configuration
Supervisor->>build_and_audit: evaluate candidate build
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
# Conflicts: # tests/test_agent_supervisor.py
Cut 16.6.1 and bump the package version in pyproject.toml, uv.lock, and CITATION.cff. Patch: the agent's LLM workflow carries a far smaller tool surface, tighter injected context, and smaller persisted configs (#138). Full mode registers exactly four tools — read_table, pmc_article_context, derive_config, build_and_audit — because coverage improvement moved into deterministic supervisor code: map_coverage and propose_config_edit are pure helpers the supervisor calls in its own improve loop, and only the opt-in --reflexion path still spends an LLM call on improvement. Task text now injects bounded per-column column_digest separator statistics (first 500 data rows), so the canonical derive → build → answer path is three steps or fewer with zero inspection tool calls, and the agent rebuilds only on a coded build error, at most twice. The LLM sees a compact twelve-key build_and_audit observation (unresolved capped at 20 with a visible +N more marker) while the supervisor keeps the full report, and the accepted best config is compacted deterministically before persistence (compact_config strips keys equal to their Pydantic defaults; the accuracy-invariance test pins the identical KGX and quality_score, and failure falls back to the exact original config). state.json now records config_chars per article. Builds, scores, and persisted configs remain behaviorally equivalent. Changelog: - Versioned the changelog as 16.6.1 and wrote the Performance entry for the agent workflow redesign (#138). No other entries were pending — nothing else has merged since 16.6.0. Docs: docs/agent.md was updated by #138 itself (revised workflow, context injection, and config persistence sections); the release needs none beyond the changelog. Testing: - uv run pytest -q -> 1248 passed, 3 skipped (96% coverage) - uv run ruff check . && uv run ruff format --check . && uv run pyright -> clean / 0 errors - uv lock --check -> up to date - uv run mkdocs build --strict -> clean
Reduces agent workflow overhead by moving inspection context and coverage improvement into deterministic supervisor code. The LLM receives a smaller tool surface and bounded context while builds, scores, and persisted configs remain behaviorally equivalent.
LLM Workflow
make_tools(full)exposes exactlyread_table,pmc_article_context,derive_config, andbuild_and_audit; derive-only modes remain unchanged.Audit and Persistence
build_and_auditreport remains complete.config_charsfor the exact persisted configuration.Measurement
FakeModelworkflow metrics and pre-redesign budget baselines.Design
The redesign deliberately keeps coverage and proposal helpers in the deterministic supervisor rather than exposing them to the LLM, reducing tool churn without removing existing derive modes. Live-model validation and GEPA re-optimization are deferred; all current efficiency evidence is hermetic and offline.
Docs
docs/agent.mdwith the revised workflow, context injection, and config persistence behavior.Testing
uv run pytest -n 0→ 1230 passed, 17 skippeduv run pytest tests/test_agent_compact.py tests/test_agent_supervisor.py -q→ 56 passeduv run ruff check .→ all checks passeduv run ruff format --check .→ 83 files already formatteduv run pyright→ 0 errors, 0 warnings, 0 informationsSummary by CodeRabbit
New Features
Improvements
Documentation