html Building AI Agents - Week 1 Presentation
Slide 1 of 21

Building AI Agents

Week 1: How to Build an AI Agent

AI Agent Bootcamp

Logo Lonely Octopus

Press right arrow to begin
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Introduction

This week we'll start our journey to build advanced AI agents that can perform complex tasks autonomously.

Welcome and Recap

  • Welcome to Week 1 of our AI Agent Bootcamp!
  • Last time Tina covered the importance of AI agents and you completed the onboarding.
  • Today we'll dive deeper into building your first functional agent

Today's Objectives

  • Understand the six core components of agent architecture
  • Learn how to select appropriate models for different agent types
  • Configure tools and instructions for your agent
  • Implement basic guardrails for safety
  • Build your first functional agent
"By the end of this week, you'll have built a simple but powerful AI agent that can perform specific tasks, understand the fundamental building blocks of more complex agent systems, and be ready to make your agent more context-aware in Week 2."
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Agent Overview

OpenAI defines agents as "systems that intelligently accomplish tasks", ranging from executing simple workflows to pursuing complex, open-ended objectives.

Agent Diagram

Agent Orchestration Diagram

What Makes Something an Agent?

  • Agents make autonomous decisions about what actions to take
  • Agents can use tools to interact with the world
  • Agents maintain state across multiple steps of execution
  • Agents have guardrails to ensure safe and appropriate behavior
AI Agent Bootcamp
Week 1: How to Build an AI Agent

The Six Core Components of Agent Architecture

Layered Burger

Just like a perfect burger has essential layers, every great agent needs these six core components!

Models

The intelligence engine that powers reasoning and decision-making

Lawyer Agent: Uses o3 for complex legal reasoning and case analysis

Tools

Interfaces that allow agents to interact with external systems

Therapy Agent: Calendar scheduling, note-taking, progress tracking tools

Knowledge & Memory

Systems for storing and retrieving information

Lawyer Agent: Remembers case precedents, client history, legal documents

Audio & Speech

Capabilities for understanding and generating spoken language

Therapy Agent: Voice conversations, emotional tone detection, session recordings

Guardrails

Safety mechanisms to ensure proper behavior

Medical Agent: Never diagnoses, always recommends seeing a real doctor

Orchestration

Systems to deploy, monitor, and improve agents

Customer Service Agent: Handles escalations, tracks performance, learns from interactions
AI Agent Bootcamp
Week 1: How to Build an AI Agent

How to Choose Your Model

The Simple 3-Step Strategy

Step 1: Build It First

Start with a smart model to prove your idea works

Example: Building a recipe assistant? Use the latest model for everything first. Get it working, then optimize.

Step 2: Find the Expensive Parts

Look at where you're spending money and optimize the biggest costs first

Example: If users ask "What's for dinner?" 1000 times a day, use a cheaper model for that. Keep the smart model for complex recipe generation.

Step 3: Mix and Match

Use different models for different jobs like having specialists on a team

Example: Cheap model answers "What's for dinner?" Fast model suggests ingredients. Smart model creates custom recipes.

Simple Questions to Ask Yourself

  • How smart does this need to be?
    Checking if an email is spam = not very smart needed
    Writing a legal contract = very smart needed
  • How fast does this need to be?
    Chatbot response = very fast
    Daily report generation = can be slower
  • How often will this run?
    1000 times per day = optimize for cost
    10 times per day = smart model is fine

Think Like a Restaurant

  • Host at the front: Fast, cheaper model to greet and direct customers
  • Line cooks: Medium models for routine food prep
  • Head chef: Smart model for special dishes and complex requests
  • Manager: You, watching costs and switching roles when needed
Real Example: A customer service bot uses a fast model to understand "I want to return something" then hands off to a smart model to handle the complex return process.

Sources & Further Reading

OpenAI Guides

Model Selection: best practices

AWS: Model Selection Framework

Systematic evaluation methodology

Model Comparison Cheat Sheet

Model Provider Best For
GPT-5.2 OpenAI Hardest tasks; best all-round reasoning & instruction following
GPT-5 Mini OpenAI Most production agents; best balance of power & cost in GPT-5 family
GPT-4.1 OpenAI Agents needing very long context (1M tokens) at lower cost than GPT-5
GPT-4.1 Mini OpenAI High-volume agents wanting GPT-4.1 quality without the cost
o4-mini OpenAI Coding & STEM reasoning; o-series capability at a fraction of o3's price
Claude Sonnet 4.6 Anthropic Coding & writing agents; sweet spot of speed, cost & intelligence
Gemini 3 Flash Google High-volume agents processing images/docs on a budget
Gemini 3.1 Pro Google Complex multi-step agents; long-context reasoning with thinking mode
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Should You Use Open Source Models?

