Skip to content
Loop & Lede

    Navigate ↑↓ · Open ↵ · Close esc

    · 1 min read

    A Note on Agent Loops

    A short, code-bearing test post for callouts and the copy-code button.

    This is a short test post, not an essay — it exists to exercise the callout component and the copy-code button against real Shiki output.

    A minimal loop

    Most agent loops boil down to the same three steps: read the state, decide an action, apply it.

    async function loop(state) {
      while (!state.done) {
        const action = await decide(state);
        state = apply(state, action);
      }
      return state;
    }

    This post is tagged craft, same as on-rereading and on-marginalia, so it should also show up in each other’s “Related posts” section.