
How AI Agents Actually Make Decisions
Priya Nair
ML Engineer
The ReAct Loop
Most production AI agents follow a pattern called ReAct (Reasoning and Acting), introduced in a 2022 Google Research paper. The agent receives a goal, produces a chain-of-thought reasoning trace, selects a tool to call, observes the tool output, and then reasons again about whether the goal is complete or another action is needed. This tight loop — reason, act, observe, repeat — is what distinguishes agents from single-pass language models. The loop continues until the agent determines the task is done or a maximum step count is reached.
Tool Calling: The Agent's Hands
An agent without tools is just a language model. Tools are what give agents the ability to affect the world: web search, code execution, database reads and writes, API calls, file system access, browser control. Modern agent frameworks standardise tool calling: the agent outputs a structured JSON object naming the tool and its arguments, the framework executes the tool, and the result is appended to the agent's context as an observation. The model never actually 'runs code' itself — it generates instructions for a tool executor to run on its behalf.
An AI agent is a reasoning engine that borrows hands from its tools. The quality of the reasoning and the breadth of the tools determine what it can accomplish.
Memory: Short-Term and Long-Term
Agents have two kinds of memory. Short-term memory is the context window — everything the agent has seen in the current session: the original goal, all previous reasoning steps, all tool outputs. This is typically capped at tens of thousands to a few million tokens. Long-term memory is external: a vector database, a key-value store, or a structured database that the agent can query to recall information from previous sessions. Agents without long-term memory start fresh every time. Agents with it can learn your preferences, remember past interactions, and improve over time.
Planning: How Agents Break Down Complex Goals
For tasks that require many steps, agents use planning to decompose the goal into sub-tasks before acting. A planning agent will first produce a written plan — "Step 1: search for competitors. Step 2: extract pricing from each site. Step 3: build a comparison table." — and then execute each step in sequence, revising the plan if a step fails or produces unexpected results. Planning dramatically improves reliability on long-horizon tasks where a single-loop agent would drift or forget earlier context.
Where Agents Still Struggle
Honest assessment: agents are unreliable when tasks are ambiguous, when error handling requires judgment, or when the number of steps required exceeds what fits in context. They can also get stuck in loops, confidently report wrong results, or misuse tools in ways that cause real-world side effects. The antidote is constraint: clear task definitions, limited tool permissions, human-in-the-loop checkpoints for irreversible actions, and maximum step limits. Well-designed agents fail safely; poorly designed ones fail in ways that are hard to reverse.
Ready to deploy your first agent?
Explore hundreds of AI agents on Skillforge — no code required.
Explore AgentsMore from the Blog

What Are AI Agents? A Plain-English Guide
AI agents are software systems that perceive their environment, make decisions, and take actions to achieve goals — without needing a human to direct every step.

The Rise of Agentic AI: From Chatbots to Autonomous Workers
The shift from chatbots to autonomous AI agents is the most significant change in how businesses will use software over the next decade.

Inside the AI Agent Marketplace Economy
A new creator economy is forming around AI agents — where builders package expertise into deployable software and businesses buy capability instead of time.