agents.patterns.react_with_structured_output¶
ReactAgent with Structured Output Pattern.
This pattern demonstrates ReactAgent → SimpleAgentV3 sequential execution using the generalized hook system for structured output workflows.
Pattern: ReactAgent (reasoning/tools) → SimpleAgent (structured output) Use Cases: - Analysis with structured results - Research with formatted reports - Problem-solving with structured solutions - Tool-based workflows with typed outputs
Classes¶
Structured analysis result. |
|
Structured problem solution. |
|
ReactAgent → SimpleAgentV3 with structured output pattern. |
|
Structured research report. |
Functions¶
|
Calculate mathematical expressions. |
|
Create a ReactAgent analysis workflow with structured output. |
|
Create a ReactAgent problem-solving workflow with structured output. |
|
Create a ReactAgent research workflow with structured output. |
|
Analyze data and provide insights. |
Example: ReactAgent analysis with structured output. |
|
Example: ReactAgent problem-solving with structured solution. |
|
Example: ReactAgent research with structured report. |
|
|
Run all workflow examples. |
|
Search the web for information. |
Module Contents¶
- class agents.patterns.react_with_structured_output.AnalysisResult(/, **data)¶
Bases:
pydantic.BaseModel
Structured analysis result.
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_with_structured_output.ProblemSolution(/, **data)¶
Bases:
pydantic.BaseModel
Structured problem solution.
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_with_structured_output.ReactWithStructuredOutput(**data)¶
Bases:
haive.agents.multi.agent.MultiAgent
ReactAgent → SimpleAgentV3 with structured output pattern.
This pattern uses ReactAgent for reasoning and tool usage, then SimpleAgentV3 for converting the results to structured output.
Initialize the pattern with agents.
- classmethod create_analysis_pattern(name='analysis_workflow', tools=None, reasoning_config=None, structuring_config=None)¶
Create a ReactAgent → StructuredOutput pattern for analysis tasks.
- Parameters:
- Returns:
Configured ReactWithStructuredOutput instance
- Return type:
- classmethod create_problem_solving_pattern(name='problem_solving_workflow', tools=None, reasoning_config=None, structuring_config=None)¶
Create a ReactAgent → StructuredOutput pattern for problem-solving tasks.
- Parameters:
- Return type:
- classmethod create_research_pattern(name='research_workflow', tools=None, reasoning_config=None, structuring_config=None)¶
Create a ReactAgent → StructuredOutput pattern for research tasks.
- Parameters:
- Return type:
- class agents.patterns.react_with_structured_output.ResearchReport(/, **data)¶
Bases:
pydantic.BaseModel
Structured research report.
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_with_structured_output.calculator(expression)¶
Calculate mathematical expressions.
- agents.patterns.react_with_structured_output.create_react_analysis_workflow(name='react_analysis', tools=None)¶
Create a ReactAgent analysis workflow with structured output.
- Parameters:
- Returns:
Configured analysis workflow
- Return type:
- agents.patterns.react_with_structured_output.create_react_problem_solving_workflow(name='react_problem_solver', tools=None)¶
Create a ReactAgent problem-solving workflow with structured output.
- Parameters:
- Returns:
Configured problem-solving workflow
- Return type:
- agents.patterns.react_with_structured_output.create_react_research_workflow(name='react_research', tools=None)¶
Create a ReactAgent research workflow with structured output.
- Parameters:
- Returns:
Configured research workflow
- Return type:
- agents.patterns.react_with_structured_output.data_analyzer(data)¶
Analyze data and provide insights.
- async agents.patterns.react_with_structured_output.example_analysis_workflow()¶
Example: ReactAgent analysis with structured output.
- async agents.patterns.react_with_structured_output.example_problem_solving_workflow()¶
Example: ReactAgent problem-solving with structured solution.
- async agents.patterns.react_with_structured_output.example_research_workflow()¶
Example: ReactAgent research with structured report.
- async agents.patterns.react_with_structured_output.main()¶
Run all workflow examples.