interactive · 10 min

The Agent Loop

Objective: run the perceive–decide–act loop where policy is the swappable seam — the same loop, a deterministic mock by default or a real model behind the toggle.

The loop is the whole game. policy(observation) -> action is provided by the runtime via the Model toggle above: Mock (default, free) — deterministic and key-free — or Real (your key), your own OpenAI-compatible model called directly from your browser. The loop code below never changes — only what is behind policy does. That is the curriculum’s thesis, made real.

Model

In Mock (default, free) the policy returns search when the observation contains "unknown", else answer — deterministic, so the output is always the same. Switch to Real (your key) and the identical loop drives a live model once your key is set; production is this same swap.

Best practice: keep policy(observation) -> action as the only seam. Mock it for fast deterministic tests; swap a real model behind it for production — the loop never changes.

Next: The Mock LLM