All Guides
Advanced • ~1h15~1h15 reading timeFree Guide

AI Agents & Autonomous Systems

Assemble agents capable of reasoning, choosing tools, executing actions and self-correcting before responding.

Why Agents Matter

Think about how you solve a complex problem. You do not just think about it, you:

  1. →Reason about what to do next
  2. →Act by looking something up, running a calculation, or asking someone
  3. →Observe the result
  4. →Repeat until the problem is solved

This is exactly what ReAct agents do. They are AI systems that can plan, use tools, learn from feedback, and iterate toward a solution.

The ReAct Loop

ReAct: Reason, Act, Observe

The core loop of every AI agent

Thought

The agent reasons about the current state and decides what to do next. This is chain-of-thought reasoning applied to action planning.
code
Thought: The user wants to know the current weather in Paris and whether they need an umbrella. I need to check the weather API first.

💡 The thought step makes the agent's reasoning explicit and debuggable.

1/4
Loading diagram…

Agents vs Chains: When to Use What

Chains vs Agents

AspectPrompt ChainReAct Agent
Control FlowPredefined stepsDynamic, agent decides next step
Tool UseNo (text in, text out)Yes (can call APIs, search, run code)
Error RecoveryRetry same stepReason about error and try alternative approach
PredictabilityHigh (same steps every time)Lower (path depends on input)
Best ForWell-defined workflowsOpen-ended, dynamic tasks

← Scroll horizontally →

Quick Check

What makes ReAct agents more capable than pure CoT reasoning?

Tools: The Agent's Hands

Click to expand

Safety and Guardrails

  1. →Tool whitelisting, Only give agents access to tools they need. A customer support agent does not need file system access.
  2. →Confirmation for destructive actions, Require human approval before sending emails, making purchases, or deleting data.
  3. →Iteration limits, Set a maximum number of ReAct loops (typically 5-10) to prevent infinite loops.
  4. →Output validation, Check the agent's final answer against the observations to detect hallucination.
  5. →Cost controls, Each loop is an API call. Set budget limits to prevent runaway costs.
Click to expand

Test Your Understanding

ReAct Agents Knowledge Check

0 / 5 answered

Q1.What does ReAct stand for?

5 questions remaining

What's Next

You now understand the ReAct framework. In the next workshop, you will build your own AI agent with tool use and safety guardrails.


Continue to the workshop: Build an AI Agent with Safety to create an autonomous agent.


Workshop Goal

By the end, you will have built an agent that:

  1. →Takes a user question and plans a series of actions
  2. →Uses 3 tools: web search, calculator, and document lookup
  3. →Requires human confirmation for any action that modifies data
  4. →Stops after 7 iterations or $0.50 in API costs
  5. →Validates its final answer against observed evidence

Step 1: Define the Agent Architecture

Building the Agent Step by Step

From system prompt to safety layer

The System Prompt

The system prompt defines the agent's behavior, available tools, and safety rules. This is the most important engineering decision.
code
You are a research assistant. You help users find accurate information.

Available tools:
1. search_web(query) - Search the internet. Use for current events or facts.
2. calculator(expression) - Evaluate math expressions. Use for any calculation.
3. lookup_docs(query) - Search internal documents. Use for company-specific info.

Rules:
- Always explain your reasoning before acting
- Use the minimum number of steps
- Never guess when you can look up
- If uncertain after 5 steps, say so honestly

💡 Rules in the system prompt act as behavioral guardrails.

1/4

Step 2: Implement Safety Layers

Safety Layer Implementation

LayerWhat It PreventsHow to Implement
Tool WhitelistHallucinated tool callsValidate tool name against allowed list before execution
Parameter ValidationInjection attacks, malformed inputsSchema validation on all tool parameters
Iteration LimitInfinite loops, runaway costsCounter in the execution loop, max 5-10
Cost BudgetUnexpected API expensesTrack token usage per run, stop at threshold
Human ConfirmationUnauthorized destructive actionsFlag tools as requires_confirmation, pause for approval

← Scroll horizontally →

Quick Check

Why is human-in-the-loop important for AI agents?

Step 3: Testing Your Agent

Agent Testing Strategy

Verify behavior before deployment

Happy Path Testing

Test with straightforward questions that require 2-3 tool calls. Verify the agent uses the right tools in a reasonable order.
code
Test: 'What is the current population of Tokyo?'
Expected: search_web -> extract number -> answer
Actual: Verify tool selection and answer accuracy

💡 Start with simple cases to verify the basic loop works.

1/4

Common Agent Anti-Patterns

Click to expand
Click to expand

Test Your Understanding

AI Agent Workshop Check

0 / 5 answered

Q1.What is the most common source of agent failures in production?

5 questions remaining

What's Next

You have built an AI agent with proper safety guardrails. In the next module, you will explore AI image generation, understanding diffusion models and learning to prompt for visual content.


Continue to AI Image Generation and Diffusion Models to enter the world of visual AI.

Your progress

Progress is self-reported and stored in your browser. The final completion record is not a qualification or an independent assessment.

View progress and completion record

Learn AI, from prompts to agents

15 free guidesQuizzes, diagrams and workshopsNo account needed
GO DEEPER — FREE GUIDE

Multimodal & Creative AI

Generate images, video, and music with AI diffusion models. Free creative AI course with hands-on projects.

One practical AI workflow in your inbox

Methods, resources and new exercises. Free, unsubscribe at any time.