agents.reasoning_and_critique.self_discover.self_discover_sequential_v2

Self-Discover Sequential Agent V2 - Proper implementation following CLAUDE.md patterns.

This implementation: 1. Uses SimpleAgentV3 for enhanced features 2. No custom __init__ overrides 3. Uses MultiAgent for sequential composition 4. Consolidates Pydantic models to avoid conflicts 5. Follows “no mocks” testing philosophy

Classes

AdaptedModule

An adapted version of a reasoning module for a specific task.

ExecutionStep

A completed step in the reasoning process.

ModuleAdaptationResult

Result of the module adaptation stage.

ModuleSelectionResult

Result of the module selection stage.

ReasoningExecution

Complete reasoning execution with all steps and final answer.

ReasoningStep

A step in the reasoning plan.

ReasoningStructure

A structured reasoning plan.

SelectedModule

A reasoning module selected for a specific problem.

Functions

create_adapter_agent()

Create the adapter agent with proper configuration.

create_executor_agent()

Create the executor agent with proper configuration.

create_selector_agent()

Create the selector agent with proper configuration.

create_self_discover_sequential()

Create the complete Self-Discover sequential workflow.

create_structurer_agent()

Create the structurer agent with proper configuration.

main()

Example of using the Self-Discover sequential agent.

Module Contents

class agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.AdaptedModule(/, **data)

Bases: pydantic.BaseModel

An adapted version of a reasoning module for a specific task.

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.reasoning_and_critique.self_discover.self_discover_sequential_v2.ExecutionStep(/, **data)

Bases: pydantic.BaseModel

A completed step in the reasoning process.

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.reasoning_and_critique.self_discover.self_discover_sequential_v2.ModuleAdaptationResult(/, **data)

Bases: pydantic.BaseModel

Result of the module adaptation stage.

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)

format_for_structurer()

Format adapted modules for the structurer stage.

Return type:

str

class agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.ModuleSelectionResult(/, **data)

Bases: pydantic.BaseModel

Result of the module selection stage.

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)

format_for_adapter()

Format selected modules for the adapter stage.

Return type:

str

classmethod validate_modules(modules)

Ensure we have 3-5 modules.

Parameters:

modules (list[SelectedModule])

Return type:

list[SelectedModule]

class agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.ReasoningExecution(/, **data)

Bases: pydantic.BaseModel

Complete reasoning execution with all steps and 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.reasoning_and_critique.self_discover.self_discover_sequential_v2.ReasoningStep(/, **data)

Bases: pydantic.BaseModel

A step in the reasoning 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.reasoning_and_critique.self_discover.self_discover_sequential_v2.ReasoningStructure(/, **data)

Bases: pydantic.BaseModel

A structured reasoning 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)

format_for_executor()

Format reasoning structure for the executor.

Return type:

str

classmethod validate_steps(steps)

Ensure steps are properly numbered.

Parameters:

steps (list[ReasoningStep])

Return type:

list[ReasoningStep]

class agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.SelectedModule(/, **data)

Bases: pydantic.BaseModel

A reasoning module selected for a specific problem.

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)

agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.create_adapter_agent()

Create the adapter agent with proper configuration.

Return type:

haive.agents.simple.agent.SimpleAgent

agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.create_executor_agent()

Create the executor agent with proper configuration.

Return type:

haive.agents.simple.agent.SimpleAgent

agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.create_selector_agent()

Create the selector agent with proper configuration.

Return type:

haive.agents.simple.agent.SimpleAgent

agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.create_self_discover_sequential()

Create the complete Self-Discover sequential workflow.

This follows the proper pattern from CLAUDE.md: - Uses MultiAgent for composition - No custom classes or __init__ overrides - Clear sequential execution - Proper state handling between agents

Returns:

MultiAgent configured for Self-Discover workflow

Return type:

haive.agents.multi.agent.MultiAgent

agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.create_structurer_agent()

Create the structurer agent with proper configuration.

Return type:

haive.agents.simple.agent.SimpleAgent

async agents.reasoning_and_critique.self_discover.self_discover_sequential_v2.main()

Example of using the Self-Discover sequential agent.