Let's weigh the trade-offs

PROS

Full Control

Complete ownership of your models and data. Deploy anywhere, anytime, however you want.

Customizability

Fine-tune on your data, modify architecture, optimize for your specific use case. Total flexibility!

No Vendor Lock-in

Not dependent on any single provider. Switch models, platforms, or infrastructure freely.

Significantly Cheaper

50-90% cost reduction vs cloud APIs! Perfect for high-volume use cases.

Auditable

Inspect code, understand model behavior, verify security. Full transparency.

Fosters Innovation

Community-driven improvements, rapid iteration, shared knowledge accelerates progress.

CONS

Higher Setup Complexity

Steeper learning curve. Requires knowledge of deployment, optimization, and troubleshooting.

Requires Good Hardware

Need GPUs, servers, deployment pipelines. Initial infrastructure investment required.

Weaker Out-of-the-Box

Generally lag behind GPT-5.2 and Claude 4.6 on complex tasks (though gap is rapidly closing!)

Self-Management Required

You handle security, scalability, uptime, updates, and monitoring. No managed service support.

Good News: These drawbacks are rapidly diminishing due to ongoing innovation! The ecosystem is maturing fast.

Best Use Case: High-volume applications with privacy requirements where you have technical expertise. Start with cloud APIs, migrate to open source when you hit scale or privacy constraints.

AI Agent Bootcamp
Week 1: How to Build an AI Agent

The Open Source AI Stack

Everything you need to build AI agents

Popular Open Source Models

Kimi (K2/K2.5)

Moonshot AI's 1T param MoE. Exceptional agentic abilities, 256K context, visual coding

GLM (4.5/4.6/4.7)

Zhipu AI's ChatGLM series. Strong coding, tool calling, 26 languages, 128K context

Qwen3

Alibaba's versatile series. Strong multilingual, reasoning, and coding capabilities

Ollama - Your Local Model Manager

Run these models locally on your machine! Download, manage, and switch between open-source models with a single command.

Building Agentic Systems

Open-source agents use the same components as closed-source agents, just with open models!

Models

Tools

Knowledge & Memory

Audio/Speech

Guardrails

Orchestration

AI Agent Bootcamp
Week 1: How to Build an AI Agent

Configuring Instructions

Instructions are your agent's blueprint! Using this proven framework ensures your agent behaves exactly how you want it to.

6-Part Instruction Framework

Role

Who is your agent? Define their identity and expertise

Example: "You are a helpful task organizer assistant"

Task

What exactly should your agent do? Be specific about the main job

Example: "Break down user goals into actionable tasks"

Input

What information will users provide? Set clear expectations

Example: "Users will provide a goal or objective they want to achieve"

Output

How should your agent respond? Define the format and style

Example: "Provide numbered steps with deadlines and priorities"

Constraints

What should your agent NEVER do? Set clear boundaries

Example: "Never suggest illegal activities or unrealistic timelines"

Capabilities & Reminders

Key capabilities and behaviors to always remember. Your agent's personality traits

Example: "You can do web search. Always be encouraging and ask clarifying questions"

Quick Template Using this Framework

ROLE: You are a [describe who your agent is]

TASK: Your main job is to [specific action/responsibility]

INPUT: Users will give you [type of information expected]

OUTPUT: You should respond with [format, style, structure]

CONSTRAINTS: Never [list forbidden behaviors]

REMINDERS: Always remember to [key personality traits and behaviors]

AI Agent Bootcamp
Week 1: How to Build an AI Agent

Context Engineering

Context Engineering Diagram

Context Engineering: Combining different types of information to give your agent the full picture

Base Prompt

1. Role
You are an AI research assistant tasked with summarizing the latest news in artificial intelligence. Your style is succinct, direct, and focused on essential information.

Task
Given a search term related to AI news, perform a web search to retrieve information from the past week, and produce a concise summary of the key points.

Input
The user's input is a specific AI-related search term provided by the user.

Output
Provide only a succinct, information-dense summary capturing the essence of recent AI-related news relevant to the search term. The summary must be concise, approximately 2-3 short paragraphs, totaling no more than 300 words.

Constraints
Focus on capturing the main points succinctly; complete sentences and perfect grammar are unnecessary. Ignore fluff, background information, and commentary. Do not include your own analysis or opinions.

Capabilities & Reminders
You have access to the web search tool to find and retrieve recent news articles relevant to the search term. You must be deeply aware of the current date to ensure the relevance of news, summarizing only information published within the past 7 days.

Context Engineered Prompt

