7.3 KiB
theme, title, info, author, transition, mdc, lineNumbers, monaco, aspectRatio, canvasWidth, layout, class
| theme | title | info | author | transition | mdc | lineNumbers | monaco | aspectRatio | canvasWidth | layout | class |
|---|---|---|---|---|---|---|---|---|---|---|---|
| seriph | Lesson 05 — What Does the Model Actually See? | English video course for AI Agents in Depth | Bojie Li | slide-left | true | false | false | 16/9 | 980 | cover | cover |
What Does the Model Actually See?
Messages, tool calls, and the Agent core loop
Problems this chapter will solve
Lesson 05
What Does the Model Actually See?
Lesson 06
Why Can One Timestamp Make an Agent Slow?
Lesson 07
Why Do Better Prompts Need Structure, Not More Rules?
Lesson 08
How Can an Agent Know What It Needs to Learn?
Lesson 09
How Can an Agent Stay Oriented in a Long Task?
Why this problem matters
Roles
System, user, assistant, and tool messages have different semantics.
Ordering
A tool result must follow the tool call it answers.
Composition
Every call rebuilds a view from static and dynamic context.
Three ideas to keep in view
Context is a list
Messages—not an abstract cloud of memory
Tool call
An assistant message proposing a structured action
Tool result
A new observation appended to the trajectory
The book's visual model
Single turn vs. Agent loop
Single turn
- One request
- One response
- No environmental feedback
Agent loop
- Repeated requests
- Tool calls and results
- Growing trajectory
Context at the API boundary
messages = [{"role": "user", "content": task}]
while True:
reply = client.responses.create(messages=messages, tools=tools)
messages.append(reply)
if reply.final: break
messages.append(run_tool(reply.tool_call))
Test the claim
Run local tool calling and watch messages grow
Observe: Assistant tool call, tool result, and final answer
class: course-terminal
Switching to the terminal
$ uv run python chapter2/local_llm_serving/main.py --backend ollama --mode single --task "What is the weather in Tokyo?"
What the evidence supports
Finding 1
The model only knows a tool exists because its schema is in context.
Finding 2
Tool results are observations, not hidden side effects.
Finding 3
A malformed message sequence changes the task state the model perceives.