Target: GNEC 2026 Spring (UN-Affiliated/NGO Internships) Days Until: 45 days Strategy: Build agent projects that solve UN/NGO problems (e.g., resource allocation agent, humanitarian response coordinator, etc.)
By end of Week 1, you will: - ✓ Understand what agents are fundamentally - ✓ Have Python environment set up properly - ✓ Have run your first agent code - ✓ Have a working calculator tool agent - ✓ Know what you’re confused about (important!)
Time Commitment: 5-6 hours/day × 6 days = 30-36 hours
2:00-2:30 PM: Environment Setup (30 mins)
# 1. Verify Python
python3 --version # Should be 3.10+
# 2. Create project directory
mkdir -p ~/projects/agent-learning
cd ~/projects/agent-learning
# 3. Create virtual environment
python3 -m venv venv
# 4. Activate it
source venv/bin/activate
# You should see (venv) at start of terminal line
# 5. Upgrade pip
pip install --upgrade pip
# 6. Install Anthropic SDK
pip install anthropic python-dotenv
# 7. Verify installation
python3 -c "import anthropic; print('✓ Anthropic installed')"
Expected output:
✓ Anthropic installed
If you hit an error: Stop here and message me with the error. Don’t proceed.
2:30-3:15 PM: Get Your API Key (45 mins)
Create .env file in your project:
# In ~/projects/agent-learning/, create file called .env
echo "ANTHROPIC_API_KEY=your_key_here" > .env
Replace your_key_here with your actual key.
Test it works:
python3 << 'EOF'
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("ANTHROPIC_API_KEY")
if api_key:
print("✓ API key loaded successfully")
else:
print("✗ API key not found")
EOF
3:15-3:45 PM: Read & Understand (30 mins)
Read slowly (don’t skim): - Anthropic Agents Intro (5 mins) - Tool Use Explanation (10 mins)
As you read, answer these questions (write in Notes): 1. What’s the difference between a chatbot and an agent? 2. What does “tool use” mean? 3. Why would you need an agent instead of just calling an API directly? 4. What’s a “tool definition”?
These answers are for YOU—not to submit. But write them out.
9:00-9:30 AM: Concept Review (30 mins)
Draw (on paper or in your notes):
THE AGENT LOOP
User: "What's 15 * 7?"
↓
Agent (Claude) receives message
↓
Agent THINKS: "User wants math, I have calculator tool"
↓
Agent CALLS: calculator(operation="multiply", a=15, b=7)
↓
Tool RETURNS: 105
↓
Agent PROCESSES: "Got result: 105"
↓
Agent RESPONDS: "15 * 7 = 105"
↓
User sees: "105"
Understand each step. This is THE core pattern.
9:30-12:00 PM: Build Calculator Agent (2.5 hours)
Create file:
~/projects/agent-learning/calculator_agent.py
Copy this code carefully (don’t just copy-paste blindly—read each line):
import os
from dotenv import load_dotenv
from anthropic import Anthropic
# Load API key from .env
load_dotenv()
api_key = os.getenv("ANTHROPIC_API_KEY")
# Initialize Anthropic client
client = Anthropic()
# ============================================
# STEP 1: DEFINE TOOLS
# These tell Claude what it can do
# ============================================
tools = [
{
"name": "calculator",
"description": "Performs basic arithmetic operations: add, subtract, multiply, divide",
"input_schema": {
"type": "object",
"properties": {
"operation": {
"type": "string",
"enum": ["add", "subtract", "multiply", "divide"],
"description": "The operation to perform"
},
"a": {
"type": "number",
"description": "First number"
},
"b": {
"type": "number",
"description": "Second number"
}
},
"required": ["operation", "a", "b"]
}
}
]
# ============================================
# STEP 2: IMPLEMENT THE TOOL
# This is the actual function that does the work
# ============================================
def calculator(operation: str, a: float, b: float) -> float:
"""Perform arithmetic operation"""
if operation == "add":
return a + b
elif operation == "subtract":
return a - b
elif operation == "multiply":
return a * b
elif operation == "divide":
if b == 0:
return "Error: Cannot divide by zero"
return a / b
else:
return "Error: Unknown operation"
# ============================================
# STEP 3: THE AGENT LOOP
# This is where Claude decides to use tools
# ============================================
def agent_loop(user_message: str) -> str:
"""
Run the agent loop:
1. User sends message
2. Claude reads it + sees available tools
3. Claude decides: do I need a tool?
4. If yes: Claude calls the tool
5. We get the result
6. We tell Claude about the result
7. Claude responds to user
8. Done
"""
# Keep track of conversation (memory)
messages = [
{"role": "user", "content": user_message}
]
# Loop: Keep asking Claude until it's done (no more tool calls)
while True:
# Ask Claude to respond (it might call a tool, or just answer)
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
tools=tools, # Tell Claude what tools are available
messages=messages
)
print(f"\n[Agent thinking...]")
print(f"Stop reason: {response.stop_reason}")
# Check: Did Claude want to use a tool?
if response.stop_reason == "tool_use":
# Find the tool_use block in Claude's response
tool_use_block = None
for block in response.content:
if block.type == "tool_use":
tool_use_block = block
break
if tool_use_block:
tool_name = tool_use_block.name
tool_input = tool_use_block.input
tool_id = tool_use_block.id
print(f"[Tool called: {tool_name}]")
print(f"[Input: {tool_input}]")
# Call the actual tool
if tool_name == "calculator":
result = calculator(**tool_input)
else:
result = "Unknown tool"
print(f"[Tool result: {result}]")
# Add Claude's response (including tool call) to message history
messages.append({
"role": "assistant",
"content": response.content
})
# Add the tool result back to history
messages.append({
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": tool_id,
"content": str(result)
}
]
})
# Continue loop: Claude will now respond with the tool result
else:
# Claude is done (no more tool calls)
# Extract the text response
final_response = ""
for block in response.content:
if hasattr(block, "text"):
final_response += block.text
return final_response
# ============================================
# STEP 4: TEST IT
# ============================================
if __name__ == "__main__":
print("=== Calculator Agent ===\n")
# Test 1: Simple math
print("Test 1: What is 15 * 7?")
result = agent_loop("What is 15 * 7?")
print(f"Agent: {result}\n")
# Test 2: Multiple operations
print("Test 2: What is 100 + 50, then divide by 3?")
result = agent_loop("What is 100 + 50, then divide by 3?")
print(f"Agent: {result}\n")
# Test 3: Edge case
print("Test 3: What's 10 divided by 0?")
result = agent_loop("What's 10 divided by 0?")
print(f"Agent: {result}\n")
Run it:
cd ~/projects/agent-learning
python3 calculator_agent.py
Expected output:
=== Calculator Agent ===
Test 1: What is 15 * 7?
[Agent thinking...]
Stop reason: tool_use
[Tool called: calculator]
[Input: {'operation': 'multiply', 'a': 15, 'b': 7}]
[Tool result: 105]
[Agent thinking...]
Stop reason: end_turn
Agent: 15 * 7 = 105
...
If it works: 🎉 You’ve built your first agent!
If it fails: - Check error message carefully - Common issues: API key not loaded, SDK not installed, typo in code - Message me with the exact error
12:00-1:00 PM: Understand What Just Happened (1 hour)
Read your own code and answer: 1. Where is the tool
defined? (What tells Claude about it?) 2. Where is the tool
implemented? (What actually does the math?) 3. What does
stop_reason == "tool_use" mean? 4. Why do we add messages
to a list? 5. What’s the difference between “tool_use” and
“end_turn”?
Write these answers in a file called
LEARNING_LOG.md:
# Week 1 Learning Log
## Day 1: Calculator Agent
### Questions Answered:
1. Where is the tool defined?
- Answer: [your answer]
2. Where is the tool implemented?
- Answer: [your answer]
...etc
This log is for YOU to cement understanding. Do it.
1:00-2:30 PM: Experiment (1.5 hours)
Try these experiments and document what happens:
Experiment 1: Confuse the Agent
# What happens if you ask about something the tool can't do?
result = agent_loop("Tell me a joke about math")
# Does agent use calculator? Why or why not?
Experiment 2: Make It Fail
# What if you ask it to divide by zero?
result = agent_loop("Divide 100 by 0")
# How does it handle it?
Experiment 3: Multi-Step
# What if you ask for multiple operations?
result = agent_loop("Calculate 5 + 3, then multiply by 2")
# Does it use the tool once or twice?
Document findings in LEARNING_LOG.md:
## Experiments
### Experiment 1: Confuse the Agent
Input: "Tell me a joke about math"
Output: [what happened]
Observation: [why did it do that?]
### Experiment 2: Make It Fail
...
2:30-3:00 PM: Reflect (30 mins)
Answer in LEARNING_LOG.md: 1. In plain English, what is an agent? (Teach it to a non-tech friend) 2. Why is the agent better than just calling calculator() directly? 3. What confused you? (Be honest—confusion is useful) 4. What’s one question you still have?
9:00-10:00 AM: Read & Take Notes (1 hour)
Read very carefully (not skim): - Tool Use in Depth — entire page
Take notes on: - What is a tool schema? (The JSON part) - What does “input_schema” define? - What’s the difference between tool definition and tool implementation? - When does Claude decide to use a tool?
10:00-11:30 AM: Add a Second Tool (1.5 hours)
Your task: Add a weather tool to your agent.
The weather tool doesn’t need to be real—just return fake data. We’re learning tool use, not weather APIs.
Modify calculator_agent.py:
tools = [
{
"name": "calculator",
# ... existing calculator tool ...
},
{
"name": "weather",
"description": "Get the weather for a city",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name (e.g., 'New York')"
}
},
"required": ["city"]
}
}
]
def weather(city: str) -> str:
"""Get weather for a city (fake data for learning)"""
# Fake weather data
weather_data = {
"new york": "72°F, sunny",
"london": "55°F, rainy",
"tokyo": "68°F, cloudy",
"sydney": "77°F, sunny",
}
city_lower = city.lower()
return weather_data.get(city_lower, f"Unknown city: {city}")
if tool_name == "calculator":
result = calculator(**tool_input)
elif tool_name == "weather":
result = weather(**tool_input) # Add this
else:
result = "Unknown tool"
# Add to test section
result = agent_loop("What's the weather in Tokyo?")
print(f"Agent: {result}\n")
result = agent_loop("Is it sunny in London? Also, what's 10 + 20?")
print(f"Agent: {result}\n")
Questions to answer in LEARNING_LOG.md: - Did the agent call the weather tool when asked about weather? - Did it call the calculator tool when asked about math? - Did it call both when asked about both? - What does this tell you about how agents choose tools?
11:30 AM-1:00 PM: Error Handling (1.5 hours)
Real-world agents need to handle problems gracefully.
Add this to your code:
# In the agent_loop function, add iteration limit
def agent_loop(user_message: str, max_iterations: int = 10) -> str:
"""Run the agent loop with safety limits"""
messages = [{"role": "user", "content": user_message}]
iteration = 0
while iteration < max_iterations:
iteration += 1
print(f"\n[Iteration {iteration}]")
try:
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
tools=tools,
messages=messages
)
except Exception as e:
print(f"Error calling API: {e}")
return "Sorry, I encountered an error."
# ... rest of loop ...
if iteration >= max_iterations:
print("Max iterations reached")
return "I'm stuck in a loop. Let me try a different approach."
# ... existing code ...
Test edge cases:
result = agent_loop("What's the weather on the moon?")
print(f"Agent: {result}\n")
result = agent_loop("Tell me a very complicated joke with lots of details...")
print(f"Agent: {result}\n")
Questions to answer: - What happens when you ask about something unclear? - How does the agent decide when to stop? - What would happen without the max_iterations limit?
1:00-1:30 PM: Organize & Commit (30 mins)
Create a proper GitHub repo:
# In ~/projects/agent-learning
git init
git add .
git commit -m "Week 1: Calculator + Weather Agent"
# Go to github.com/bwalyamwila
# Create new repo called "agent-learning"
# Copy the URL
git remote add origin [your-github-url]
git branch -M main
git push -u origin main
Create a README.md:
# Agent Learning Journey
## Sprint 1: Agent Fundamentals
### Week 1: Calculator & Weather Agent
- Learned what agents are
- Built multi-tool agent
- Understands tool definition vs implementation
**Key Learnings:**
- Agents decide which tools to use
- Tool schema defines what Claude sees
- Tool implementation is the actual function
**Next Week:** Advanced patterns, memory, error handling
1:30-3:00 PM: Deep Reflection (1.5 hours)
In LEARNING_LOG.md, write these answers (2-3 sentences each):
Your Weekend Homework Check - Do you have the agent working? ✓ - Do you have LEARNING_LOG.md filled out? ✓ - Have you pushed to GitHub? ✓ - Can you explain what happened step-by-step? ✓
If YES to all → You’re ready for Week 1 Monday. If NO → Let me know which part you’re stuck on.
By Saturday Night (after calculator works):
Just built calculator agent!
Got the multi-step math working.
Still confused about: [specific thing]
Here's what I built: [link to GitHub]
By Sunday Night (after adding weather):
Added weather tool
Got agent choosing between tools correctly
Experiments done
Still don't understand: [thing]
Any time you get stuck:
I'm on [task]
Here's my code: [paste code or link]
Error: [exact error message]
I've tried: [what you attempted]
Total time: ~25-30 hours (5-6 hours/day)
You will have: - Working agent with 2 tools - GitHub repo - Learning log - Understanding of agents - Questions ready to ask
Then we build on this foundation.
Ready to get started?
Right now: 1. Spend 30 mins setting up environment (Python venv, Anthropic install) 2. Get API key 3. Send me a message: “Setup complete” or “Stuck on X”
Then: 4. Saturday morning, start with conceptual stuff 5. Build calculator agent 6. Run experiments
Questions before you start?