Chapter 3. Understanding the Agent Activity Lifecycle
Chapter 2 left three failures on the table, and each one got into the agent loop at a different place. The poisoned tool description entered when a tool definition became part of the model’s context. The injected instruction came back inside a log result. The double restart made it all the way to a tool call, and nothing looked at it before it reached production. That difference matters because a control only sees the information that crosses the point where it runs.
Put a hook in front of a tool call, and it sees the tool name and arguments before execution. Depending on how you build it, it can also reach whatever the runtime has collected about the current run. What it doesn’t know is why the model picked that action or what the MCP server will do once the request leaves the runtime. Put a gateway between the runtime and the model provider, and you get a different view. The gateway sees the request going to the provider and the response coming back, including ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access