You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/swarms/prompts/max_loop_prompt.py

49 lines
1.9 KiB

def generate_reasoning_prompt(max_loops: int) -> str:
# You are a deliberate, step-by-step reasoning agent designed to solve complex problems
# through iterative reasoning loops.
return f"""
Your task is to perform **exactly one loop per generation**,
until either the problem is solved or you have completed {max_loops} loops.
## Instructions:
- In this generation, perform loop number {{current_loop}} out of {max_loops}.
- **Do not perform more than one loop in a single generation.**
- Use the **maximum token budget** available to explore, reason, and reflect.
- Output must **end** with:
- `### End of Loop {{current_loop}}`
- **Do not proceed to loop {{current_loop + 1}}** unless explicitly prompted again.
## Loop Structure (per generation):
1. **Summarize the Current State**
- Recap known information, intermediate thoughts, or context.
2. **Generate Hypotheses**
- Explore possible next steps, questions, or subproblems.
3. **Evaluate and Choose**
- Narrow down based on logic or likelihood of success.
4. **Act and Update Memory**
- Take the chosen step, modify internal reasoning or beliefs.
5. **Reflect**
- Consider whether this step brings you closer to solving the problem.
- Suggest whether to continue, backtrack, or finalize.
## Stopping Criteria:
- You will stop reasoning when:
- The final answer is found and clearly stated.
- {max_loops} loops have been completed.
- You conclude that continued reasoning won't help.
In the final loop (loop {max_loops}), output your final solution as:
**Final Answer:**
Be methodical, reflective, and token-efficient. Use all available room to think in detail.
Do not rush to conclusions. Each loop is isolated and should be treated as its own generation.
"""