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.

AI apps and agents on Real Python

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.

OpenAIClaudeOllama

Ground answers in your data

Turn documents into embeddings, store them in a vector database, and retrieve the right context with RAG.

ChromaDBLlamaIndexRAG

Build agents

Give models tools, memory, and state so they can plan, act, and work through multi-step tasks.

Pydantic AILangGraphCrewAI

Connect tools with MCP

Write MCP servers that expose your data and functions to any LLM client, and test them from your terminal.

MCPFastMCP

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. 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.

    ChatGPT APIClaude APILocal LLMs with OllamaOpenRouter

  2. 2

    Craft prompts and use frameworks

    Write prompts that get reliable results, then use LangChain to template prompts and chain model calls together.

    Prompt EngineeringFirst Steps With LangChain

  3. 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. 4

    Build AI agents

    Create type-safe agents with structured output, then add state and control flow for multi-step workflows.

    Pydantic AILangGraph

  5. 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.

    Python MCP serverPython MCP clientMCP servers course

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.

Loading exercise...

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.

Meet Mentor AI →

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.

OpenAI API
GPT models
Claude API
Anthropic models
Ollama
Local LLMs
OpenRouter
Many models, one API
LangChain
Prompts & chains
LangGraph
Stateful agents
LlamaIndex
RAG pipelines
ChromaDB
Vector database
Pydantic AI
Type-safe agents
CrewAI
Multi-agent teams
MCP
Tools for LLMs
Transformers
Open-source models

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.

See all AI content →

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.

Get your free learning plan