Adventure 8
Adventure 8
Adventure 8
Adventure 8
Three questions to warm up your thinking. Don't look anything up — just predict.
Adventure 8
Adventure 8
Adventure 8
"I don't have access to real-time data."
"It's 18°C and partly cloudy in Tokyo today."
Adventure 8
What: The model generates a plausible-looking but fake value (a date, a fact, an ID) because it doesn't actually have one.
Like: A new employee afraid to admit they don't know your order number — so they confidently make one up.
Why it matters: This is the #1 cause of agent-induced data corruption. Always validate the model's outputs before executing.
Adventure 8
Adventure 8
{
"name": "get_weather",
"description": "Get the current weather in a given city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name, e.g. 'Tokyo'"
}
},
"required": ["city"]
}
}Adventure 8
{ "tool": "get_weather", "args": { "city": "Tokyo" } }get_weather() functionAdventure 8
What: A function description (name + params + docstring) the model can request to be called.
Like: An employee manual entry. "Here'sget_weather— call it when needed." The model decides when. Your code decides what happens.
Why it matters: Tools never live in the model. They're plug-in modules around it.
Adventure 8
{"tool": "delete_file", "args": {"path": "/etc/passwd"}}Adventure 8
messages = [system_prompt, user_question]
while True:
response = model.generate(
messages, tools=available_tools)
if response.is_tool_call:
result = execute_tool(
response.tool_name, response.args)
messages.append(response)
messages.append(result)
continue
else:
return response.textAdventure 8
list_files(directory="Downloads")read_file(name="essay1.txt"). Checks for "rocket" → not found → tries next filespace_essay.txt"Adventure 8
Adventure 8
What: A while-loop letting a model call tools, see results, and decide next steps.
Like: A human doing research. You check one source, that gives you a lead, you check the next — you can't plan every step upfront.
Why it matters: This loop is the only thing separating a chatbot from a worker. Everything in agent-land is built on it.
Adventure 8
Chain | Agent | ||
Steps | Predefined | Decided on the fly | |
Order | Fixed | Dynamic | |
Example | Translate → Summarize → Email | "Figure out what user wants and do whatever it takes" | |
Best for | Repeatable processes | Open-ended tasks | |
If step fails | Chain breaks | Agent tries something else |
Adventure 8
*.py)Adventure 8
Read(file_path="app.py")Edit(old_string=..., new_string=...)Bash("python app.py") — if error, fix and retryAdventure 8
rm -rf, don't commit without permissionAdventure 8
"Tools give the agent capability.
The system prompt gives it character."
Adventure 8
Bash tool access, Claude Code:rm -rf, force-push, or skip pre-commit hooks unless you explicitly say soAdventure 8
You're building an agent for: "Plan my friend's birthday party."
Adventure 8
Adventure 8
Adventure 8
Adventure 8
Bash, Read, and WebFetch.Bash("curl https://...") instead of WebFetch. Both work — but Bash is slower, more expensive, harder to sandbox.Adventure 8
delete_user(id="usr_123")usr_123 doesn't exist. It made up the ID.list_users) before passing them to actions.Adventure 8
foo.py to bar.py in this folder").Adventure 8
Adventure 8
get_weather, post_tweet, get_current_city?)Adventure 8
For each tool call, the class predicts the next call before clicking Allow.
Adventure 8
Adventure 8
Adventure 8
Tool | Function description (name + params + docs) the model can request to be called | |
Tool call | Structured output where model says "please run tool X with args Y" | |
Agent loop | While-loop letting the model call tools and decide next steps | |
Agent | LLM + tools + the loop tying them together | |
Chain | Predefined sequence of LLM/tool steps; less flexible than an agent | |
Context window | Max number of tokens (system + history + new) the model can see at once | |
Hallucination | Model invents a value (ID, URL, filename) instead of admitting it doesn't have one |
Adventure 8
Adventure 8