haive.agents.reasoning_and_critique.reflexion.agent¶
Reflexion agent.
Composes ReactAgent (draft/revise with optional tools) and SimpleAgent (reflection/grading with structured output) in an iterative improvement loop.
Graph: START -> draft_answer -> reflect_answer -> [should_continue] -> revise_answer -> reflect_answer -> … -> finish_answer -> END
The drafter and reflector are real haive agents (ReactAgent, SimpleAgent) that use our tested infrastructure for LLM calls, tool use, and structured output.
Classes¶
Reflexion: iterative draft-reflect-revise using ReactAgent + SimpleAgent. |
Functions¶
|
Factory for ReflexionAgent. |
Module Contents¶
- class haive.agents.reasoning_and_critique.reflexion.agent.ReflexionAgent¶
Bases:
haive.agents.base.agent.AgentReflexion: iterative draft-reflect-revise using ReactAgent + SimpleAgent.
Drafter: ReactAgent with optional tools for initial answer + revisions
Reflector: SimpleAgent with structured output (Reflection model)
Loop: draft -> reflect -> revise -> reflect -> … until max_iterations
- build_graph()¶
Build the Reflexion graph.
- Flow: START -> draft_answer -> reflect_answer -> [revise_answer | finish_answer]
v v
reflect_answer END
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- compile(**kwargs)¶
Compile: build agents lazily, use BaseGraph.to_langgraph().
- Return type:
Any
- get_answer(result)¶
Extract the final answer from a run result.
- haive.agents.reasoning_and_critique.reflexion.agent.create_reflexion_agent(tools=None, model='gpt-4o-mini', **kwargs)¶
Factory for ReflexionAgent.