Skip to main content

Technique Guide

AI Agents

AI agents take actions, use tools, and iterate toward goals — they're not just answering a question but completing a task over multiple steps. This guide covers the architecture, prompting patterns, and practical lessons for building reliable agents.

What Makes an AI Agent?

A regular prompt is a single question-answer exchange. An AI agent is a system that can take multiple steps, use external tools (web search, code execution, APIs), observe results, and decide what to do next — in a loop until the goal is achieved.

The core loop (from the ReAct paper) is: Thought → Action → Observation → Thought → ... The model thinks about what to do, takes an action via a tool, observes the result, and repeats.

Reasoning

Breaks down goals, plans sequences, handles uncertainty

Tool Use

Calls APIs, runs code, searches the web, reads files

Memory

Maintains context across steps, learns from errors

Read: Build Your First AI Agent

Prompting Agents Effectively

Define the goal, not the steps

"Find the three most relevant papers on transformer attention mechanisms published in 2024 and summarize the key findings" — not "First do X, then do Y, then do Z." Let the agent plan the steps.

Write clear tool descriptions

Tools are functions the model calls. Describe when to use each tool, what it returns, and edge cases: "Call search_web when you need current information. Do not call it for historical facts from training data."

Give explicit stopping conditions

"Stop when you have a complete answer with at least 3 cited sources" or "Stop after completing all items in the task list." Without stopping conditions, agents can loop indefinitely.

Include error handling instructions

"If a tool call fails, try once with different parameters. If it fails twice, report the failure and explain what you tried." Agents without error instructions get stuck in failure loops.

Articles

Related Lessons

Structured lessons covering agent architecture and implementation.

Related Guides

Build Your First Agent

The AI Agents track covers everything from what agents are to multi-agent coordination in 8 structured lessons.

Start AI Agents Track