AI Literacy Program · Learning Craft AI

Intro to AI Agents
& Agentic Coding

Understanding how agents observe, think, and act — and how they're changing the way software gets built.

AI Agents Tool Use Observe · Think · Act Agentic Coding
In This Module

What you'll learn

  • What is an AI Agent — and how it differs from a chatbot
  • The Core Agent Loop: Observe, Think, Act
  • How agents use tools to interact with the world
  • What is Agentic Coding and why it's a significant shift
  • Real-world examples of agents already in use
Part 01

From Chatbots
to Agents

The Shift

What is an AI Agent?

You've learned about LLMs that respond to prompts. An AI Agent is the next step — an LLM given a goal and the ability to take actions to achieve it. Instead of just talking, agents are designed to do.

Chatbot

Can give you a recipe for chocolate chip cookies.

Agent

Accesses your calendar, checks your grocery list, orders missing ingredients online, and schedules time for you to bake.

From providing information → to performing tasks.

Core Concept

The Core Agent Loop

Agents work in a continuous cycle — repeating until the goal is complete.

Observe
gather info
Think
plan & decide
Act
use a tool
Observe
The agent gathers information about the current situation and its environment before making any decision.
Think
Based on its goal and observations, the agent makes a plan or decides the best next step to take.
Act
The agent executes an action using a tool — then the result triggers a brand new Observe phase.
Example

Planning a Trip: The Loop in Action

Goal: "Plan a weekend trip to San Francisco next month, including flights and a hotel."

The agent doesn't respond immediately — it thinks through a structured plan first:

01
Observe: Assess the goal
The agent receives the request and recognizes it needs multiple pieces of information to proceed.
02
Think: Build a plan
I need to find available flights to San Francisco. After that, I need a hotel for those dates. Then I'll present options.
03
Act: Execute step by step
The plan guides the agent's tool use — one action at a time, each feeding into the next.
Part 02

The Agent's
Toolbox

Tool Use

How Agents Take Action

A model can't book flights on its own. It needs help. Agents perform actions using tools — programs or functions the agent can call to interact with the outside world or perform specific tasks.

⚙️
Code Interpreter
Run code to analyze data or solve complex problems.
🔌
APIs
Connect to external apps: maps, flight search, calendars, databases.
🔍
Web Search
Find current information beyond the model's training data cutoff.
🧮
Calculator
Perform exact mathematical calculations reliably.
Deep Dive

Making a Tool Call

The agent doesn't just select a tool — it provides all required details as parameters, then uses the result to inform the next step.

ACTION
Call flight_search_api:

{
  "destination": "San Francisco",
  "departure_month": "November",
  "trip_type": "weekend"
}

RESULT
{
  "flights": [{
    "flight": "UA249",
    "price": 345,
    "depart": "2025-11-14T08:00"
  }]
}

Results return as JSON — a lightweight format both humans and machines can read.

01
Observe the result
Best flight arrives Friday Nov 14. Departs Sunday Nov 16.
02
Think: use this result
Step 1 complete. Now for Step 2: find a hotel using the Nov 14 date from the flight result.
03
Act: next tool call
Call hotel_search_api with check_in: Nov 14, check_out: Nov 16 — derived from Step 1.
Memory

The Agent Trajectory

The trajectory is the full path of actions and observations the agent has taken. It's the agent's memory — and why maintaining context across steps is critical.

Step 1 — Search Flights
Used flight_search_api. Result: Arrival Date Nov 14. This date feeds directly into Step 2.
Step 2 — Find Hotels
Used hotel_search_api with check-in Nov 14 from Step 1. Without Step 1's result, this fails entirely.
What happens if the trajectory breaks?
If Step 1 fails, the agent has no date to search hotels in Step 2. Each step depends on the previous one — a broken trajectory means an incomplete goal.
Resilience

Error Recovery

Tools sometimes fail. Instead of giving up, agents are designed to enter a recovery loop and find a new path to the goal.

!
Observation Error
Tool Error: "Date '2025-02-30' is invalid" — the tool call failed with an error message.
02
Reflection
The agent analyzes the error: "Feb 30 doesn't exist. I should try Feb 28 instead."
03
Retry
flight_tool(date="2025-02-28") → Success. The corrected plan continues from here.
Infinite Loop Guard
If an agent doesn't understand why it failed, it may retry the same wrong action indefinitely. A maximum retry limit is always set to prevent this.
Real World

Agents in the Wild

AI agents are already inside tools you might use every day — the loop and tools you just learned are what power them.

🔎
Perplexity Deep Research
Give it a complex topic — it runs multiple web searches, reads sources, and produces a comprehensive report with citations. Tools: web search, site access, memory storage.
🛒
Shopify Customer Service
Resolves tasks like processing refunds or editing orders using real-time store data. Tools: user data retrieval, order details, package tracking, inventory checks.

The common thread: a clear goal, the Observe → Think → Act loop, and the right tools to act on the world.

Part 03

What is
Agentic Coding?

Definition

Agentic Coding

Agentic coding is a development approach where LLM-driven agents autonomously plan tasks, generate code, run it, and iterate until a goal is met — fundamentally different from single-shot code generation.

🗺️
Planning & Decomposition
The agent breaks a complex goal into smaller, sequenced, executable steps.
🔧
Tool Use
The agent acts on its environment by running commands, editing files, or calling APIs.
🧠
Memory & Reflection
Results and failures from each step improve the next — context is maintained throughout.
Tools

The Coder Agent's Toolbox

Agentic coders use a specialized set of tools to read, write, run, and verify code — autonomously and iteratively.

📁
File I/O & Editors
Read repository structure, open files, and make targeted multi-line edits.
💻
Shell / Terminal
Run commands, scripts, and build tools directly in the environment.
Test Runners
Execute unit and integration tests to verify whether fixes actually work.
🔌
Function-Calling APIs
Request specific actions and enable code execution beyond the model's own scope.
Practical Example

Fixing a Bug

Goal: "Fix the failing test."

01
Observe
Uses the file viewer to read the project structure. Uses the command runner to execute the failing test and capture the error output.
02
Think & Act
Identifies the root cause and proposes a fix. Uses the code editor to modify the file. Runs the test again to verify.
03
Reflect
If the test passes — goal complete. If not — enter a new Observe loop with the new error as the starting observation.

The agent inspects, proposes, tests, and retries — iterating until the goal is achieved without human intervention at each step.

Impact

Why This is a Big Deal

Agentic coding delivers measurable gains in productivity and quality by enabling autonomous, multi-step development work.

55%
faster task completion as agents automate boilerplate and handle repetitive chores
97%
of developers are already using or exploring AI coding tools
12%
of real-world GitHub issues resolved autonomously by an agent
Risks

Challenges & Risks

Autonomy introduces new operational, security, and governance risks that must be managed with testing, oversight, and guardrails.

Amplified Failures
Autonomy amplifies failure modes — hallucinated changes, brittle plans, and silent regressions. Small errors compound without human checkpoints.
Security Risks
Shell, file, and network access create real risks: unsafe dependency updates, secret exposure, and policy drift. Scoped permissions are essential.
The key principle
Agentic systems need human oversight, retry limits, and clearly scoped permissions. Power and risk scale together — guardrails are not optional.
Key Takeaways

What you learned

  • An AI agent is an LLM given a goal and the ability to take actions to achieve it
  • Agents work in a continuous Observe → Think → Act loop until the goal is complete
  • Tools are how agents interact with the world — APIs, search, code interpreters, and more
  • Agentic coding adds planning, tool use, and self-correction to autonomous software development
  • Autonomy introduces real risks — guardrails, oversight, and retry limits are not optional