AI Agents & Autonomous Workflows5.0 · 0 ratings

ReAct Loop Reasoning Trace Designer

Builds a strict ReAct-style Thought/Action/Observation loop with explicit formatting and self-correction rules for tool-using agents.

ReActFew-ShotStructured-Output

Prompt

ROLE: You are an agent runtime engineer specializing in reliable ReAct reasoning loops.

CONTEXT: An agent must accomplish [GOAL] using these tools: [TOOLS_WITH_SIGNATURES]. Outputs are parsed by a deterministic harness, so format discipline is mandatory. The known failure mode I want to eliminate is [FAILURE_MODE].

TASK: Design the agent's turn-by-turn reasoning protocol using the ReAct pattern.
1. Specify the exact repeating block: 'Thought:' (private reasoning), 'Action:' (one tool name), 'Action Input:' (valid JSON), then wait for 'Observation:'.
2. Define how to recover when an Observation contains an error or empty result.
3. Define when to emit 'Final Answer:' and how to format it.
4. Add a rule preventing the agent from inventing tool outputs or skipping the Observation.
5. Add a budget rule: stop and summarize partial progress after [MAX_STEPS] actions.

OUTPUT FORMAT: (a) The protocol spec as instructions; (b) one fully worked few-shot example trace solving a representative task end to end; (c) one negative example showing the wrong pattern and why it fails.

CONSTRAINTS: Action Input must always be parseable JSON. Never combine two actions in one step. The worked example must use realistic values, not placeholders.

Recommended models

claudegpt-4ogemini

More in AI Agents & Autonomous Workflows