import{c as t,Q as a,j as i,m as s}from"./chunks/framework.BPKcPtvA.js";const u=JSON.parse('{"title":"L1: Your First Agent","description":"","frontmatter":{},"headers":[],"relativePath":"labs/l1-first-agent.md","filePath":"labs/l1-first-agent.md","lastUpdated":1780488472000}'),o={name:"labs/l1-first-agent.md"};function l(n,e,r,h,c,p){return a(),i("div",null,[...e[0]||(e[0]=[s(`<h1 id="l1-your-first-agent" tabindex="-1">L1: Your First Agent <a class="header-anchor" href="#l1-your-first-agent" aria-label="Permalink to &quot;L1: Your First Agent&quot;">​</a></h1><p>Build a single-tool agent from scratch.</p><p><strong>Module</strong>: M1 Foundations<br><strong>Est. Time</strong>: 60 min<br><strong>Files</strong>: <code>starter.py</code>, <code>solution.py</code></p><h2 id="objective" tabindex="-1">Objective <a class="header-anchor" href="#objective" aria-label="Permalink to &quot;Objective&quot;">​</a></h2><p>Create an agent that reads a file and answers questions about its contents.</p><h2 id="concepts" tabindex="-1">Concepts <a class="header-anchor" href="#concepts" aria-label="Permalink to &quot;Concepts&quot;">​</a></h2><ul><li>LLM + Tools + Loop = Agent</li><li>Tool definition with input schema</li><li>The agent loop (think → act → observe → repeat)</li><li>The <code>reasoning</code> parameter</li></ul><h2 id="starter" tabindex="-1">Starter <a class="header-anchor" href="#starter" aria-label="Permalink to &quot;Starter&quot;">​</a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> course/labs/L1-first-agent/</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> starter.py</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> test.txt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;What is this file about?&quot;</span></span></code></pre></div><p>The starter has TODO markers where you fill in:</p><ol><li>Define the <code>read_file</code> tool schema</li><li>Implement the <code>execute_tool</code> function</li><li>Implement the <code>run_agent</code> loop</li><li>Wire up the main entry point</li></ol><h2 id="solution" tabindex="-1">Solution <a class="header-anchor" href="#solution" aria-label="Permalink to &quot;Solution&quot;">​</a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">python</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> solution.py</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> test.txt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;What is this file about?&quot;</span></span></code></pre></div><p>Compare your implementation against the solution. Key differences to check:</p><ul><li>Did you set <code>MAX_ITERATIONS</code>?</li><li>Does every tool call include <code>reasoning</code>?</li><li>Does the loop terminate on <code>end_turn</code>?</li></ul><h2 id="checkpoints" tabindex="-1">Checkpoints <a class="header-anchor" href="#checkpoints" aria-label="Permalink to &quot;Checkpoints&quot;">​</a></h2><ol><li>Tool call is made correctly (schema matches)</li><li>Tool result is fed back to the LLM</li><li>LLM produces final answer using tool result</li><li>Loop terminates (doesn&#39;t run forever)</li></ol>`,17)])])}const k=t(o,[["render",l]]);export{u as __pageData,k as default};
