ReAct: decide, act, observe
ReAct alternates decisions and actions based on observed results.
What you will learn
- Explain: a bounded agent loop
- Apply the idea in an example: ReAct: decide, act, observe
- Recognize limitations and verify the exercise outcome
ReAct alternates decisions and actions based on observed results. The agent can retrieve first and answer once necessary evidence is available.
These steps refer to features identified in the application code. This material has not been validated on a live instance; check the documentation and the options in your version.
How it works, step by step
A bounded agent loop
An agent combines a model with tools, a goal and state. It observes the request, chooses a step, receives a result and decides whether to continue. A chatbot may only generate text; an agent may request an external action. Commercial definitions vary, so inspect actual control. Define success and stopping: a verified result, a maximum step count, repeated errors or an exhausted budget. Use narrow capabilities and minimal permissions. Useful autonomy means freedom within boundaries enforced by software.
The model proposes, the tool executes
Tool calling produces a call request with a name and arguments. The application validates the schema, permissions and limits before execution. The result returns to context for the next step. For example, get_product_stock takes a SKU and returns a quantity; its description should explain that it does not reserve products. Distinguish empty results, validation errors, missing access and timeouts. Valid JSON does not prove the arguments are correct or the action is authorized. For external effects, also consider duplicate execution.
A workflow has explicit structure
A node is a stage, an edge is a transition, and state carries results between stages. A workflow has an application-defined path, although the model may choose some branches. Agentic systems include both workflows and dynamically acting agents. Nymrio offers ReAct, Reflection, Sequential, Orchestrator, Router, Parallel and Plan-and-Execute. Each changes coordination; it does not automatically make a model an expert. More agents mean more calls and contracts between roles. Start with the simplest solution that passes your tests.
Detailed lab
Traced execution and instructions
Give the agent a concrete role: “Check the policy before stating a deadline. Ask for clarification if the product is unidentified. Stop after an evidence-supported answer.” RAG is the retrieval tool; the model must support tools. Select ReAct and assign the agent in the editor.
- Request: “Can I return LX-240 after 10 days?”
- Decision: the policy is needed, not generic web search.
- Action: the knowledge tool returns 14 days and conditions.
- Illustrative answer: “The stated deadline is 14 days from receipt, for an unused product in its original packaging. Contact support before shipping.”
If the tool fails, a good result acknowledges the limitation. ReAct fits cases where new evidence determines the next action; choose Sequential for fixed transformations.
The visual map
Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. On smaller screens, scroll horizontally to follow the entire diagram.
A complete example
“What return deadline applies to LX-240?” triggers policy search, observation of 14 days and an answer. A failed tool must not lead to an invented policy.
template: ReAct
agent: LunaKnowledge
stop: answer_or_execution_limit
Try it yourself
- Create a ReAct workflow with the knowledge agent and test a retrieval error.
- Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
- Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
- Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
- Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.
An explained solution
The loop stops after answering or reaching the execution limit; retrieval supports the deadline. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.
When it helps and what can go wrong
ReAct is a control pattern, not a reasoning guarantee. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.
Check your understanding
Does more autonomy always give a better result?
No. It also increases room for errors, costs and unnecessary actions.
Who executes a call proposed by the model?
The application or host service after validation. The model does not automatically gain unrestricted access.
What outcome should this exercise produce?
The loop stops after answering or reaching the execution limit; retrieval supports the deadline.
Words to remember
- Agent: A system that can choose steps and use tools toward a goal.
- Tool calling: A structured request to use an external capability.
- Nod: A stage in an execution graph.
Sources and your next step
To prepare: W01 — What is an agentic AI system?