<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Chapter 21 The AI Agent Runtime on Go: Under the Hood</title><link>https://golang.design/under-the-hood/en/part6hetero/ch21agent/</link><description>Recent content in Chapter 21 The AI Agent Runtime on Go: Under the Hood</description><generator>Hugo</generator><language>en</language><atom:link href="https://golang.design/under-the-hood/en/part6hetero/ch21agent/index.xml" rel="self" type="application/rss+xml"/><item><title>21.1 The Agent Control Loop</title><link>https://golang.design/under-the-hood/en/part6hetero/ch21agent/loop/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://golang.design/under-the-hood/en/part6hetero/ch21agent/loop/</guid><description>&lt;h1 id="211-the-agent-control-loop"&gt;21.1 The Agent Control Loop&lt;/h1&gt;
&lt;p&gt;Chapter 20 was about Go serving a model: a request goes in, a stream of tokens comes out. But systems today often go a step further: they let the model not only answer, but also call tools, chain together multiple steps, and drive itself forward until a task is done. This is the AI agent. The word sounds mysterious, but the stance of this book is unchanged: set the model&amp;rsquo;s intelligence aside and look only at the runtime side. Seen this way, an agent is nothing more than a control loop, and the control loop is one of the oldest and plainest structures in computer science. This chapter uses that lens to reduce an agent to a concurrency problem a Go programmer already knows.&lt;/p&gt;</description></item><item><title>21.2 Tool Calls and MCP</title><link>https://golang.design/under-the-hood/en/part6hetero/ch21agent/mcp/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://golang.design/under-the-hood/en/part6hetero/ch21agent/mcp/</guid><description>&lt;h1 id="212-tool-calls-and-mcp"&gt;21.2 Tool Calls and MCP&lt;/h1&gt;
&lt;p&gt;&lt;a href=".././loop"&gt;21.1&lt;/a&gt; reduced an agent to a control loop, and the most important action inside that loop is &amp;ldquo;execute a tool&amp;rdquo;. This section is about tools specifically: what a tool is mechanically, how the model decides to call it, how the runtime dispatches the call to real code, and how, when the number and the sources of tools explode, the &lt;strong&gt;Model Context Protocol&lt;/strong&gt; (MCP) standardizes the whole thing with a single protocol. See through this layer and you find that a tool call is, in essence, a structured remote procedure call, and RPC is exactly Go&amp;rsquo;s old trade.&lt;/p&gt;</description></item><item><title>21.3 Streaming, Backpressure, and Cancellation</title><link>https://golang.design/under-the-hood/en/part6hetero/ch21agent/stream/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://golang.design/under-the-hood/en/part6hetero/ch21agent/stream/</guid><description>&lt;h1 id="213-streaming-backpressure-and-cancellation"&gt;21.3 Streaming, Backpressure, and Cancellation&lt;/h1&gt;
&lt;p&gt;&lt;a href=".././loop"&gt;21.1&lt;/a&gt; stood up the agent&amp;rsquo;s control loop, and &lt;a href=".././mcp"&gt;21.2&lt;/a&gt; made the tool calls inside it clear. This last section brings the context of Chapter 7 and the concurrency primitives of Chapters 10 and 11 onto the stage for the book&amp;rsquo;s curtain call, because the real difficulty of a production-grade agent lies not in the skeleton of the loop but in three things that run through the entire chain: streaming, backpressure, and cancellation. They are intertwined, and what unifies them is a shape a Go programmer knows all too well, a tree of goroutines bound by a context.&lt;/p&gt;</description></item></channel></rss>