agents.planning.rewoo.models.steps

Step Models for ReWOO Planning.

Abstract step class and concrete implementations with computed fields and validators.

Classes

AbstractStep

Abstract base step that other steps inherit from.

BasicStep

Basic concrete implementation for testing.

Module Contents

class agents.planning.rewoo.models.steps.AbstractStep(/, **data)

Bases: pydantic.BaseModel, abc.ABC

Abstract base step that other steps inherit from.

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)

abstractmethod can_execute(completed_steps)

Check if this step can execute given completed steps.

Parameters:

completed_steps (set[str])

Return type:

bool

abstractmethod execute(context)

Execute this step with given context.

Parameters:

context (dict[str, Any])

Return type:

Any

classmethod validate_dependencies(v)

Validate dependency IDs.

Parameters:

v (list[str])

Return type:

list[str]

classmethod validate_id(v)

Validate step ID format.

Parameters:

v (str)

Return type:

str

property dependency_count: int

Number of dependencies.

Return type:

int

property has_dependencies: bool

Whether this step has dependencies.

Return type:

bool

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class agents.planning.rewoo.models.steps.BasicStep(/, **data)

Bases: AbstractStep

Basic concrete implementation for testing.

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(completed_steps)

Basic implementation - all dependencies must be completed.

Parameters:

completed_steps (set[str])

Return type:

bool

execute(context)

Basic execution - just return the description.

Parameters:

context (dict[str, Any])

Return type:

Any