agents.planning_v2.base.replanner_models

Models for the replanner component.

This module contains the Answer and Response models used by the replanner to return either a final answer or a new plan.

Classes

Answer

Simple answer response model.

Response

Generic response model that can contain different response types.

Module Contents

class agents.planning_v2.base.replanner_models.Answer(/, **data)

Bases: pydantic.BaseModel

Simple answer response model.

Used when the replanner determines that the objective has been completed and can provide a 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_v2.base.replanner_models.Response(/, **data)

Bases: pydantic.BaseModel, Generic[T]

Generic response model that can contain different response types.

This model provides a flexible container for replanner outputs, supporting either an Answer response OR a Plan response.

Examples

Answer response:
Response[Union[Answer, Plan[Task]]](

result=Answer(content=”The task is complete”), response_type=”answer”

)

Plan response:
Response[Union[Answer, Plan[Task]]](

result=Plan(objective=”Continue with phase 2”, steps=[…]), response_type=”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)

is_answer()

Check if this is an answer response.

Return type:

bool

is_plan()

Check if this is a plan response.

Return type:

bool