1. Role
You are an AI research assistant focused on identifying and summarizing recent trends in AI from multiple source types. Your job is to break down a user's query into actionable subtasks and return the most relevant insights based on engagement and authority.

Task
Given a research query (delimited by <user_query></user_query>), do the following: Extract up to 10 diverse, high-priority subtasks, each targeting a different angle or source type. Prioritize by: Engagement (views, likes, reposts, citations) Authority of source (publication reputation, domain expertise) Generate JSON outputs for each subtask in the format below. Calculate the correct start_date and end_date (UTC ISO format) based on the specified time period. Summarize all findings into a single concise trend summary (~300 words max).

Input
<user_query> INSERT_SEARCH_QUERY_HERE </user_query>

Output
(You will output up to 10 subtasks in this exact format.)
{"id": "subtask_1", "query": "...", "source_type": "news | X | reddit | ...", "time_period": "1_day" | ... , "priority": 1}

Constraints
Focus on capturing the main points succinctly. Ignore fluff, background information, and commentary. Do not include your own analysis or opinions.

Capabilities & Reminders
You have access to the web search tool to find and retrieve recent news articles relevant to the search term. You must be deeply aware of the current date to ensure the relevance of news, summarizing only information published within the past 10 days.

AI Agent Bootcamp
Week 1: How to Build an AI Agent

Two Ways to Build Your Agent

You can build agents by connecting apps visually or by writing code. Both work great!

Connect apps with boxes and lines

Visual Building

  • Drag and drop: Connect apps like connecting puzzle pieces
  • 400+ apps ready: Gmail, Slack, Google Sheets, and more
  • See everything: Watch your data flow through each step
Perfect for: Connecting existing apps, automating daily tasks, team workflows
OpenAI Agents SDK

Code Building

  • Write Python code: Create exactly what you want
  • Smart agents: They think and make their own decisions
  • Work together: Multiple agents can collaborate
  • Full control: Build any behavior you can imagine
Perfect for: Custom solutions, complex behaviors, autonomous agents
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Assignment: Building a simple Agent with n8n

Use n8n to create a no-code automation that connects form submissions to an OpenAI-powered Task Generator.

n8n Workflow Overview

  • Trigger: On form submission node captures user goal input from a form.
  • AI Processing: The OpenAI - Message Model node sends the goal to OpenAI API with system instructions to break it into tasks.
  • Response Display: The final Form node shows the generated task list to the user as a confirmation or next steps.
n8n Workflow
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Assignment: Building Your First Agent with the OpenAI Agents SDK

Let's build a Task Generator agent that creates a clear, actionable plan from user goals.

Step-by-Step Walkthrough

1

Install the OpenAI Agents SDK

pip install openai-agents openai
2

Import required libraries

import os
import openai
from agents import Agent, Runner
import asyncio
3

Initialize the OpenAI API key

OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Assignment (Continued)

Define the Agent

task_generator = Agent(
    name="Task Generator",
    instructions=\"\"\"You help users break down their goals into small, achievable tasks. 
    For any goal, analyze it and create a structured plan with specific actionable steps.
    Each task should be concrete, time-bound when possible, and manageable.
    Organize tasks in a logical sequence with dependencies clearly marked.
    Ask clarifying questions when the goal is ambiguous.\"\"\",
)

Create the Async Task Runner

async def generate_tasks(goal):
    result = await Runner.run(task_generator, goal)
    return result.final_output
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Assignment (Continued)

Run the Agent with a use case

async def main():
    user_goal = "Start a small online business selling handmade jewelry"
    tasks = await generate_tasks(user_goal)
    print(tasks)

if __name__ == "__main__":
    asyncio.run(main())

Common Issues and Debugging

  • Ensure environment variables are correctly set
  • Use asyncio.run() only in standalone scripts
  • Check internet access and API key permissions
  • Review function indentation and syntax carefully

Next Step

  • Implement this on your machine!
  • Test with different types of goals.
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Supplementary Materials

Streamlit Tutorial (Code)

If you chose the code option, watch this to add a user-facing UI to your python AI Agent.

Recording Code

Code Recording

Basic single-agent setup. This is a recorded walkthrough using Python and OpenAI (Make sure you have watched the streamlit tutorial first).

Recording Code

No-Code Recording

Basic single-agent setup. This is a recorded walkthrough using n8n forms and OpenAI.

Recording Workflow

OpenAI Documentation

OpenAI's Agents SDK documentation and official guides.

Docs

n8n Documentation

n8n documentation and workflow templates.

Docs

Guardrail Strategies

Advanced techniques for ensuring agent safety and reliability

Bonus presentation

Open Source Setup (Optional)

