HeoLab
ToolsBlogAboutContact
HeoLab

Free developer tools with AI enhancement. Built for developers who ship.

Tools

  • JSON Formatter
  • JWT Decoder
  • Base64 Encoder
  • Timestamp Converter
  • Regex Tester
  • All Tools →

Resources

  • Blog
  • What is JSON?
  • JWT Deep Dive
  • Base64 Explained

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 HeoLab. All rights reserved.

Tools work in your browser. Zero data retention.

HomeBlogWhat Are AI Agents? A Complete Guide for Developers
Table of Contents▾
  • LLM vs AI Agent — The Core Difference
  • The ReAct Pattern (Reason + Act)
  • The Four Core Components
  • 1. The LLM Brain
  • 2. Tools
  • 3. Memory
  • 4. Planning
  • Tool Calling in Code (OpenAI API)
  • Popular Agent Frameworks
  • When to Use an Agent (and When Not To)
  • Safety and Guardrails
guides#ai#ai-agents#llm

What Are AI Agents? A Complete Guide for Developers

Understand what AI agents are, how they differ from regular LLMs, the ReAct loop, tool use, memory, planning, and the most popular frameworks in 2025.

Trong Ngo
February 25, 2026
5 min read

An AI agent is more than a chatbot. Where a regular LLM responds to a single prompt and stops, an agent can plan multi-step tasks, call external tools, remember context across turns, and loop until the job is done. This guide explains every layer.

AI Agent architecture diagram showing the perception–plan–act loop

LLM vs AI Agent — The Core Difference

┌─────────────────────────────────────────────────────────┐
│  Regular LLM                                            │
│                                                         │
│  User prompt ──► LLM ──► Single response               │
│                                                         │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│  AI Agent                                               │
│                                                         │
│  User goal ──► Planner ──► Tool call 1                  │
│                   ▲              │                      │
│                   │         Observation 1               │
│                   │              │                      │
│                   └── Think ◄────┘                      │
│                         │                               │
│                    Tool call 2 ──► Final answer         │
│                                                         │
└─────────────────────────────────────────────────────────┘

A key property: agents run in a loop. They observe, think, act, and repeat until a stopping condition.

The ReAct Pattern (Reason + Act)

ReAct is the most common agent reasoning pattern, published by Google and Princeton in 2022. The model alternates between Thought, Action, and Observation steps:

Question: What is the current weather in Tokyo, and should I bring an umbrella tomorrow?

Thought: I need to look up the current weather and tomorrow's forecast for Tokyo.
Action: weather_tool({ "city": "Tokyo" })
Observation: { "today": "Partly cloudy, 22°C", "tomorrow": "Rain 80%, 19°C" }

Thought: Tomorrow has 80% rain probability. I should recommend an umbrella.
Action: FINISH
Answer: It's partly cloudy today (22°C). Tomorrow expects 80% chance of rain at 19°C — yes, bring an umbrella.

This loop continues until the agent decides it has enough information to answer.

The Four Core Components

1. The LLM Brain

The language model is the reasoning engine. It decides:

  • Which tool to call next
  • How to interpret tool outputs
  • When to stop looping
  • How to format the final answer

Popular choices: GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro, Llama 3.1.

2. Tools

Tools extend what the agent can do beyond text generation:

{
  "type": "function",
  "function": {
    "name": "search_web",
    "description": "Search the internet for real-time information",
    "parameters": {
      "type": "object",
      "properties": {
        "query": { "type": "string", "description": "The search query" }
      },
      "required": ["query"]
    }
  }
}

Common tool categories:

CategoryExamples
Information retrievalWeb search, database queries, vector search
Code executionPython REPL, bash, JS sandbox
External APIsEmail, calendar, CRM, Slack
File systemRead/write files, parse PDFs, CSVs
BrowserPuppeteer, Playwright for web automation

3. Memory

Memory types in AI agents:

┌────────────────┬────────────────────────────────────────────────────┐
│ Short-term     │ The current conversation context (the prompt       │
│ (In-context)   │ window). Limited by model's max tokens.            │
├────────────────┼────────────────────────────────────────────────────┤
│ Long-term      │ External storage — vector DB, SQL, key-value store.│
│ (External)     │ Retrieved via semantic search when relevant.        │
├────────────────┼────────────────────────────────────────────────────┤
│ Episodic       │ Past task results stored and recalled for similar   │
│                │ future tasks ("Last time I did X, Y worked best").  │
└────────────────┴────────────────────────────────────────────────────┘

