agents.planning.llm_compiler.agent¶
LLM Compiler Agent Implementation.
from typing import Any, Dict This implementation follows the LLM Compiler architecture from the paper by Kim et al., focusing on parallelizable task execution through a DAG structure.
Classes¶
LLM Compiler Agent implementation. |
Functions¶
|
Main. |
Module Contents¶
- class agents.planning.llm_compiler.agent.LLMCompilerAgent(config)¶
Bases:
haive.core.engine.agent.agent.AgentArchitecture
LLM Compiler Agent implementation.
This agent architecture has three main components: 1. Planner: Creates a task DAG 2. Task Executor: Executes tasks as their dependencies are satisfied 3. Joiner: Processes results and decides whether to output an answer or replan
Initialize the LLM Compiler agent.
- Parameters:
config (agents.planning.llm_compiler.config.LLMCompilerAgentConfig)
- async arun(query)¶
Run the agent asynchronously.
- Parameters:
query (str) – The user’s query
- Returns:
Response from the agent
- execute_tasks(state)¶
Execute tasks in parallel as their dependencies are satisfied.
- join(state)¶
Process the results and decide whether to provide a final answer or replan.
- plan(state)¶
Generate a plan based on the user’s query.
- run(query)¶
Run the agent on a query.
- Parameters:
query (str) – The user’s query
- Returns:
Response from the agent
- setup_workflow()¶
Set up the agent workflow as a state graph.
- Return type:
Any
- should_execute_more(state, config=None)¶
Determine the next execution step.
- Parameters:
state (CompilerState) – The current agent state.
config (Optional[Any]) – Execution configuration (not used but required).
- Returns:
The next node to execute in the state graph.
- Return type:
- agents.planning.llm_compiler.agent.main()¶
Main.
- Returns:
Add return description]
- Return type:
[TODO