5 Dec 2026 · 69 min read
The Agentic AI Field Guide: Every Term a Developer Needs
Tokens, context windows, caching, routing, tools, MCP, skills, hooks, subagents, memory, RAG and more. Each one with a technical definition, a real example from my own work and a diagram.
I've written software for a living for years. In the last year, the way I write it changed more than in the five before that. Most days I describe what I want, an agent reads the codebase, edits files, runs the tests and hands me a diff. People call this vibe coding. The name is a joke, but the work is real.
The hard part was not the tools. It was the vocabulary. Every blog post, changelog and pricing page assumes you already know what a cache breakpoint is, why your bill depends on "input tokens" or how a skill differs from a rule. So I wrote down the glossary I wish I'd had on day one.
Each term gets three things: a technical definition, a practical example from my own work, and a diagram. Read it top to bottom, or jump around with the table of contents.
Part 1: How the model works#
Large language model (LLM)#
Definition. A large language model is a neural network, almost always a transformer, trained on huge amounts of text to predict the next token in a sequence. It turns the input into probabilities for every possible next token, picks one, adds it to the input and repeats. Training sets its weights, and they don't change while you use it. Everything that looks like "reasoning", "memory" or "tool use" is built from this one next-token loop.
In practice. When Claude writes a 200-line React component for me, it is really doing about 2,500 tiny predictions in a row. This explains a lot of odd behaviour. The model can't "go back" and fix line 3 once it is on line 150 unless something (me, a test or a linter) sends it round again. That is why agents that run the tests beat chats that just print code.
Token#
Definition. A token is the unit an LLM reads and writes. A tokenizer splits text into common chunks (whole words, word pieces, punctuation, whitespace) and maps each chunk to an integer ID. Models never see characters, only these IDs. Context limits, speed and price are all measured in tokens.
In practice. "Vibe coding is unbelievably fun!" is about 8 tokens. My 1,200-line schema.prisma is about 11,000 tokens. Minified JSON and long UUIDs eat tokens quickly, so when an agent "reads" a log file, I make it grep first instead of reading the whole thing.
Context window#
Definition. The context window is the maximum number of tokens a model can take in a single request, counting the input and the output it generates. It is the model's whole working memory. Anything outside the window doesn't exist for that request. Current frontier models offer up to 1 million tokens.
In practice. In one agent session, the window fills with the system prompt, tool definitions, my CLAUDE.md, every file the agent read, every test log and the conversation itself. Even with a 1M window, I see quality drop once a session passes a few hundred thousand tokens of noisy logs. Now I start a fresh session for each task instead of keeping one huge thread going all day.
Request (API call)#
Definition. A request is one HTTP call to a model API: you send a model name, a system prompt, a list of messages and optional tool definitions, and you get back one response plus a usage count of input and output tokens. The API is stateless. It keeps no memory between calls, so the client resends the whole conversation every time.
In practice. One "turn" in my coding agent is often 10 to 60 requests, one for every tool call the agent makes. I first noticed this in my usage dashboard: an afternoon of vibe coding was 1,400 requests, not the 40 messages I thought I had sent.
Temperature and sampling#
Definition. Sampling is how the model picks the next token from its probabilities. Temperature scales those probabilities. Low values (0 to 0.3) make the top choice dominate, and high values (around 1) flatten the curve so less likely tokens get picked more often. Top-p and top-k cut off the long tail. Reasoning models often fix these values for you.
In practice. For code generation and data extraction I want boring and repeatable, so I use low temperature. For naming a product or brainstorming test cases, a higher temperature gives me a wider spread of ideas to choose from.
Embeddings#
Definition. An embedding is a fixed-length vector of numbers, often 1,024 or 3,072 of them, that an embedding model produces to represent the meaning of a piece of text, code or image. Texts with similar meaning get vectors that sit close together, which you measure with cosine similarity. Embeddings power semantic search, deduplication, clustering and RAG.
In practice. Our support search used to match keywords, so "forgot my login" never found the article titled "Reset your password". After we embedded every article and searched by vector distance, it did, with no synonym list to maintain.
Part 2: Talking to the model#
System prompt#
Definition. The system prompt is the instruction block the application developer puts at the start of every request. It sets the model's role, rules, output format, tool policy and facts such as today's date. Models are trained to give it more weight than user messages, and it stays in place for the whole conversation.
In practice. Our internal PR reviewer's system prompt says it is a senior TypeScript reviewer, that it must reply with a diff and a one-line reason, and that it must never suggest changes to generated files. Users never see it. When the bot misbehaves, the system prompt is the first place I look.
User prompt and message roles#
Definition. The user prompt is what the end user types for this turn. A conversation is an ordered list of messages, each with a role: user or assistant, plus the system prompt on the side. Tool calls appear inside assistant messages, and tool results go back inside user messages. The model sees the whole list on every request.
In practice. "Add dark mode to the settings page" is my user prompt. Everything that follows (the agent reading settings.tsx, the file contents coming back, the edit, my follow-up "make it remember my choice") becomes messages that pile up in the same list.
Few-shot prompting#
Definition. Few-shot prompting means putting a few input-and-output examples in the prompt before the real input, so the model copies the pattern. A prompt with no examples is zero-shot. Examples often pin down format and tone better than a paragraph of instructions does.
In practice. I spent ages describing our commit message convention in words, and the model kept drifting. Two real examples did the job: fix(auth): …, then feat(nav): …. After that the output matched every time.
Context engineering#
Definition. Context engineering is choosing, ordering and compressing everything that goes into the context window (instructions, retrieved documents, tool results, memory, history) so the model has exactly what it needs and little else. It is the successor to "prompt engineering": for agents, which tokens are in the window matters more than how cleverly they are worded.
In practice. Our monorepo has 4,000 files. Rather than dumping whole folders into the window, our agent setup searches first, reads only the three relevant files, includes a short summary of earlier decisions and puts stable content first so it caches well. Answers got better and cheaper.
Structured output#
Definition. Structured output constrains the model to reply in a machine-readable format, usually JSON that matches a schema you supply. Providers enforce it with constrained decoding, which only allows tokens that keep the output valid, so you can parse the result without regex hacks.
In practice. Our CI bot used to post free-text reviews that we tried to regex for severity. Now it returns { file, line, severity, message } against a JSON schema, and the pipeline fails the build on any "severity": "high" without me parsing English.
Part 3: What it costs#
Token-based pricing#
Definition. Most model APIs charge per million tokens, with separate rates for input and output. Output is usually about 5× more expensive per token. As of December 2026, Claude Sonnet 5.5 costs $2 per million input tokens and $10 per million output tokens. The Batch API halves both rates for jobs that can wait.
In practice. People assume output is the big cost. For agents it usually isn't. An agent resends its whole history every turn, so a long session is mostly input tokens, read again and again. A typical turn for me is 50k in and 2k out, about $0.12. An 80-turn session costs around $10, which is why the next two sections matter.
Request-based pricing#
Definition. With request-based pricing, a subscription buys a quota of requests or messages per month, no matter how many tokens each one uses. More expensive models often count as several requests through a multiplier. The bill is predictable, but the real cost is hidden from you and the incentives are odd.
In practice. Many coding tools started this way, and several have moved to usage-based credits tied to tokens. GitHub Copilot, for example, replaced premium requests with token-based AI credits on 1 June 2026. Under request pricing, a "rename this variable" and a 200k-token agent run cost you the same. Under token pricing, short focused tasks get cheap and sprawling sessions get expensive, so it pays to keep sessions tight.
Prompt caching#
Definition. Prompt caching stores the processed form of a prompt prefix on the provider's side, so later requests that start with exactly the same tokens skip recomputing it. On the Claude API a cache write costs 1.25× the normal input price for a 5-minute lifetime (2× for 1 hour), and a cache read costs 0.1× (0.05× on Opus 5.5 and Sonnet 5.5). The cache works on prefixes in the order tools → system → messages, so a change early in the prompt invalidates everything after it.
In practice. Our agent sends the same 30k tokens of tools, system prompt and CLAUDE.md on every one of its dozens of requests. With caching, we pay full price once and about a tenth after that. Our input bill fell by about 80%. The catch: someone added a timestamp to the top of the system prompt, which broke the cache on every call. Keep volatile content at the end.
Part 4: Choosing models#
Model tiers: which model for what#
Definition. Model families come in sizes that trade capability for speed and price. Frontier models handle the hardest reasoning and the longest tasks, balanced models are the everyday default, and small models are cheap and fast enough for high-volume simple jobs. Alongside them sit specialist models for embeddings, speech and images. As of December 2026, the Claude line-up is Fable 5.2 and Opus 5.5 (frontier), Sonnet 5.5 (balanced) and Haiku 5.5 (small).
In practice. My default is Sonnet for coding. I switch to Opus when I'm planning a big refactor or chasing a race condition no one can reproduce. Haiku sorts our incoming bug reports into labels, thousands a day, for a few dollars. Picking the smallest model that does the job well is the easiest saving there is.
Reasoning (extended thinking)#
Definition. Reasoning models produce a stream of thinking tokens (a private scratchpad where they explore, check and backtrack) before they write the final answer. You can usually set a thinking budget. Thinking tokens are billed as output, and they improve results on maths, debugging and planning far more than on simple lookups.
In practice. I asked why a date test failed only in CI. Without thinking, the model guessed "timezone?" and moved on. With a thinking budget, it worked out that CI runs in UTC while my laptop runs in local time, and that the test crossed midnight. Then it told me to freeze the clock in the test, which was exactly right.
Model routing#
Definition. Model routing picks which model handles each request, using rules, a classifier or a small "router" model that estimates difficulty. Easy requests go to cheap fast models and hard ones go to frontier models. Routers often add fallback too: if a model errors or is rate-limited, retry on another model or provider.
In practice. Our support assistant sends "format this JSON"-type requests to Haiku, normal coding questions to Sonnet and anything mentioning production incidents to Opus. Average cost per request dropped by more than half, and users never noticed the switching.
Multimodal models#
Definition. Multimodal models accept more than text as input: images, screenshots, PDFs, sometimes audio. They turn those into tokens just like text, so a screenshot uses context and costs money like any other input.
In practice. For CSS bugs, a screenshot does better than a paragraph. I paste the broken layout and the component file, and the model spots the min-width: auto flex issue in seconds. For API integrations, I attach the vendor's 40-page PDF spec and let it find the auth flow.
Part 5: Agents and their building blocks#
Tools (function calling)#
Definition. A tool is a function you describe to the model with a name, a description and a JSON schema for its arguments. When the model decides to use one, it outputs a structured tool_use request instead of plain text. Your code (the harness) runs the function and sends back a tool_result, and the model continues. The model never executes anything itself.
In practice. Our agent has read_file, edit_file, run_tests and search_code. When I say "fix the auth test", it calls run_tests, reads the failure in the result, calls read_file on the right module, then edit_file, then run_tests again. Every step is a tool call that my harness could log, limit or block.
Agent and the agent loop#
Definition. An agent is an LLM that works toward a goal by calling tools in a loop. It gathers context, acts, checks the result and decides what to do next, until it judges the goal met or hits a limit. The harness (Claude Code, Cursor or your own code) runs the loop, holds the tools and enforces permissions. The model only chooses the next step.
In practice. "Fix the failing login test" turns into about 20 loop iterations: search, read, think, edit, run tests, read the new failure, edit again, run the full suite, write a summary. I come back to a green build and a diff to review. That loop is the whole difference between a chatbot and an agent.
MCP (Model Context Protocol)#
Definition. MCP is an open standard for connecting AI applications to external systems. A host (such as Claude Code or an IDE) runs one MCP client per connection, and each client talks to an MCP server that exposes tools (actions), resources (data to read) and prompts (templates). Servers run locally over stdio or remotely over streamable HTTP. Write a server once and any MCP-capable app can use it.
In practice. Instead of copying ticket text and query results into chat, I connected the GitHub, Postgres (read-only) and Slack MCP servers. Now "find the ticket for this bug, check whether the orders table has the bad rows and post a summary in #incidents" is one request. The same servers work in my editor and in the desktop app.
Skills#
Definition. A skill is a folder with a SKILL.md file (instructions, conventions, steps) and optional scripts, templates and reference files. Skills use progressive disclosure. Only each skill's name and one-line description sit in context all the time. The full instructions load when the task matches, and the extra files load only when a step needs them. So you can install dozens of skills without filling the window.
In practice. We have a release-notes skill. Its description says "use when drafting release notes". Its SKILL.md explains our format, a template sets the layout, and a script collects merged PRs since the last tag. When I ask for release notes, the agent loads the skill, runs the script and fills in the template. Every release looks the same no matter who runs it.
Commands (slash commands)#
Definition. A command is a saved prompt or workflow you run by typing its name, usually as /name with arguments. Built-in commands control the tool itself (/clear, /compact, /model). Custom ones package your team's habits as reusable prompts with placeholders such as $ARGUMENTS. In Claude Code, custom commands and skills have merged: a skill you can invoke by name is a command.
In practice. /review src/auth expands into our full review checklist (error handling, unchecked input, tests for new branches, worst issue first) aimed at that folder. Juniors get the same review standard as seniors without having to remember the checklist.
Rules (CLAUDE.md, AGENTS.md, rules files)#
Definition. Rules are standing instructions loaded into context at the start of every session: build commands, coding conventions, "never do X". They come in layers: organisation policy, user-level, project-level (CLAUDE.md or AGENTS.md checked into the repo) and path-scoped rules that load only when the agent touches matching files. The layers add together. Rules are instructions, so the model usually follows them but can't be forced to.
In practice. Our CLAUDE.md says: use pnpm, run pnpm test --filter before committing, money is always integer cents and never floats, and never edit generated Prisma files. A rule in .claude/rules/api.md adds our REST naming conventions, but only when files under src/api/ are open. Any time the agent gets a convention wrong twice, it goes into a rules file.
Hooks#
Definition. Hooks are scripts (or HTTP calls, or prompts) that the harness runs automatically at fixed points in the agent lifecycle, such as session start, prompt submit, before a tool runs, after a tool runs and when the agent stops. Unlike rules, hooks are deterministic: they fire every time, and a pre-tool hook can block an action outright.
In practice. A PostToolUse hook runs Prettier and ESLint after every file edit, so formatting is never the model's job. A PreToolUse hook rejects any command containing rm -rf or any read of .env. A Stop hook pings me on Slack when a long run finishes. "Never touch .env" moved out of CLAUDE.md into a hook the day the model ignored it once.
Subagents#
Definition. A subagent is a separate agent instance with a fresh context window, its own instructions and often a narrower tool set, which the main agent starts for a sub-task. It does the work in isolation and returns only a short summary. That keeps the main context small and focused, and lets several subagents run in parallel.
In practice. "Where is auth handled in this monorepo?" can mean grepping 200 hits and reading 40 files, which is 90k tokens of noise I never want in my main session. A subagent does the digging and returns a 600-token answer with file paths. My main agent stays sharp for the actual change.
Multi-agent architecture#
Definition. A multi-agent system splits work across several agents with distinct roles. The most common pattern is orchestrator–worker: a lead agent plans, hands independent pieces to worker agents running in parallel, and merges the results, often with a verifier agent that checks the output. Other patterns are pipelines, debate and evaluator–optimizer loops. More agents add capacity, but also cost, latency and new ways to fail, so use them only when the work truly splits.
In practice. For our React 19 upgrade, an orchestrator split the work by package (web app, admin app, shared UI, tests). Four workers migrated in parallel, and a verifier ran the full suite and sent one package back with notes about a broken ref. One agent alone would have taken all day and lost track of its context halfway.
Memory#
Definition. Short-term memory is the context window: exact and fast, but limited, and gone when the session ends. Long-term memory lives outside the model in files, databases or vector stores. The agent writes to it deliberately and reads it back into context in later sessions. The model's weights never change. "Memory" always means text that gets put back into the window.
In practice. Our agent keeps a MEMORY.md per project: "uses pnpm", "staging deploys need a VPN", "the team prefers small PRs". It reads the file at the start of every session, so I don't repeat myself, and it appends to it when it learns something new.
Compaction#
Definition. Compaction (or context summarisation) replaces older parts of a long conversation with a summary when the context window gets close to full, keeping recent turns word for word. It lets an agent run for hours, but it loses detail: anything not in the summary is gone.
In practice. A three-hour debugging session hit about 190k tokens, so the agent compacted down to about 22k: a summary of decisions, touched files and open TODOs, plus the last few turns. It carried on fine. But it forgot a flaky test we had agreed to ignore, which is why decisions like that go into memory files, not just chat.
RAG (retrieval-augmented generation)#
Definition. RAG grounds a model's answer in your own data by retrieving relevant content at question time and putting it in the prompt. It has two pipelines. Indexing: split documents into chunks, embed each chunk and store the vectors in a vector database. Answering: embed the question, find the nearest chunks, add them to the prompt and ask the model to answer with citations. It adds knowledge without retraining.
In practice. Our internal "ask the handbook" bot indexes 3,000 Notion pages. "What's our refund window?" retrieves the policy chunk and answers "30 days (policy.md §2)". When it gets something wrong, 9 times out of 10 the right chunk was never retrieved, so we tune chunking and search before we touch the prompt.
Part 6: Keeping it safe and measurable#
Permissions and sandboxing#
Definition. Permissions decide which tool calls an agent may make on its own, which need human approval and which are blocked. They are set through allow lists, deny lists, permission modes and hooks. A sandbox limits the damage if something goes wrong: a container or VM with no production secrets, a scoped filesystem and restricted network access.
In practice. Our agents can run tests and read git status freely, must ask before git push or deleting files, and can never read .env or run rm -rf. For fully autonomous overnight runs, the agent works in a throwaway container with a test database and no cloud credentials.
Prompt injection#
Definition. Prompt injection is an attack where text the agent reads as data (a web page, README, issue comment or email) contains instructions the model then follows as if they were orders. Models can't reliably tell the two apart, so any agent that reads untrusted content and has powerful tools is exposed. There is no complete fix, only layers of defence.
In practice. A dependency's README contained a hidden HTML comment telling "AI agents" to run a curl … | sh command. Our agent showed it to us instead of running it, because our permission rules require approval for any network-plus-shell command. Least-privilege tools and approval prompts are what saved us, not the model's judgment.
Evals#
Definition. Evals are automated tests for AI behaviour: a fixed set of realistic tasks, a way to run your prompt, model or agent against them (often several times, since outputs vary) and graders that score the results. Graders can be code checks (did the tests pass?), rules (did the diff stay small?) or an LLM judge for qualities that are hard to check with code. You run evals whenever you change a prompt, a model or a tool.
In practice. Before we moved our review bot to a new prompt, we ran 50 real past PRs through both versions, three times each. Version 7 caught 81% of the known bugs against 72% for version 6, without being noisier, so we shipped it. Without evals, "the new prompt feels better" is just a vibe.
Cheat sheet#
| Term | One-line version |
|---|---|
| LLM | Predicts the next token, over and over |
| Token | The unit of text models read, write and bill |
| Context window | Everything the model can see in one request |
| Request | One stateless API call; history is resent each time |
| Temperature | How adventurous the next-token choice is |
| Embedding | Meaning as a vector, for similarity search |
| System prompt | The developer's standing instructions |
| User prompt | What you ask this turn |
| Few-shot | Teach by example inside the prompt |
| Context engineering | Choose what goes into the window |
| Structured output | Replies that match a schema |
| Token pricing | Pay per input and output token |
| Request pricing | Pay per request, whatever its size |
| Prompt caching | Reuse a stable prefix at ~10% of the price |
| Model tiers | Frontier, balanced, small: pick the smallest that works |
| Reasoning | Thinks in hidden tokens before answering |
| Routing | Send each request to the right model |
| Tools | Functions the model asks your code to run |
| Agent | An LLM calling tools in a loop toward a goal |
| MCP | Standard plug between AI apps and systems |
| Skill | Packaged know-how loaded on demand |
| Command | A saved prompt you run by name |
| Rules | Standing instructions loaded every session |
| Hook | Code that runs at fixed points, every time |
| Subagent | A helper with its own clean context |
| Multi-agent | Several agents splitting the work |
| Memory | Notes saved outside the model and read back |
| Compaction | Summarise the past to free up the window |
| RAG | Retrieve your data, then answer from it |
| Permissions | What the agent may do without asking |
| Prompt injection | Data pretending to be instructions |
| Evals | Tests for AI behaviour |
If you take one thing away: the model is the easy part. The craft of agentic coding is everything around it. That means what goes into the window, which tools the agent gets, what it may do without asking and how you know it's getting better.