We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

Build an AI Agent in Python

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

What will you learn?

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 17,605 students in the Build an AI Agent in Python course

Read reviews of their learning experiences

It was a great project imo, made a lot of mistakes finding the bugs and correcting them, took me around 20 days to finish this project. Gave me a lot of learning not gonna lie, also helped me get out of my comfort zone for trying the stuff i have never worked with before

(5/5)
Akshat Sharma profile image

Akshat Sharma

India

Great project to learn about AI APIs and different prompting techniques.

(5/5)
Janez Fabijan profile image

Janez Fabijan

Slovenia

Originally struggled with this course due to rate limits on the original course's chosen model. Was constantly getting errors about the model being busy and was never able to submit the CLI tests. However, they've moved to a better model with higher limits and since that change I never ran into this issue again.

(4/5)
Christopher Eyrich profile image

Christopher Eyrich

United States

nice course

(5/5)
Cecilia Barranco profile image

Cecilia Barranco

Mexico

Overall pretty good introduction to agents!

(4/5)
Jeremy U profile image

Jeremy U

Singapore

really challenging but worth it

(5/5)
Bayu Wipradnyana profile image

Bayu Wipradnyana

Indonesia

very useful and interesting! it was quite hard but fullfilling

(5/5)
Agustin  profile image

Agustin

Argentina

Pain.

(3/5)
JT  profile image

JT

United States

This was a really tough one. I feel like not checking the solution file after I was done with a lesson cause me some issues in behavior even though all my code passed at the end of the lesson

(3/5)
Nick Sanders profile image

Nick Sanders

United States

Showing 1-9 of 698

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

Yes! It's free to create an account and start learning. You'll get all the immersive and interactive features for free for a few chapters. After that, if you still haven't paid for a membership, you'll be in read-only (content only) mode.