Your First AI Agent

Introduction - Agent Architecture Fundamentals

Understand what AI agents are, how they work, and what you'll build in this course

Introduction

AI agents represent a fundamental shift from passive chatbots to proactive assistants that perceive, decide, and act to accomplish tasks.

What is an AI Agent?

An AI agent is a system that:

  1. Perceives its environment (user messages, tool results, context)
  2. Decides what action to take (respond, use tool, request info)
  3. Acts on that decision (generate response, call tool, update state)

This perceive-decide-act loop repeats until the task is complete.

Key Difference: Chatbots respond to messages. Agents pursue goals using available tools and memory.

Course Objectives

By the end of this course, you will:

Understand Agent Architecture

Master the perceive-decide-act loop and conversation flow management

Build Working Agent

Create conversational agent with memory, tools, and persistence

Domain Specialization

Configure agent personas for Economics, Software, or Business domains

What You'll Deliver

1. Working Conversational Agent

  • Maintains coherent multi-turn conversations
  • Understands context from previous messages
  • Responds appropriately to follow-up questions

2. Tool-Enabled Agent

  • Uses web search to find current information
  • Performs calculations when needed
  • Reads and writes files for data persistence

3. Conversation Persistence System

  • Saves conversation history to disk
  • Loads previous conversations on restart
  • Manages conversation state across sessions

4. Testing Framework

  • Validates agent responses
  • Tests tool usage patterns
  • Verifies memory and context handling

5. Domain-Specific Configuration

  • Custom system prompts for your field
  • Specialized tools and workflows
  • Domain-appropriate response style

Prerequisites

Required Skills:

  • Python basics: functions, classes, loops, dictionaries
  • Command line: running scripts, environment variables
  • API concepts: REST, JSON, authentication

Required from Tier 2:

  • Anthropic API key and setup
  • Understanding of prompt engineering
  • Experience with API integration

Technical Requirements

Software:

  • Python 3.8 or higher
  • Anthropic Python SDK: pip install anthropic
  • Text editor (VS Code recommended)

Accounts:

  • Anthropic API key (from Console)
  • ~$5 API credits for course exercises

Time:

  • 90 minutes for complete course
  • 15 min: Quick Start (minimal agent)
  • 50 min: Core Build (memory, tools, persistence)
  • 25 min: Domain Applications (specialization)

Agent Architecture Overview

# Core agent loop (concept)
while task_not_complete:
    perception = get_user_input() + load_context()
    decision = model.decide(perception, available_tools)
    action = execute(decision)
    update_memory(action)

Components:

  1. Perception Layer: Gather user input, conversation history, tool results
  2. Decision Layer: LLM determines next action based on system prompt and context
  3. Action Layer: Execute tool calls or generate responses
  4. Memory Layer: Store conversation state and context

Three Agent Patterns

Pattern 1: Simple Q&A Agent (Quick Start)

  • Direct user question → LLM response
  • No memory, no tools
  • Good for: Single-turn tasks

Pattern 2: Conversational Agent (Core Build)

  • Multi-turn conversations with context
  • Memory of previous exchanges
  • Good for: Interactive assistance

Pattern 3: Tool-Using Agent (Domain Apps)

  • Uses external tools to accomplish tasks
  • Combines LLM reasoning with real-world actions
  • Good for: Research, analysis, automation

Course Structure

Quick Start (15 minutes)

Build minimal agent that answers questions using Claude API.

Learning: Basic agent loop, API integration, system prompts

Core Build (50 minutes)

Add conversation memory, tool use, and persistence.

Learning: State management, tool integration, conversation flow

Domain Applications (25 minutes)

Specialize agent for Economics, Software, or Business domains.

Learning: Custom prompts, domain tools, workflow design

Success Criteria

Your agent is complete when it can:

  • Coherent Conversations: Handle 10+ message exchanges with context
  • Correct Tool Use: Use web search, calculator, file access appropriately
  • Memory Persistence: Remember context across sessions
  • Domain Value: Provide field-specific assistance (research, code, business)
  • Configurable Behavior: Adjust personality and capabilities via prompts

Next Step: Complete the Quick Start to build your first agent in 15 minutes.