AI-ENGINEERING
    intermediate

    AI Agent Loop (ReAct)

    AI Engineer path · lesson 81 of 124
    The idea
    A ReAct agent is a detective thinking aloud: 'I need the capital' (thought), checks a reference (action), reads 'Paris' (observation), then repeats — closing the case only when the clues add up.
    How to use
    Step through the Thought → Action → Observation loop one iteration at a time to see how the agent converges on an answer.
    TaskWhat is the population of the capital of France, times two?
    iter 0
    ThoughtActionObservationiteration0

    Press Run to watch the agent loop.

    Key insight

    An agent is tool calling in a loop: think, act, observe, repeat. The model itself picks each next action from what it has observed — and stops by emitting a final answer instead of another action. Bound the loop, or it can spin.

    One turn of the ReAct loop

    Sequence

    Order a single iteration.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    What are the three repeating parts of a ReAct step?

    The short version

    A ReAct agent is a detective thinking aloud: "I need the capital" (thought), checks a reference (action), reads "Paris" (observation), then repeats — closing the case only when the clues add up.

    In more depth

    AI Agent Loop (ReAct)

    ReAct (Reason + Act) interleaves reasoning and tool use: each iteration the model writes a Thought, takes an Action (tool call), reads the Observation (result), and loops — until it emits a Final Answer instead of another action. It's tool calling in a loop, steered by the model's own reasoning. Bound the loop (max steps) and guard tool use, or the agent can spin or act unintentionally.

    Interview Questions

    Anthropic
    OpenAI
    Google
    Anthropic
    OpenAI
    OpenAI
    Anthropic
    Stripe
    Anthropic
    Databricks

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required