feat: parallel tool execution + model-aware safety buffer (closes #1, #2)#4
Merged
Merged
Conversation
Add parallel_ok field to Capability struct (default false, set true for read-only tools safe for concurrent execution). Refactor loop_runner tool execution into 3 phases: - Phase 1: sequential pre-confirmation (unchanged) - Phase 2: parallel execution via FuturesUnordered for parallel_ok tools with cancellation support and partial result capture - Phase 3: sequential post-execution with original-order results Add is_parallel_ok callback parameter to run_agent_loop to decouple from capability registry — each app passes a closure reading its own registry, fixing the disconnected-registry bug. Closes #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements #1 (parallel tool execution) and #2 (model-aware compact safety buffer).
#1 — Parallel tool execution
Add
parallel_okfield toCapability. Refactorloop_runnerinto 3 phases: pre-confirm (seq) → parallel/seq exec viaFuturesUnordered→ post-result (seq).is_parallel_okcallback decouples from registry.#2 — Model-aware safety buffer
Replace flat
SAFETY_BUFFER_TOKENS = 13,000with tieredsafety_buffer_for_window():Replace flat
DEFAULT_COMPACT_RATIO = 0.75with tieredcompact_ratio_for_window():compact_trigger_thresholdnow accepts&ModelSpecinstead of raw capacity.Verification