Optional open source alternatives for setting up your AI Agent, available in both no-code and code options.

No Code Code

Installing Ollama

Set up Ollama locally to run open source LLMs on your own machine.

Tutorial

Self Hosting n8n with Docker

Learn how to self host your AI Agent infrastructure using Docker.

Tutorial
"All materials will be yours to access for a lifetime! Feel free to ask questions and share your progress with the community anytime."
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Hands-on Activity: Writing Instructions

Time: 10 minutes | Let's practice creating agent instructions using the 6-part framework!

Example: Personal Task Manager Agent
ROLE: You are a helpful personal task management assistant
TASK: Help users organize their daily tasks and set realistic priorities
INPUT: Users will give you their goals, deadlines, and current workload
OUTPUT: Provide a numbered task list with priorities and suggested deadlines
CONSTRAINTS: Never suggest unrealistic deadlines or overloading someone's schedule
CAPABILITIES & REMINDERS: You can do web search .Always be encouraging and ask clarifying questions when tasks are unclear
Your Turn: Create Your Agent Instructions
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Q&A and Preview

Key Takeaways from Today

  • Agents are composed of six core components: Models, Tools, Knowledge, Audio/Speech, Guardrails, and Orchestration
  • Start with powerful models, then optimize for cost/latency
  • Well-designed tools and clear instructions are critical for success
  • Guardrails ensure safe and appropriate agent behavior
  • n8n provides a powerful visual way to integrate agent workflows

What's Coming in Week 2

  • Making agents context-aware
  • Connecting agents to external data sources
  • Implementing more sophisticated tool usage
  • Building multi-step workflows
  • Advanced n8n integration techniques

Your Assignment (Code or No-code)

  1. Complete your Week 1 assignment after watching the recorded tutorials.
  2. Test your agent with at least 2 different user scenarios
  3. Document any issues or challenges you encounter
  4. Share your agent in the "Share" space on circle

Questions?

Now is the time to ask!

AI Agent Bootcamp
Week 1: How to Build an AI Agent

Appendix - Key Terms Made Simple

AI & Agent Terms

  • Agent: A computer program that can make decisions and take actions on its own
  • Model: The "brain" of the AI that helps it think and respond
  • Tools: Special abilities that let an agent do things like search the web or check files
  • Instructions: Rules that tell the agent how to behave and what to do

Technical Terms

  • API: A way for different computer programs to talk to each other
  • Guardrails: Safety rules that keep the agent from doing harmful things
  • Vector Store: A special database that helps the agent find similar information
  • Workflow: A series of steps that the agent follows to complete a task

Think of it like this:

An AI agent is like a helpful assistant that:

  • Has a brain (model) for thinking
  • Has hands (tools) for doing tasks
  • Has rules (instructions) for good behavior
  • Has safety measures (guardrails) to avoid mistakes
AI Agent Bootcamp
Week 1: How to Build an AI Agent

Appendix - Security and Privacy: Building Smart, Not Scared

Security isn't about choosing the "most secure" option, it's about understanding the trade-offs and picking what fits your needs and skills.

🏬 Cloud APIs (OpenAI, Anthropic)

✅ The Good Stuff

  • Easy to start: Just sign up and get an API key
  • Professional security: These companies spend millions on security
  • Always updated: Latest models and security patches
  • Compliance built-in: SOC2, GDPR compliance handled for you

⚠️ Things to Know

  • Your data travels: Goes to their servers for processing
  • Policy changes: Terms can change (though rarely for the worse)
  • Less control: You trust them to handle security
Best for: Learning, prototyping, most business applications

🏠 Self-Hosting (Run Your Own)

✅ The Good Stuff

  • Complete control: Your data never leaves your servers
  • Custom security: Set your own rules and policies
  • No usage fees: Pay once for hardware, use forever
  • Privacy guaranteed: Perfect for sensitive data

⚠️ The Reality

  • Complex setup: Needs serious technical skills
  • Expensive: GPUs, electricity, maintenance costs
  • You're responsible: Security, updates, backups
  • Slower updates: Latest models come later
Best for: Large companies with dedicated AI/DevOps teams

Expert Sources & Security Frameworks

NIST AI Risk Management Framework

Official US government AI security guidelines

OWASP Top 10 for AI/LLM Security

Most common AI vulnerabilities and how to prevent them

Anthropic: AI Agent Safety Framework

Industry best practices for safe AI agent development

FTC: AI Privacy Requirements

US regulatory guidance on AI and data privacy

Thank You!

Ready to take your agent implementations to the next level?

Questions & Discussion

Share your insights and bring your questions for the Thursday live Q&A session!

See you next week for Making Agents Context-Aware