Build your own AI agent harness

The loop that turns a chat model into an agent that uses tools, safely.

Every coding assistant, support bot and “agent” product runs a loop like this: Claude Code, Cursor, ChatGPT with tools. The model only writes text; the harness is what actually runs the tools and keeps it on a leash.

About 100 minutes across 5 stages. Skills: Parsing model output, Tool dispatch, Input validation, Budgets and loop detection.

The guides are part of licode Club.

Stages

  1. Turn each model reply into a structured call or answer.
  2. Run each tool and stop at the answer.
  3. Validate arguments against each tool’s schema.
  4. Cap the number of tool calls.
  5. Detect a stuck model and print a run report.