AI Tutorial
Home All Courses Blog Interview Prep ↗ 0%
1
Curious builder 0 XP earned · 300 to level 2
0 days Finish a lesson to begin
Badge collection
0 of 5 unlocked
small wins to finish your path
Next lesson →

Generative AI & Agents

This course moves from calling a model to building software around it. You will write an LLM app with proper error handling, stream and batch requests, give a chatbot memory that fits in the context window, let a model call your functions, wrap that in an agent loop with stop conditions, add human approval for risky actions, and evaluate the whole thing like an engineer. Every core idea runs offline with simulated models, and each lesson shows the live API version too.

Last updated: 01 Nov, 2026

What is generative AI?

Definition · Generative AI

Models that produce new content — text, code, images, audio — by learning the patterns in large datasets. In this course “the model” means a large language model (LLM) that takes text (and optionally images) in and produces text out.

Definition · LLM application

A program that uses an LLM as one component: your code prepares the input, calls the model, checks the output, and decides what happens next. The model generates; your application is responsible for everything else.

Definition · AI agent

An LLM application in which the model decides, step by step, which actions to take — which tools to call and with what arguments — to reach a goal, observing each result before choosing the next step.

Most valuable AI products are not fully autonomous agents. They are well-engineered applications that use a model for the parts that need language understanding, and plain code for everything that needs to be reliable. This course teaches you both — and how to choose.

From prompt to agent

LevelWhat the model doesExample
Single callAnswers one promptSummarise an email
Chat appAnswers with conversation historySupport chatbot
WorkflowFills fixed steps that your code orchestratesClassify a ticket, then route it, then draft a reply
Tool-using appRequests function calls; your code runs them“What's the status of order A-1001?”
AgentChooses tools in a loop until the goal is metResearch a question across several documents and cite sources

Each level adds capability and risk. A wrong answer from a chatbot is text; a wrong decision from an agent can be an email sent, a row deleted, or money charged. That is why the later lessons focus on stop conditions, approval, and evaluation.

What you will learn

LessonWhat you learn
Your first LLM appClients, configuration, a reusable ask() function, token and cost tracking, retries, and error handling.
Streaming and batchStreaming tokens to users, time to first token, concurrent requests with asyncio, and the Batch API for offline jobs.
A chatbot with memoryMessage history, trimming to a token budget, summary memory, persistence, and long-term memory.
What are AI agentsAgents vs workflows, the agent loop, common workflow patterns, and when not to build an agent.
Tool callingTool schemas, the request–execute–respond cycle, a tool registry, validation, and error handling.
ReAct agentsThe reason–act–observe loop, a complete agent from scratch, stop conditions, and budgets.
Human in the loopRisk tiers, approval gates enforced in code, editing actions, audit logs, and pause/resume.
Evaluating LLM appsEval sets, output and trajectory checks, LLM-as-judge, tracing, and regression gates.
Project: a research agentA complete agent that searches, reads, and answers with citations under a step budget.

Prerequisites

Terminal
python -m pip install openai python-dotenv

Key terms

TermMeaning
ClientThe SDK object that sends requests to a model provider's API.
StreamingReceiving the reply token by token as it is generated, instead of all at once.
MemoryInformation from earlier turns or sessions that the app sends back to the model.
Tool (function)A function your code exposes to the model with a name, description, and JSON Schema for its arguments.
Tool callA structured request from the model to run a tool with specific arguments.
Agent loopRepeat: model chooses an action → code runs it → result goes back to the model, until done.
Trajectory (trace)The full record of an agent run: every model call, tool call, argument, and result.
Human in the loop (HITL)A design where a person must approve, edit, or reject certain actions before they happen.
Note

Code in this course uses small simulated models — plain Python functions that return what a model would — so you can run every example offline and see exactly how the surrounding application behaves. Where a live API version differs, it is shown separately and labelled.

Course syllabus

Work through the lessons in order. Your progress is saved in this browser as you mark lessons done.

Syllabus