Skip to main content

AI Agents

Chatbots answer questions. Agents get things done.

An agent can research a topic across dozens of sources, write a report, and email it to your team—all while you're in a meeting. This track teaches you to build autonomous systems that work independently on complex, multi-step tasks.

The Agent Difference
Chatbots wait for you. Agents work for you.

What Makes an Agent?

Every agent follows the same loop:

The Agent Loop
PhaseWhat HappensExample
ObserveGather contextRead the user's question, check current data
ThinkReason about the situation"I need to search for recent data first"
PlanBreak into stepsSearch → Read → Analyze → Write
ActExecute using toolsCall search API, read documents
ReflectEvaluate results"Do I have enough information?"

Types of Agents

Task-Specific Agents

Built for one job, done exceptionally well:

AgentWhat It DoesTools It Uses
Code ReviewerAnalyzes PRs for bugs, security, styleRead, Grep, Glob
Research AgentGathers and synthesizes informationWeb search, Document reader
Data AnalystQueries databases, generates insightsSQL, Python, Charts
Support AgentHandles tickets, searches knowledge baseKB search, CRM

General-Purpose Agents

Flexible assistants for varied tasks:

  • Personal Assistant: Calendar, email, task management
  • Project Coordinator: Track work, manage workflows
  • Problem Solver: Open-ended analysis and recommendations

Multi-Agent Systems

Multiple agents working together:

Multi-Agent Patterns

Sub-Agents: Divide and Conquer

Complex tasks need specialized workers. Sub-agents handle specific pieces of work with focused context and limited tools.

Why Sub-Agents?

BenefitWhy It Matters
Context IsolationEach sub-agent works with only relevant information—no overload
ParallelizationRun multiple sub-agents simultaneously
Tool RestrictionsLimit what each sub-agent can do for safety
SpecializationEach sub-agent has tailored prompts for its domain

Built-in Sub-Agents

Claude Code includes ready-to-use sub-agents:

  • Plan Sub-Agent: Dedicated planning with task breakdown
  • Explore Sub-Agent: Fast, read-only codebase search

Creating Custom Sub-Agents

Define sub-agents as markdown files in .claude/agents/:

Markdown
---
name: code-reviewer
description: Expert code review specialist for quality and security reviews.
tools: Read, Grep, Glob
---
You are a code review specialist. When reviewing code:
1. Identify security vulnerabilities (injection, auth issues)
2. Check for performance problems (N+1 queries, memory leaks)
3. Verify adherence to project coding standards
4. Suggest specific, actionable improvements
Be thorough but constructive. Explain *why* something is a problem.

Common Tool Combinations

Agent TypeToolsBest For
Read-onlyRead, Grep, GlobAnalysis, review, research
Test runnerBash, Read, GrepTest execution, CI tasks
Code modifierRead, Edit, Write, Grep, GlobRefactoring, generation

Tools: The Agent's Hands

Agents need tools to interact with the world. Without tools, they can only talk. With tools, they can do.

Tool Categories

Designing Good Tools

Clear purpose: Each tool does one thing well

Python
# Good: specific
"search_company_docs" - searches internal documentation
# Bad: vague
"search" - search what? where?

Defined inputs: Specific parameters with types

Python
{
"name": "search_docs",
"input_schema": {
"properties": {
"query": {"type": "string", "description": "Search terms"},
"category": {"type": "string", "enum": ["policies", "products"]}
}
}
}

Predictable outputs: Consistent return format so the agent can parse results reliably.


Memory: The Agent's Mind

Agents need memory to maintain context across steps and conversations.

Short-term Memory

  • Current conversation
  • Working notes
  • Intermediate results

Long-term Memory

  • Past interactions
  • Learned preferences
  • Domain knowledge

Memory Strategies

StrategyBest ForHow It Works
RAGKnowledge basesSearch stored documents
SummarizationLong conversationsCompress old context
Key-value storeFacts and preferencesQuick lookup
Vector databaseSemantic searchFind similar past content

Track Modules

  1. 1

    Building Agents

    Learn to build agents from scratch using the Claude API.

    You'll learn:

    • Agent architecture patterns
    • Tool implementation
    • State management
    • Error handling and recovery

    Start Building →

  2. 2

    Using Agents

    Master prompting and get reliable results from any agent.

    You'll learn:

    • Writing effective system prompts
    • Tool selection strategies
    • Debugging agent behavior
    • Advanced patterns (chain of thought, self-critique)

    Start Using →

  3. 3

    Agent Products

    Ship production-ready agent systems that users pay for.

    You'll learn:

    • Product architecture
    • User experience design
    • Deployment and scaling
    • Monetization models

    Start Shipping →


Quick Start Example

Here's a minimal research agent:

Python
from anthropic import Anthropic
client = Anthropic()
def research_agent(question: str) -> str:
"""Agent that researches a question using web search."""
tools = [{
"name": "web_search",
"description": "Search the web for information",
"input_schema": {
"type": "object",
"properties": {
"query": {"type": "string"}
},
"required": ["query"]
}
}]
messages = [{
"role": "user",
"content": f"""Research this question: {question}
Use web_search to find information.
Cite your sources in the final answer."""
}]
# Agent loop
while True:
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
tools=tools,
messages=messages
)
if response.stop_reason == "tool_use":
# Execute tools, add results, continue
tool_results = execute_tools(response.content)
messages.append({"role": "assistant", "content": response.content})
messages.append({"role": "user", "content": tool_results})
else:
# Done - extract final text
return extract_text(response.content)

Best Practices

Start Simple

Agent Evolution
  1. One task, one tool: Get that working first
  2. Add tools gradually: One capability at a time
  3. Add memory when needed: Not before
  4. Split into sub-agents: When context gets too complex

Common Pitfalls

ProblemSymptomFix
Infinite loopsSame action repeatedDetect loops, add exit conditions
Tool misuseWrong tool for taskBetter tool descriptions
Context overflowDegraded performanceSummarize, use sub-agents
HallucinationMade-up tool resultsValidate results, require citations
Cost explosionHuge API billsToken budgets, caching

Safety First

  • Human approval for sensitive actions (delete, send, pay)
  • Rate limits and cost caps
  • Logging all agent actions
  • Sandboxed environments for testing
  • Clear boundaries on what agents can/cannot do

Real-World Applications

Software

Code review, bug triage, doc generation, test creation

Support

Ticket routing, knowledge search, escalation, follow-up

Analysis

Report generation, anomaly detection, trend analysis

Content

Drafting, social scheduling, email campaigns, translation


Resources


Prerequisites

Before starting this track:

  • Completed Start Here track
  • Basic Python knowledge
  • Familiarity with APIs (REST, HTTP)
  • Understanding of LLMs (Claude, ChatGPT)