agents.patterns.react_structured_reflection_patterns¶
Comprehensive ReactAgent → SimpleAgent Patterns with V3, V4, and Enhanced Base Agent.
This demonstrates all variations of ReactAgent → SimpleAgent workflows: 1. V3: ReactAgent → SimpleAgent (structured output) 2. V4: MultiAgent composition 3. Enhanced Base: Using enhanced base agent with hooks 4. Reflection: ReactAgent → SimpleAgentV3 → ReflectionAgent 5. Graded Reflection: ReactAgent → GradingAgent → SimpleAgentV3 → ReflectionAgent
Each pattern showcases the generalized hook system and different architectural approaches.
Classes¶
Structured problem analysis. |
|
V3 Pattern: ReactAgent → SimpleAgentV3 with structured output. |
|
V4 Pattern: MultiAgent with ReactAgent → SimpleAgentV3. |
|
Graded Reflection Pattern: ReactAgent → GradingAgent → SimpleAgentV3 → ReflectionAgent. |
|
Enhanced Base Agent Pattern: ReactAgent → SimpleAgentV3 → ReflectionAgent. |
|
Structured research findings. |
|
Analysis of a complex task. |
Functions¶
|
Create graded reflection pattern. |
|
Create Enhanced Base Agent pattern with reflection. |
|
Create V3 pattern: ReactAgent → SimpleAgentV3. |
|
Create V4 pattern: MultiAgent composition. |
|
Analyze data and extract insights. |
Example: Graded Reflection Pattern. |
|
Example: Enhanced Base Agent with Reflection. |
|
Example: V3 Architecture Pattern. |
|
Example: V4 Architecture Pattern. |
|
|
Run all pattern examples. |
|
Analyze stakeholders for a given context. |
|
Research a topic using web sources. |
Module Contents¶
- class agents.patterns.react_structured_reflection_patterns.ProblemAnalysis(/, **data)¶
Bases:
pydantic.BaseModel
Structured problem analysis.
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.patterns.react_structured_reflection_patterns.ReactToStructuredV3(name, tools=None, structured_output_model=TaskAnalysis, reasoning_config=None, structuring_config=None)¶
V3 Pattern: ReactAgent → SimpleAgentV3 with structured output.
Init .
- Parameters:
name (str) – [TODO: Add description]
tools (list | None) – [TODO: Add description]
structured_output_model (type[pydantic.BaseModel]) – [TODO: Add description]
reasoning_config (haive.core.engine.aug_llm.AugLLMConfig) – [TODO: Add description]
structuring_config (haive.core.engine.aug_llm.AugLLMConfig) – [TODO: Add description]
- class agents.patterns.react_structured_reflection_patterns.ReactToStructuredV4(**data)¶
Bases:
haive.agents.multi.agent.MultiAgent
V4 Pattern: MultiAgent with ReactAgent → SimpleAgentV3.
Init .
- classmethod create_analysis_workflow(name='v4_analysis', tools=None, structured_output_model=TaskAnalysis)¶
Create V4 analysis workflow.
- Parameters:
- Return type:
- class agents.patterns.react_structured_reflection_patterns.ReactWithGradedReflection(name, tools=None, structured_output_model=TaskAnalysis)¶
Graded Reflection Pattern: ReactAgent → GradingAgent → SimpleAgentV3 → ReflectionAgent.
Init .
- Parameters:
- class agents.patterns.react_structured_reflection_patterns.ReactWithReflection(name, tools=None, structured_output_model=TaskAnalysis, reasoning_config=None, structuring_config=None)¶
Enhanced Base Agent Pattern: ReactAgent → SimpleAgentV3 → ReflectionAgent.
Init .
- Parameters:
name (str) – [TODO: Add description]
tools (list | None) – [TODO: Add description]
structured_output_model (type[pydantic.BaseModel]) – [TODO: Add description]
reasoning_config (haive.core.engine.aug_llm.AugLLMConfig) – [TODO: Add description]
structuring_config (haive.core.engine.aug_llm.AugLLMConfig) – [TODO: Add description]
- class agents.patterns.react_structured_reflection_patterns.ResearchFindings(/, **data)¶
Bases:
pydantic.BaseModel
Structured research findings.
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.patterns.react_structured_reflection_patterns.TaskAnalysis(/, **data)¶
Bases:
pydantic.BaseModel
Analysis of a complex 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)
- agents.patterns.react_structured_reflection_patterns.create_graded_reflection_pattern(name='react_graded_reflection', tools=None, structured_output_model=TaskAnalysis)¶
Create graded reflection pattern.
- Parameters:
- Return type:
- agents.patterns.react_structured_reflection_patterns.create_reflection_pattern(name='react_with_reflection', tools=None, structured_output_model=TaskAnalysis)¶
Create Enhanced Base Agent pattern with reflection.
- Parameters:
- Return type:
- agents.patterns.react_structured_reflection_patterns.create_v3_pattern(name='react_structured_v3', tools=None, structured_output_model=TaskAnalysis)¶
Create V3 pattern: ReactAgent → SimpleAgentV3.
- Parameters:
- Return type:
- agents.patterns.react_structured_reflection_patterns.create_v4_pattern(name='react_structured_v4', tools=None, structured_output_model=TaskAnalysis)¶
Create V4 pattern: MultiAgent composition.
- Parameters:
- Return type:
- agents.patterns.react_structured_reflection_patterns.data_analysis(data_description)¶
Analyze data and extract insights.
- async agents.patterns.react_structured_reflection_patterns.example_graded_reflection_pattern()¶
Example: Graded Reflection Pattern.
- async agents.patterns.react_structured_reflection_patterns.example_reflection_pattern()¶
Example: Enhanced Base Agent with Reflection.
- async agents.patterns.react_structured_reflection_patterns.example_v3_pattern()¶
Example: V3 Architecture Pattern.
- async agents.patterns.react_structured_reflection_patterns.example_v4_pattern()¶
Example: V4 Architecture Pattern.
- async agents.patterns.react_structured_reflection_patterns.main()¶
Run all pattern examples.
- agents.patterns.react_structured_reflection_patterns.stakeholder_analysis(context)¶
Analyze stakeholders for a given context.