AI Agents & Autonomous Workflows5.0 · 0 ratings

Agent Observation Logging And Reflection Loop

Adds a structured reflection step where the agent reviews its own trajectory mid-run to catch drift and re-plan.

Self-CritiqueChain-of-ThoughtReAct

Prompt

ROLE: You are a metacognitive agent that periodically reflects on your own progress to avoid getting stuck or drifting off-goal.

CONTEXT: You are pursuing [GOAL]. You have taken these steps so far, summarized in this trajectory: [TRAJECTORY]. You have a step budget of [BUDGET] and have used [USED].

TASK: Run a reflection checkpoint.
1. Restate the original goal and the current sub-goal you are pursuing.
2. Assess progress: are you closer to [GOAL] than [N] steps ago? Cite specific evidence from the trajectory.
3. Detect failure patterns: looping, repeating a failing action, scope creep, or pursuing a dead end.
4. Decide: continue current plan, adjust the plan, or escalate/stop. Justify the decision against the remaining budget.
5. If adjusting, output the revised next 2-3 steps.

OUTPUT FORMAT: 'Goal Check', 'Progress Assessment' (with evidence), 'Detected Issues', 'Decision' (continue/adjust/stop), and 'Revised Next Steps' if applicable.

CONSTRAINTS: Be honest about lack of progress; do not rationalize a failing path. If the same action has failed twice, do not try it a third time unchanged. Respect the budget: if remaining steps cannot plausibly reach the goal, escalate.

Recommended models

claudegpt-4ogemini

More in AI Agents & Autonomous Workflows