Introduction
This is just enough Python — the part you need to build AI agents, and to read agent code written by somebody else or by an AI.
It is deliberately not a complete Python course. Those exist, and they will take three months of your life before you build anything. That is the wrong order.
The principle
You could go on learning any programming language forever. There is always another feature, another idiom, another chapter.
The goal here is to build AI agents. It is good to master Python; it is better to ship the agent. Given the choice, ship the agent.
About 20% of Python does about 80% of the work in agent code. That 20% is what this covers. Spend a week on it, not three months.
What to actually read
Do not work through this front to back. Do these six, in order, and stop:
- Variables and types
- Working with strings
- Lists and dictionaries
- Control flow
- Functions
- Classes and objects
That is enough to get started. You do not need async Python, or the framework sections, or the agent pages before your first hands-on session.
Never written code? Do Start Here first — five short pages that get you running Python in a browser with nothing installed.
Already code in Java, C#, C++ or JavaScript? Read Coming To Python From Java, C# or C++ first. It is a translation table, and the rest becomes skimming.
How to use each page
Every page ends with a Try It Yourself block. Copy it, paste it into a new cell in your Colab notebook, run it, change something, run it again.
Reading is not the same as running. The people who get somewhere are the ones whose fingers have made the mistakes.
What is covered
Python That Agent Frameworks Assume is the section general Python tutorials leave out, and it is where most people stall. Nothing in an ordinary beginner's course prepares you to read this:
class State(TypedDict):
messages: Annotated[list, add_messages]
@tool
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return fetch(city)Come back for it when you meet it. Not before.
What is not covered
- LangChain, LangGraph, CrewAI and ADK themselves. This is the Python underneath them, so their documentation makes sense when you get there. The frameworks are taught in the classes and the hands-on sessions.
- Machine learning, model training, or the maths.
- Web development, beyond calling an HTTP API.
About not remembering the syntax
You will not remember most of this, and you do not need to.
Nobody writes code by typing it from memory any more. You describe what you want in plain English and let the AI write it. What you need is to know what to ask for, and to recognise whether what came back is right.
One exception. If somebody is going to interview you as a developer and test your programming, then yes — you will need the syntax in your head. If you are here to build agents, you do not.
So read these pages to build recognition, not recall. When you next see state["messages"] or @tool or Annotated, you want to know what you are looking at. That is the whole objective.
Start with Why Python, Why Coding, or jump to whichever section fits where you are.