agents.planning.llm_compiler.models¶
Models for the LLM Compiler agent.
This module defines the pydantic models specific to the LLM Compiler agent, integrating with the base Step and Plan models from the plan_and_execute agent.
Classes¶
Extends the base Plan model for the LLM Compiler agent. |
|
Extends the base Step model with LLM Compiler-specific fields. |
|
Represents a task in the LLM Compiler framework's DAG. |
|
The final response/answer to return to the user. |
|
The joiner's decision: either provide a final response or request replanning. |
|
Feedback for replanning when the current plan wasn't sufficient. |
|
Represents a dependency reference to another task's output. |
Module Contents¶
- class agents.planning.llm_compiler.models.CompilerPlan(/, **data)¶
Bases:
haive.agents.planning.plan_and_execute.models.Plan
Extends the base Plan model for the LLM Compiler agent.
Handles DAG execution and dependency tracking.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- add_compiler_step(step_id, description, tool_name, arguments, dependencies=None)¶
Add a new compiler step to the plan.
- Parameters:
- Returns:
The newly created step
- Return type:
- get_executable_steps(results)¶
Get steps that can be executed (all dependencies satisfied).
- get_join_step()¶
Get the join step (final step) if present.
- Return type:
CompilerStep | None
- get_step_by_id(step_id)¶
Find a step by its ID.
- Parameters:
step_id (int)
- Return type:
CompilerStep | None
- class agents.planning.llm_compiler.models.CompilerStep(/, **data)¶
Bases:
haive.agents.planning.plan_and_execute.models.Step
Extends the base Step model with LLM Compiler-specific fields.
Each step contains a task to execute and tracks dependencies.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- can_execute(results)¶
Check if all dependencies are satisfied.
- execute(tool_map, results)¶
Execute this step’s task with the given tools.
- class agents.planning.llm_compiler.models.CompilerTask(/, **data)¶
Bases:
pydantic.BaseModel
Represents a task in the LLM Compiler framework’s DAG.
Tasks define what tools to run and their dependencies on other tasks.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- resolve_arguments(results)¶
Resolve dependencies in arguments to actual values.
- class agents.planning.llm_compiler.models.FinalResponse(/, **data)¶
Bases:
pydantic.BaseModel
The final response/answer to return to the user.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.planning.llm_compiler.models.JoinerOutput(/, **data)¶
Bases:
pydantic.BaseModel
The joiner’s decision: either provide a final response or request replanning.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.planning.llm_compiler.models.Replan(/, **data)¶
Bases:
pydantic.BaseModel
Feedback for replanning when the current plan wasn’t sufficient.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.planning.llm_compiler.models.TaskDependency(/, **data)¶
Bases:
pydantic.BaseModel
Represents a dependency reference to another task’s output.
This allows for tracking references between steps in the plan.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)