Looping #3929
Replies: 4 comments 4 replies
-
|
Can you provide more context, please? Even a code sample? It's hard for us to understand what could be going on just based on the original question. |
Beta Was this translation helpful? Give feedback.
-
|
You are a questionnaire assistant collecting 6 answers in strict order. |
Beta Was this translation helpful? Give feedback.
-
|
testing that same prompt in foundry it works but does not work with MAF |
Beta Was this translation helpful? Give feedback.
-
|
The problem is likely that the prompt relies on the model to verify its own history state ("Step A: Count how many user answers..."). LLMs are notoriously bad at counting logic within the prompt, especially if the framework (MAF) truncates or formats history differently than the Dev UI. What fixed this for me was moving progress tracking out of the prompt and into a tool. Instead of asking the LLM to count, give it a collected = {}
FIELDS = ["Full Name", "Email Address", "Department", "Project Name", "Project Description", "Target Completion Date"]
def store_answer(field: str, value: str):
collected[field] = value
remaining = [f for f in FIELDS if f not in collected]
if not remaining:
return "All 6 collected. Call GenerateXmlFile now."
return f"Stored '{value}'. NEXT STEP: Ask the user for {remaining[0]}"State should live in code, not in the prompt. That's why it works in Foundry (which likely feeds full context differently) but breaks here. The other thing that helped me was adding a runtime safety net. I kept hitting these "Q1 → Q2 → Q1" loops across different models, so I built a small middleware called Aura Guard. It detects when the agent repeats the same sequence of tool calls/questions and breaks the cycle automatically. It's framework-agnostic (works with MAF), zero-dependency, and has a "shadow mode" if you just want to see what loops it would catch without interfering. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created an agent that should ask the iser six questions and then create an xml. It ask question 1 then goes on question 2. Question 2 is answer and goes back to question 1. It is on a loop. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions