Part 3 · Build

Build the agent on your own machine

Part 3 has nine guided TypeScript stages (0–8) plus a Stage 9 transfer project. This page gets the local tools working, proves offline Stage 0, and then hands you to the repository without pretending the website can see your progress.

A launchpad, not an online IDE

Your code, model keys, outputs and progress stay in your local clone. This static website neither runs the course nor reads course/progress.json.

Before you begin

  • You can read and edit basic TypeScript: functions, objects, loops and await.
  • You have Git, Node.js 20.9 or newer, a terminal and a code editor.
  • Allow two to three hours for the nine guided stages (0–8); the Stage 9 transfer project is open-ended, and you can stop and return later.

Run offline Stage 0 first

  1. 1. Clone and install

    Clone the public repository, enter it, and install the exact locked dependencies.

    git clone https://github.com/HUDongpin/agent-edu.git
    cd agent-edu
    npm ci
  2. 2. Make the one Stage 0 edit

    Open course/stage0-hello/run.ts and replace the empty QUESTION string with a question of your own.

    export const QUESTION = "What should I notice about an API?";
  3. 3. Run and check it without a key

    Offline mode uses a bundled deterministic stand-in. It is the safest preflight: no provider request, private recording or token charge.

    npm run course:offline
    npx tsx course/stage0-hello/run.ts --offline
    npx tsx course/check.ts 0 --offline

The check succeeds when you see

PASS  you asked the model something
PASS  an answer came back

  stage 0 complete.

Choose a Provider only when you are ready

Scripted offline mode

Needs no key and makes no paid request. It proves the code path, but cannot demonstrate model variation.

--offline

DeepSeek

The default live Provider. Your terminal process reads DEEPSEEK_API_KEY; live stages incur DeepSeek charges and print their measured spend.

export DEEPSEEK_API_KEY=your_key_here

Claude

An optional local Provider for comparison. Set the key and CAFE_PROVIDER. Claude pricing can be much higher, so inspect the printed estimate before a run.

export ANTHROPIC_API_KEY=your_key_here
export CAFE_PROVIDER=anthropic

Costs are Provider-side

Offline is free. Live totals vary with the selected model, tokens, cache and current Provider prices. Treat any course estimate as dated; the Provider dashboard is the billing record.

Progress belongs to this clone

The course checker writes course/progress.json locally. The website does not show a percentage, Resume or Completed state for Part 3 because it cannot observe that file.

npx tsx course/report.ts
# reads course/progress.json in this clone

What you will take away

Stage 9 asks you to move beyond the café and document an agent in a domain you know. A reviewable submission includes:

  • the problem boundary and what the model is allowed to decide;
  • one realistic failure input that breaks the simple rules;
  • a small eval set with evidence, not just selected good outputs;
  • a code-enforced gate before the most irreversible action;
  • the Provider, tool and untrusted-input boundaries;
  • a short retrospective on failures, trade-offs and the next test.

If the local setup is too steep

Return to the browser Lab and practise rules → prompt → eval first. It teaches the same control handoff without asking you to install a development environment.