agents.multi.enhanced_sequential_agent¶
Enhanced SequentialAgent implementation using Agent[AugLLMConfig].
SequentialAgent = Agent[AugLLMConfig] + sequential execution of agents.
Classes¶
Init . |
|
Enhanced SequentialAgent that executes agents in sequence. |
Module Contents¶
- class agents.multi.enhanced_sequential_agent.MockAgent(name, transform)¶
Init .
- class agents.multi.enhanced_sequential_agent.SequentialAgent¶
Bases:
haive.agents.simple.enhanced_simple_real.EnhancedAgentBase
Enhanced SequentialAgent that executes agents in sequence.
SequentialAgent = Agent[AugLLMConfig] + sequential pipeline execution.
Each agent’s output becomes the next agent’s input, creating a pipeline. The coordinator (this agent) can optionally process results between steps.
- agents¶
List of agents to execute in order
- process_between_steps¶
Whether to process between agent calls
- continue_on_error¶
Whether to continue if an agent fails
- return_all_outputs¶
Return all intermediate outputs vs just final
Examples
Simple pipeline:
# Create pipeline: Researcher -> Analyst -> Writer pipeline = SequentialAgent( name="report_pipeline", agents=[ ResearchAgent(name="researcher"), AnalystAgent(name="analyst"), WriterAgent(name="writer") ] ) result = pipeline.run("Create report on AI trends") # Researcher finds data -> Analyst processes -> Writer creates report
With intermediate processing:
pipeline = SequentialAgent( name="enhanced_pipeline", agents=[research_agent, analysis_agent], process_between_steps=True, system_message="Enhance and clarify outputs between steps" ) # Coordinator enhances outputs between each step
- add_agent(agent)¶
Add an agent to the end of the sequence.
- Parameters:
agent (haive.agents.simple.enhanced_simple_real.EnhancedAgentBase) – Agent to add to pipeline
- Return type:
None
- build_graph()¶
Build sequential execution graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- async execute_sequence(input_data)¶
Execute agents in sequence.
- Parameters:
input_data (Any) – Initial input for the pipeline
- Returns:
Final output or list of all outputs
- Return type:
Any | list[Any]
- insert_agent(index, agent)¶
Insert an agent at specific position.
- Parameters:
index (int) – Position to insert at
agent (haive.agents.simple.enhanced_simple_real.EnhancedAgentBase) – Agent to insert
- Return type:
None
- remove_agent(index)¶
Remove agent at index.
- Parameters:
index (int) – Position to remove from
- Returns:
Removed agent or None
- Return type:
haive.agents.simple.enhanced_simple_real.EnhancedAgentBase | None
- setup_agent()¶
Setup sequential coordinator.
- Return type:
None