Build an AI Agent in Python

Build a tiny coding agent that can read files, edit code, run Python, and loop on feedback.

What you'll learn in this Python course

Write a toy agentic code editor in Python, similar to Claude Code or Cursor's Agent Mode. Understand how agents work from scratch by using free models on OpenRouter (via the OpenAI SDK) to create an LLM-powered code agent. You'll use function calling and feedback loops to build an agent that can find and fix bugs in a real project!

Chapter List

1
LLMs
Learn how LLMs work and send prompts to LLMs on OpenRouter using the OpenAI Python SDK
2
Functions
Write the functions your AI agent will need to modify files and run Python code
3
Function Calling
Give your AI agent the ability to call functions based on its system prompt and context window
4
Agents
Give your tool a proper feedback loop to make it truly "agentic" and fix a real bug

Join 20,592 students in the Build an AI Agent in Python course

Read reviews of their learning experiences

GREAT

(5/5)
Manos Botsis profile image

Manos Botsis

Athens, Greece

This project was suprisingly fun, personally it would have been better if the coding agent would have been tasked with coding the calculator itself though. After coding the coding agent, you tell the agent to go build something.

(5/5)
Johannes V. profile image

Johannes V.

Norway

In the end you won't understand much how to do your own agent (I really don't think that's the purpose of this course anyway) but you'll have a way better understanding on how an AI agent works at least in the concept. It is an introduction, and it does it well enough.

(4/5)
Dabou Master profile image

Dabou Master

France

It's really fun and has a good structure

(4/5)
Shaker Sharabi profile image

Shaker Sharabi

Earth

Course is good to get an understanding of LLM loops and adding some basic restrictions

(5/5)
Robert Ketting profile image

Robert Ketting

Australia

Really enjoyed this course, difficult to see the process in the beginning but very satisfying at the end when you can pass prompts to a script and things magically happen on your local machine!

(5/5)
Andrew Miller profile image

Andrew Miller

Belfast

A genuinely good project that helps you understand actually how ai-agent works instead of building a chatbot

(5/5)
Subhajit Saha profile image

Subhajit Saha

India

Fun course that got pretty challenging towards the end.

(5/5)
Bilal Maqsood profile image

Bilal Maqsood

United States

really hard and needs a lot of practice and documentation reading to understand but fun at last :0

(5/5)
M.Mehdi Akramzadeh profile image

M.Mehdi Akramzadeh

Turin, Italy

or view more reviews

Mediocrity doesn't cut it anymore

The only way to become a great developer is to write a lot of code

Avoid tutorial hell

by writing a ton of code

Stay motivated with

a game-like curriculum

Build portfolio projects

to prove your skills

Delve deeper

into foundational concepts

Learn flexibly online

without interrupting your life

For 1% the price of college

to minimize your financial risk

Frequently asked Questions

Got questions? We've got answers

No. You'll use free models on OpenRouter through the official OpenAI Python SDK. The free tier is limited to about 50 requests a day, which is enough to finish the course. A one-time $10 credit would bump that to roughly 1,000 a day if you want to go faster.