What an agent actually is
We'll cover the following
An LLM in a harness with tool calling is an agent, or very close to one. The question is who is in control.
| Who picks the next step | |
|---|---|
| Workflow | Your code. "Retrieve, then summarize, then answer." The LLM fills in blanks. |
| Agent | The LLM, in a loop. |
The loop
messages = [user question]
repeat:
response = LLM(messages, tool definitions)
if response has no tool call:
return response # done
result = run the tool the LLM asked for
messages.append(tool result)Everything else (memory, planning, multi-agent) is built on this loop.
Tool calling mechanics
- You send the LLM a description of each tool: name, what it does, and a JSON schema for the arguments.
- The LLM does not run anything. It outputs "call
search_orderswith{id: 42}". - Your code runs the tool and feeds the result back as a message.
Memory
- Short-term: the message history inside the loop.
- Long-term: stored outside (a DB or vector store) and retrieved when needed.
Check yourselfWho executes the tool call: the LLM or your code?
Your code. The model only emits the tool name and arguments; your harness runs it, validates it, and returns the result.
Summary: say it in the interview
- "An agent is a loop where the model chooses the next action. Tools are just functions my code runs on its behalf."