Skill area · Building AI Apps & Agents
Build AI apps and agents with Python
Connect LLMs to your code, your data, and your tools
Real Python shows you how to call models like GPT and Claude from Python, ground their answers in your own documents with RAG, and build agents that use tools through MCP. Follow a guided path, practice in your browser, and ask Mentor AI when you get stuck.
from mcp.server.fastmcp import FastMCP
mcp_server = FastMCP("Orders MCP server")
@mcp_server.tool()
def get_total_spent_by_customer(customer: str) -> int:
"""Get the total amount a customer has spent."""
...
AI apps and agents on Real Python
- 40AI tutorials
- 15+video courses
- 35+interactive quizzes
- 25coding exercises
- 2guided learning paths
What you’ll be able to do
From your first API call to agents that use tools
You don’t need to train a model to build useful AI software. These are the skills that turn an LLM into a working Python application.
Call LLMs from Python
Send prompts to hosted models or run open models locally, and get structured, validated output back.
Ground answers in your data
Turn documents into embeddings, store them in a vector database, and retrieve the right context with RAG.
Build agents
Give models tools, memory, and state so they can plan, act, and work through multi-step tasks.
Connect tools with MCP
Write MCP servers that expose your data and functions to any LLM client, and test them from your terminal.
Your roadmap
A clear path from API call to AI agent
Work through these stages in order. Together they make up the LLM Application Development With Python learning path, which mixes tutorials, video courses, and quizzes.
- 1
Connect to LLM APIs
Call hosted models like GPT and Claude, run open models on your own machine, and switch between providers with one API.
- 2
Craft prompts and use frameworks
Write prompts that get reliable results, then use LangChain to template prompts and chain model calls together.
- 3
Add retrieval-augmented generation
Convert documents into LLM-ready text, store embeddings in a vector database, and build a chatbot that answers from your own data.
Embeddings and ChromaDBLlamaIndex RAG guideMarkItDownRAG chatbot
- 4
Build AI agents
Create type-safe agents with structured output, then add state and control flow for multi-step workflows.
- 5
Connect agents to tools with MCP
Expose your data and functions through an MCP server, and build a client to test servers from your terminal.
Go further: put AI to work on your own code
Learning Path
Python Coding With AI
12 Resources ⋅ Skills: Cursor, Claude Code, AI-Assisted Development, Context Engineering, AI Code Review
Want to understand how the models themselves work? Explore Machine Learning With Python. New to Python itself? Start with Python Basics first.
Try it now
Give an LLM a tool it can call
This is a real exercise from the Connecting LLMs to Your Data With Python MCP Servers video course, and it’s the same tool from the example above. Write your function, register it on the server, and click Run Tests.
Running tests, hints, and solutions are included with a Real Python membership. Not a member yet? You can still read the task and write your solution before you join.
Learn it every way
Read it, watch it, test it, practice it
Every AI topic comes in the formats that help it stick. Mix them however you like.
Tutorials
In-depth, example-driven guides to LLM APIs, RAG, agent frameworks, MCP, and AI coding tools.
Browse tutorials →Video courses
Follow along as an instructor builds a working AI project, one bite-sized lesson at a time.
Start with the OpenAI API →Quizzes
Check what you’ve learned in a few minutes and see exactly which concepts to review.
Take a quiz →Coding exercises
Build prompts, RAG pipelines, and MCP tools in your browser and get instant test feedback.
How exercises work →Mentor AI
Agent not calling your tool? Ask right where you are
AI code fails in new ways: a tool the model never calls, a prompt that returns the wrong format, a retrieval step that pulls in the wrong documents.
Mentor AI sees the tutorial, lesson, or exercise you’re on and your code, and nudges you toward the fix one hint at a time, so you understand how the pieces fit together.
My function returns the right totals when I call it, but the test says the server has no tools. What am I missing?
Your function logic sounds right. Writing the function is only half of it, though. How does mcp_server find out that this function exists?
Oh, I never registered it. I need @mcp_server.tool() above the function!
Exactly. The decorator also passes your type hint and docstring to the LLM, so it knows when to call the tool. Now, what should happen for a customer like Tron who has no orders?
The modern AI stack
Learn the tools AI developers actually use
Model APIs, frameworks, vector databases, and protocols, each with a hands-on tutorial or course.
Fresh from the library
New and updated for 2026
AI tools change fast. The Real Python team keeps publishing and refreshing AI content, so what you learn matches the libraries and models you’ll use at work.
- CourseUsing the Claude API in Python
- TutorialAgentic Engineering in Python: From Vibes to Evidence
- CourseHow to Get Started With Ollama
- TutorialCrewAI in Python: Coordinating Teams of AI Agents
- TutorialLangGraph Tutorial: Build Stateful AI Agents in Python
- CourseTesting MCP Servers With a Python MCP Client
- QuizUsing the Claude API in Python
Questions and answers
You should be comfortable with Python basics like functions, dictionaries, and installing packages. If you’re not there yet, the Python Basics learning path gets you ready.
No. Building AI apps is about calling existing models and wiring them into your code, not training models yourself. If you want to learn how models work under the hood, Machine Learning With Python covers that side.
Not necessarily. Hosted APIs like OpenAI and Claude require an account, but you can also run open models on your own computer with Ollama and follow along without a paid key.
Start by calling a model API directly so you understand what every framework does for you. Then pick up LangChain or LlamaIndex for RAG, and Pydantic AI or LangGraph for agents. The roadmap above follows that order.
Yes. The Python Coding With AI learning path covers tools like Cursor, Claude Code, and GitHub Copilot, and how to brief and review the code they write.
Every Real Python membership includes all video courses, quizzes, coding exercises, and learning paths for AI and every other topic, along with Mentor AI as it rolls out.
Start building with AI
Get your free learning plan and follow the full AI roadmap, with courses, quizzes, coding exercises, and a mentor at your side.