feat(zeph-core): intra-turn parallel tool dispatch via dependency DAG (LLMCompiler)#1712
Merged
feat(zeph-core): intra-turn parallel tool dispatch via dependency DAG (LLMCompiler)#1712
Conversation
This was referenced Mar 13, 2026
… (LLMCompiler) Implements LLMCompiler-style parallel tool execution within a single agent turn. Independent tool calls now execute concurrently; calls that reference another call's tool_use_id as an argument value execute in topological tiers. - Add `crates/zeph-core/src/agent/tool_execution/tool_call_dag.rs`: `ToolCallDag` builds a dependency graph via Kahn's algorithm, partitions calls into tiers, detects cycles (falls back to full sequential execution with a warning) - Modify `handle_native_tool_calls` in `native.rs`: tier-based dispatch with per-tier `join_all`, cancel token propagation, `ToolStartEvent` per tier, TUI status messages for multi-tier batches, synthetic errors for dependents of failed/ConfirmationRequired prerequisite calls - Dependency detection uses exact whole-value matching (not substring) to avoid false positives with short Ollama-style integer IDs Closes #1646
097826a to
b07e566
Compare
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.
Summary
Implements LLMCompiler-style parallel tool execution within a single agent turn (issue #1646).
ToolCallDag(tool_call_dag.rs): builds a dependency graph fromtool_use_idreferences in tool arguments using Kahn's algorithm, partitions calls into topological tiers. Exact whole-value matching prevents false positives with short Ollama integer IDs.handle_native_tool_calls: calls in each tier execute concurrently viajoin_all; dependent calls wait for the previous tier; failed/ConfirmationRequired calls propagate a synthetic error to their dependents.warn!log entry."Executing tool tier N/M…"messages for multi-tier batches.Test plan
tool_call_dag.rscovering: trivial fast path, linear chain, diamond DAG, cycle fallback, Ollama short-ID no-false-positive, nested JSON traversal, self-reference, ConfirmationRequired propagationcargo nextest run --workspace --features full: 5359 passed (+327 vs main)cargo clippy --workspace --features full -- -D warnings: cleancargo +nightly fmt --check: cleanFollow-up issues (deferred from this PR)
ToolCallDagto avoid double scan (PERF-02, low)collect_stringsrecursion (PERF-03, low)ToolStartEventfor pre-failed dependent tools (M3, cosmetic)Closes #1646