October workshops are openBuild a Search AI Agent$99 early bird

Enroll now
Skip to content

SHORT COURSE 2 OF 6 · BEGINNER · 4 GUIDED LESSONS

Build the agent's control loop.

A tool request is a proposal. Build the code that validates it, executes an allowed operation, retains the observation, and stops. Then decide which information belongs in temporary state and which may be kept.

How does a decision become an observable action?

THE BUILD YOU ARE WORKING TOWARD

A bounded controller and a result validator that distinguish missing data, unsupported answers, and failed reads.

  • Reject invalid tool arguments before execution.
  • Use an observation to change the next controller turn.
  • Separate data shape, supporting evidence, and memory lifetime.
0 / 4 lessons complete
Start this courseChecking your saved progress…

Before you start

Use functions, objects, conditions, and explicit success checks from phase 1.

Each lesson follows the same rhythm: understand three small ideas, edit and run the code, then explain the result. Take one lesson at a time.

In your browser, JavaScript and local tools really execute against inspectable inputs. Model decisions and classroom records are authored examples. The optional SDK project runs separately on your computer with its own setup.

Your lesson sequence

  1. 1Learn → build → reflectA tool needs a clear contractDefine a tool's purpose, argument schema, returned fields, and permitted effects.
  2. 2Learn → build → reflectDecide → act → observeDispatch an allowed tool request, feed its result back, and finish within a turn limit.
  3. 3Learn → build → reflectWhat should the agent remember?Separate current task state, an interaction's history, and deliberately retained memory.
  4. 4Learn → build → reflectReturn something another program can useParse and validate a result, preserve its evidence fields, and handle an error without inventing success.

CONNECT THE FOUR LESSONS

Your course checkpoint

Run the loop with a one-turn allowance, then inspect a well-shaped result that names a room absent from the catalog.

  • Explain why one completed read may still leave the loop unfinished.
  • Point to the observation that prevents a repeated read.
  • Show that passing a shape check does not establish factual support.

Use these lessons’ experiment inputs and lab notebooks to record your evidence. This is a self-review prompt; only the lesson questions and code cases contribute to the progress shown above.

Record and download your findings
Research into practiceThe ideas behind this short course

Original teaching informed by primary research and official engineering guidance. Our exercises isolate mechanisms so you can test them; they do not reproduce a research system or its reported performance.

Yao et al. · ICLR · 2022 preprint · ICLR 2023

ReAct: Synergizing Reasoning and Acting in Language Models

Interleave model-generated reasoning and actions with observations from tools or an environment.

A classroom action trace is not private model reasoning. A deterministic teaching loop does not reproduce the paper's models, experiments, or results.

Anthropic · 11 September 2025

Writing effective tools for agents — with agents

Design distinct tools with clear parameters, relevant returned information, and evaluations of how the agent actually uses them.

A description or schema does not guarantee the right action. A live tool can return different data for the same arguments as its environment changes.

Google · Agent Development Kit · Reviewed 13 September 2026 · undated documentation

Conversational Context: Session, State, and Memory

Separate the current interaction's events and state from searchable information that can span sessions. Choose services according to the required storage lifetime.

In-memory stores lose data on restart. Stored or retrieved information is not automatically true, relevant, persistent, or safe to share between users.

Meta research team · 31 July 2024 · revised 23 November 2024

The Llama 3 Herd of Models

Tool definitions and descriptions guide proposed calls; executed results return to model context. The report covers sequential, nested, and parallel function calls.

This historical model-training report is not a current SDK contract. Generating a call does not execute or authorize it, and benchmark results do not describe classroom performance.

Your JavaScript really runs. The model decisions and school data are authored simulations, so you can learn without an API key. Every workspace also includes a separate real SDK example to explore next. Passing the lab’s cases is practice, not proof that an agent is ready for real-world use.