Before an LLM can act as an “agent,” it’s just a function: text in, text out. This module is that function, nothing more.
messages list simulates a conversationresponse.content is a list of blocks; we care about text blocks here)Every API call is stateless. Claude doesn’t remember your last message unless you send it back to Claude yourself:
messages.append({"role": "user", "content": user_input})
response = client.messages.create(model=MODEL, max_tokens=1024, messages=messages)
messages.append({"role": "assistant", "content": reply})
That messages list — growing with every turn — is the conversation’s memory. There is no hidden state on Anthropic’s servers. This single fact is the foundation for everything later in this course: memory, tools, and agent loops are all just structured ways of managing what goes into that list.
Don’t have an API key yet? Module 0 walks through creating an Anthropic account and generating one, step by step.
pip install -r requirements.txt
export ANTHROPIC_API_KEY=your_key_here # or set it in your environment
python agent.py
Module 2 — Tools & Function Calling gives Claude the ability to do things, not just talk.