3.6 Agent Architecture and Flow Diagram
In traditional AI agent design, one often discusses the Sense–Think–Act loop: the agent senses its environment, thinks or plans, and then acts. Modern language-model agents still follow a loop but with a twist.
Instead of separating decision-making from execution, these agents use a ReAct architecture which stands for Reasoning + Acting. They combine chain-of-thought reasoning with actions in an iterative cycle. In simple terms, the agent reasons out loud about what to do, takes an action, then observes the result and uses it to inform the next step. This creates a dynamic feedback loop rather than a one-and-done plan.

To understand the ReAct flow more concretely, let’s break down the loop into its steps:
- Query (input): The agent observes some input or perceives the environment.
- Thought (reasoning): The agent’s LLM thinks about the problem and the current context. This is a chain-of-thought reasoning step where the agent might, for example, plan an approach or formulate a query.
- Action (tool/API call): Based on its thought, the agent decides on an action. This could be calling an external tool or API, querying a database, running a calculation, or any operation that helps achieve the task.
- Observation (output): After the action, the agent gets an observation, basically the result or output of that action.
- Loop (reason → act again): With that new observation in hand, the agent goes back to another Thought step, reasoning about what to do next. The cycle then repeats again and again. This iterative loop continues until the agent determines it has solved the problem or met the goal.
- Final answer (terminate): Eventually, the agent’s reasoning will conclude that it has found a good answer or completed the task. At that point, instead of proposing another action, it will produce a final answer or perform a final act. This terminates the ReAct loop.
Modern LLM-based agents, therefore, tend to be more robust and adaptable thanks to this architecture. They don’t have to know everything up front; they can figure things out step by step, using tools when needed.
Large Language Models (LLMs)
A large language model is a type of AI trained to understand and generate human language. Its main job is to process, predict, and produce text that sounds natural, whether that’s writing an email, answering questions, or summarizing information.
Behind the scenes, LLMs rely on deep learning and neural networks layers of algorithms inspired by how the human brain works. These networks help the model recognize patterns in language, learn context, and refine its responses over time.