# LLMCompiler

> Take ReWOO's plan-as-DAG and run independent steps in parallel through a task-fetching dispatcher.

- **Category**: Agentic AI
- **Subcategory**: Planning & Control Flow
- **Canonical URL**: https://designpattern.fyi/patterns/llm_compiler/

---

## Description
**Intent**: Take ReWOO's plan-as-DAG and run independent steps in parallel through a task-fetching dispatcher.
**Context**: A team runs an agent whose work consists of many tool calls — fetching prices for nine tickers, summarising five documents, querying three APIs — and most of those calls are independent of each other. The deployment is latency-sensitive. The team is already using a plan-then-execute style such as ReWOO, where the planner emits a dependency DAG before any tool runs.
**Solution**: - Planner builds the full dependency DAG of tool calls before any tool fires. - Task-Fetching Unit dispatches each step as soon as all its inputs are available, with bounded concurrency. - Joiner assembles the final answer from the resolved DAG once all steps complete.


## Use Cases
- Latency-sensitive agents waste time waiting on independent tool calls in series.
- A planner can build a dependency DAG up front for the workload.
- Bounded concurrency and a join step are acceptable engineering investments.





## Trade-offs


### Advantages

- End-to-end latency drops to the longest dependency chain.

- Cost remains roughly the same as ReWOO.




### Considerations & Drawbacks

- Concurrency adds operational complexity (rate limits, partial failures).

- Planner mistakes are amplified by parallel execution.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/llm-compiler/)

