Architecture
Workflow
- Generate initial hypotheses
- Simulate paths
- Reflect on errors
- Revise paths
- Select promising paths
- Synthesize solution
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Iterative hypothesis generation, simulation, and refinement through continuous cycles of testing and meta-cognitive reflection
IterativeReflectiveExpansion| Parameter | Type | Default | Description |
|---|---|---|---|
agent_name | str | "General-Reasoning-Agent" | Name of the internal reasoning agent |
description | str | "A reasoning agent that can answer questions and help with tasks." | Description of the agent’s purpose |
agent | Agent | None | Reserved for a Swarms agent instance; the constructor always builds and assigns its own internal Agent regardless of this value |
max_loops | int | 5 | Maximum number of loops for the reasoning process |
system_prompt | str | GENERAL_REASONING_AGENT_SYS_PROMPT | The system prompt for the internal agent |
model_name | str | "gpt-5.4" | The underlying language model used by the internal agent |
output_type | OutputType | "dict" | Format of the value returned by run() |
| Method | Description |
|---|---|
generate_initial_hypotheses | Generates an initial set of reasoning hypotheses based on the problem input |
simulate_path | Simulates a given reasoning path and evaluates its effectiveness |
meta_reflect | Performs meta-cognitive reflection on the provided error information |
revise_path | Revises the reasoning path based on the provided feedback |
select_promising_paths | Selects the most promising reasoning paths from a list of candidates |
synthesize_solution | Synthesizes a final solution from the promising paths and historical memory |
run | Executes the Iterative Reflective Expansion process on the provided problem |
from swarms import IterativeReflectiveExpansion
agent = IterativeReflectiveExpansion(
max_loops=3,
)
agent.run("What is the 40th prime number?")
Was this page helpful?