PRACTICE · 90 minutes
Set up Python and the Anthropic SDK, then make your first real, runnable call to Claude — the opening move of the support-triage assistant we build across this path.
You've spent five modules learning what AI systems are and why they matter. Now I want to get a model talking to you on your own machine — because everything I learned about building these systems, I learned by running something small and watching what it actually did.
When I built my first internal Support Dashboard, the breakthrough moment wasn't the architecture diagram. It was the first time I sent a real customer message to a model and read what came back. That single round trip — message in, answer out — is the atom that every AI system is built from. Get that working and the rest is composition.
Think of this module like learning to start a car before you learn to drive. We're not going anywhere yet. We're just turning the key, hearing the engine, and confirming the dashboard lights come on. Once you trust that the engine runs, the road trip in the next four modules gets a lot less scary.
Key insight: A working AI system starts with one reliable call to a model. Master the single round trip first; everything else is built on top of it.
By the end of this module you'll have a clean project, the Anthropic SDK installed, and a script you can run that sends a real customer message to Claude and prints a triage response.
Across the rest of this path we build one thing, and we build it for real: a support-triage assistant. It's the de-identified, distilled version of the first system I shipped that actual users depended on.
Here's the job it does. A customer message arrives — something like "my export keeps failing" — and the assistant:
That's it. No cartoon café, no imaginary bakery. One realistic assistant that does work a support team actually needs, carried from this module all the way to the capstone.
In this module we build the smallest possible slice of it: a single script that hands one customer message to Claude and prints the reply. Modules 07 through 09 grow that slice into the full assistant.
Why one running example: Carrying the same assistant across every module means each new concept attaches to something you already understand, instead of starting over with a new toy problem each time.
Before we write any code, let's make sure the workbench is set up. None of this is exotic — it's the same toolkit I reach for on every project.
python3 --version.Treat your API key like a password. It can spend real money and should never be pasted into code you commit, shared in a screenshot, or posted in a chat. We'll load it from your environment, not hard-code it — more on that below.
First, a dedicated folder and a virtual environment. A virtual environment is a sandbox: the packages you install for this project stay out of every other project's way, so nothing collides and nothing breaks later.
On Windows the activation line is .venv\Scripts\activate instead. Once it's active, your terminal prompt shows (.venv) — that's how you know packages will land in the sandbox and not your system Python.
Why bother with this? Because the first time I skipped it, I upgraded a library for one project and silently broke another. The sandbox is cheap insurance, and professional setups always use one.
Before installing anything, look at your terminal. Does the prompt start with (.venv)? If it doesn't, the environment isn't active and your packages will install in the wrong place. Activating it is the most common step beginners skip — and the most common reason "but I installed it!" turns into an import error later.
With the environment active, install the official Anthropic SDK. This is the library that turns a Python function call into a request to Claude and hands you back the response.
pip is Python's package installer — think of it as the app store for Python libraries. That one command downloads the anthropic package and everything it depends on into your virtual environment.
Now wire up your API key. The SDK looks for an environment variable called ANTHROPIC_API_KEY, so we set it in the shell rather than writing it into our code:
Common pitfall: Setting the key with export only lasts for the current terminal session. Open a new window and it's gone. For day-to-day work, put the line in your shell profile (~/.zshrc or ~/.bashrc) or use a .env file you keep out of version control — never commit the key itself.
This is the moment the module has been building toward. Create a file called triage.py and type in the following. It's the smallest piece of code that does something real: it sends a customer message to Claude and prints the reply.
Run it with python triage.py. After a moment, Claude's reply prints to your terminal. Let's read what each piece is doing, because we'll reuse this exact shape for the rest of the path:
Anthropic() creates the client. With no arguments, it reads your key from the environment — which is why we set ANTHROPIC_API_KEY and didn't paste it here.model="claude-haiku-4-5" picks the model. Haiku is the fast, low-cost member of the family — the right choice for a learner's first calls and for high-volume triage where speed matters.max_tokens=1024 caps how long the reply can be, so a runaway response can't surprise you with a giant bill.messages=[...] is the conversation — here, one message from the "user" (you, standing in for the customer).You just built the atom. Every AI system in this path — the MCP server, the agent, the full assistant — is this same messages.create call wrapped in more structure. If this runs, you have everything you need to keep going.
Notice we printed response.content[0].text, not response. The SDK doesn't hand you a plain string — it returns a structured object, and the model's words live inside it. Reaching in for .content[0].text is how you get the actual reply.
Now let's make the call do real triage work. The first version just asked Claude to "triage it." We can be far more useful by giving the model a system prompt — standing instructions that shape every reply. This is the seed of our assistant:
The only new piece is system=instructions. The user message is still the raw customer complaint, but now the model knows its job and answers in a consistent, routable shape. That's the difference between a chatbot and the start of a system.
Run the second script a few times with different customer messages. Then ask yourself: what happens when a message is genuinely ambiguous — say, a one-word complaint like "broken"? Should the assistant guess a category, or escalate to a human? There's no single right answer, and how you'd decide is exactly the kind of judgment that separates a demo from a system people can trust. Hold that question; we'll return to it when we add escalation in module 09.
We've turned the key and the engine runs. In the next module we give this assistant a place to live and tools to use by building its first MCP server.
Check what you learned about setting up and making your first real call.
1. Why do we create a virtual environment before installing the Anthropic SDK?
Correct Answer: B
A virtual environment is a per-project sandbox. Installing packages inside it keeps this project's dependencies from clashing with — or breaking — other projects on your machine.
2. In client = Anthropic() with no arguments, where does the SDK get your API key?
Correct Answer: C
With no key passed in, the client reads ANTHROPIC_API_KEY from the environment. That's why we export it in the shell instead of hard-coding it in the script.
3. What does response.content[0].text hold after a successful call?
Correct Answer: A
The SDK returns a structured response object, not a bare string. The model's actual words live at response.content[0].text.
4. Why is claude-haiku-4-5 a sensible model choice for a learner's first calls and for triage?
Correct Answer: B
Haiku is optimized for speed and cost. That makes it a good fit for experimenting cheaply and for triage, where many messages need fast handling.
5. What is the purpose of max_tokens=1024 in the call?
Correct Answer: B
max_tokens limits the length of the generated reply, which also keeps a runaway response from producing a surprisingly large bill.
6. Adding system=instructions to the call changes the assistant how?
Correct Answer: B
The system prompt is standing guidance applied to every turn. Here it tells the model to answer, categorize, and flag escalation — turning a generic reply into the start of a real triage system.