How coding agents work

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Demystifies coding agents as just an LLM plus system prompt plus tool loop, letting engineers build their own instead of treating commercial agents as magic.

Read this as

Simon Willison explains how AI coding assistants like OpenAI Codex actually work. A coding agent is a large language model, a text-prediction system, wrapped in software that adds extra abilities, such as running commands, using hidden instruction prompts. The model can't remember past chats, so the software resends the whole conversation each time, which is why longer chats cost more. Anyone using tools like Claude or Gemini can benefit from understanding this.

Willison argues coding agents are mechanically simple: an LLM (e.g. Claude Opus 4.6 or Gemini 3.1 Pro), a hidden system prompt, and callable tools in a loop. Costs scale with tokens, providers charge for both input and output, though cached input tokens get cheaper rates, which is why agents avoid editing earlier messages. Teams evaluating or building agents can treat the core as a few dozen lines of code; the competitive edge lies in the surrounding engineering, not the model itself.

An agent harness extends an LLM (tokens in, completion out; multimodal images are tokenized, not OCR'd) with a system prompt and tools invoked via parseable markup like <tool>get_weather("San Francisco")</tool>. Conversations are stateless, so the full history is replayed each turn; prompt-prefix caching reduces input cost, so agents preserve earlier content unchanged. Reasoning modes spend extra tokens on intermediate thinking, aiding debugging. Willison notes a basic tool loop is a few dozen lines of code on an existing LLM API.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

OpenAI Codex Claude Opus 4.6 Gemini 3.1 Pro GPT-5.4 Qwen3.5-35B-A3B OpenAI tokenizer

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading