agents.planning.p_and_e.modelsΒΆ
Models for Plan and Execute Agent System.
This module defines the data models for planning, execution, and replanning in the Plan and Execute agent architecture.
ClassesΒΆ
Action to perform - either respond with answer or continue with plan. |
|
Result from executing a single step. |
|
Complete execution plan with steps and metadata. |
|
Individual step in an execution plan. |
|
Decision on whether to replan or provide final answer. |
|
Response to user with final answer. |
|
Status of a plan step. |
|
Type of plan step. |
Module ContentsΒΆ
- class agents.planning.p_and_e.models.Act(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Action to perform - either respond with answer or continue with 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)
- class agents.planning.p_and_e.models.ExecutionResult(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Result from executing a single step.
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.p_and_e.models.Plan(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Complete execution plan with steps and metadata.
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)
- get_step(step_id)ΒΆ
Get a specific step by ID.
- serialize_datetime(dt)ΒΆ
Serialize datetime fields to ISO format.
- Parameters:
dt (datetime.datetime)
- Return type:
- update_step_status(step_id, status, result=None, error=None)ΒΆ
Update the status of a specific step.
- Parameters:
step_id (int)
status (StepStatus)
result (str | None)
error (str | None)
- Return type:
- classmethod validate_dependencies(steps)ΒΆ
Ensure dependencies reference valid step IDs.
- classmethod validate_step_ids(steps)ΒΆ
Ensure step IDs are sequential starting from 1.
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.planning.p_and_e.models.PlanStep(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Individual step in an execution 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)
- serialize_datetime(dt)ΒΆ
Serialize datetime fields to ISO format.
- Parameters:
dt (datetime.datetime | None)
- Return type:
str | None
- property execution_time: float | NoneΒΆ
Calculate execution time in seconds.
- Return type:
float | None
- property is_ready: boolΒΆ
Check if step is ready to execute (all dependencies completed).
- Return type:
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.planning.p_and_e.models.ReplanDecision(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Decision on whether to replan or provide final answer.
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)
- validate_decision_fields()ΒΆ
Ensure required fields are present based on decision.
- Return type:
- class agents.planning.p_and_e.models.Response(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Response to user with final answer.
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.p_and_e.models.StepStatusΒΆ
-
Status of a plan step.
Initialize self. See help(type(self)) for accurate signature.