4. Planning

For complex tasks, agents decompose goals into sub-tasks:

Goal: "Research competitor pricing and create a comparison spreadsheet"

Plan:
  1. Search web for Competitor A pricing page
  2. Extract pricing tiers from page
  3. Search web for Competitor B pricing page
  4. Extract pricing tiers
  5. Compare our pricing against both competitors
  6. Create CSV with comparison table
  7. Return download link

Tool Calling in Code (OpenAI API)

const OpenAI = require('openai');
const client = new OpenAI();

// 1. Define tools
const tools = [
  {
    type: 'function',
    function: {
      name: 'get_weather',
      description: 'Get current weather for a city',
      parameters: {
        type: 'object',
        properties: { city: { type: 'string' } },
        required: ['city'],
      },
    },
  },
];

// 2. Send initial message
const messages = [{ role: 'user', content: 'What\'s the weather in Tokyo?' }];

let response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages,
  tools,
  tool_choice: 'auto',
});

// 3. Agent loop
while (response.choices[0].finish_reason === 'tool_calls') {
  const toolCalls = response.choices[0].message.tool_calls;
  messages.push(response.choices[0].message); // add assistant message

  for (const call of toolCalls) {
    const args = JSON.parse(call.function.arguments);
    const result = await callTool(call.function.name, args); // your impl

    messages.push({
      role: 'tool',
      tool_call_id: call.id,
      content: JSON.stringify(result),
    });
  }

  // Send updated messages back to model
  response = await client.chat.completions.create({
    model: 'gpt-4o',
    messages,
    tools,
  });
}

console.log(response.choices[0].message.content);

Popular Agent Frameworks

FrameworkBest forLanguage
LangChainFlexible pipelines, many integrationsPython / JS
LlamaIndexRAG and knowledge-base agentsPython
AutoGenMulti-agent conversationsPython
CrewAIRole-based multi-agent teamsPython
Vercel AI SDKFull-stack web agentsTypeScript
Semantic KernelEnterprise .NET / PythonC# / Python

When to Use an Agent (and When Not To)

Use an agent when:

  • The task requires multiple steps where the next step depends on the previous result
  • You need real-time data (web search, live APIs)
  • The user's goal is open-ended ("research and summarize")
  • Tasks require external actions (send email, create ticket)

Don't use an agent when:

  • A single LLM call is sufficient
  • Latency is critical (agents add multiple round-trips)
  • Deterministic behavior is required (agents can take unexpected paths)
  • The task has well-defined, predictable steps (use a pipeline instead)

Safety and Guardrails

Agents with tool access can cause real-world side effects. Always:

Principle of least privilege:
  ✓ Give agents only the tools they need for the task
  ✓ Use read-only API keys where possible
  ✓ Require human confirmation before destructive actions
  ✓ Log every tool call for auditability
  ✓ Set max iterations to prevent infinite loops
  ✓ Sandbox code execution tools

The most important safety rule: never give an agent access to production infrastructure without human-in-the-loop confirmation for write operations.

Try These Tools

JSON Formatter & Validator

Format, validate, and beautify JSON data instantly. Detect errors with precise line numbers.

JWT Decoder & Inspector

Decode and inspect JSON Web Tokens. View header, payload, and verify structure instantly.

Related Articles

Building RAG Systems: Retrieval-Augmented Generation for Developers

6 min read

Multi-Agent Systems: Orchestration Patterns and Real-World Examples

5 min read

How AI is Changing Developer Tools in 2025

4 min read

Back to Blog

Table of Contents

  • LLM vs AI Agent — The Core Difference
  • The ReAct Pattern (Reason + Act)
  • The Four Core Components
  • 1. The LLM Brain
  • 2. Tools
  • 3. Memory
  • 4. Planning
  • Tool Calling in Code (OpenAI API)
  • Popular Agent Frameworks
  • When to Use an Agent (and When Not To)
  • Safety and Guardrails

Related Articles

Building RAG Systems: Retrieval-Augmented Generation for Developers

6 min read

Multi-Agent Systems: Orchestration Patterns and Real-World Examples

5 min read

How AI is Changing Developer Tools in 2025

4 min read