AI Agents & LLMs, step by step
Set up once, then work through five stages in order. Each stage has 10 interview questions that build on the ones before, and ends with a small project that uses what you just learned. Every answer links to the papers and official docs it is based on.
Stage 0: set up once
About ten minutes. After this, every code example in the track runs with one command.
1Install Node.js 20 or newer
Check with node -v. Any current LTS release works. The examples are TypeScript run directly with tsx, so there is no build step.
node -v # v20 or newer2Create a practice project
One folder for the whole track. Add the extra packages for each stage when you reach it.
mkdir ai-practice && cd ai-practice npm init -y npm pkg set type=module npm i @anthropic-ai/sdk zod npm i -D tsx typescript @types/node3Get an API key
Create a key in the Claude Console (platform.claude.com) and set it in your shell. The SDK reads ANTHROPIC_API_KEY automatically. Never commit the key or paste it into code you share.
export ANTHROPIC_API_KEY="sk-ant-..." # macOS / Linux # Windows PowerShell: $env:ANTHROPIC_API_KEY="sk-ant-..."4Run your first call
Save this as hello.ts and run it. If it prints an answer, every example in the track will work.
hello.ts
tsx1// hello.ts2import Anthropic from "@anthropic-ai/sdk";34const client = new Anthropic();5const res = await client.messages.create({6 model: "claude-haiku-5-5", // cheapest current model, fine for practice7 max_tokens: 300,8 messages: [{ role: "user", content: "Say hello and explain what a token is in one line." }],9});10for (const b of res.content) if (b.type === "text") console.log(b.text);11console.log(res.usage); // tokens you were billed for5Read the examples the right way
Examples use claude-opus-5-5 (the most capable model). Swap in claude-haiku-5-5 while practising to keep costs to cents. Lines starting with declare function are parts you supply (your database, embedding provider or search API). The pure TypeScript examples (attention, cosine similarity, RRF, LoRA, DPO, pass^k) need no key at all.
npx tsx hello.ts # for any example: copy it into a file, fill in the declare'd parts, then npx tsx example.ts
How LLMs work
Understand what a model actually does with your prompt, so later choices (context size, sampling, caching, RAG vs fine-tuning) make sense.
- 1What is a large language model (LLM)?Easy
- 2What are tokens, and why do they matter?Easy
- 3How does self-attention in a transformer work?Medium
- 4What is a context window?Easy
- 5What do temperature, top-p and top-k control?Medium
- 6How are LLMs trained? Explain pre-training, fine-tuning and RLHF.Medium
- 7What are hallucinations, and how do you reduce them?Easy
- 8What are embeddings, and how is similarity measured?Medium
- 9What is the KV cache, and why does it speed up inference?Medium
- 10Prompting, RAG or fine-tuning: when do you use each?Hard
Prompting and model features
Get reliable, well-formatted answers on purpose, and use the API features (system prompts, JSON output, caching, thinking, streaming) that real apps rely on.
- 11What is prompt engineering, and which techniques matter most?Easy
- 12What is the difference between zero-shot and few-shot prompting?Easy
- 13What is chain-of-thought prompting?Medium
- 14What is self-consistency in LLM reasoning?Medium
- 15What is a system prompt, and how do message roles work?Medium
- 16How do you get reliable structured (JSON) output from an LLM?Medium
- 17What is prompt injection, and how do you defend against it?Hard
- 18What is prompt caching, and how do you use it well?Medium
- 19What are reasoning models and "extended thinking"?Medium
- 20Why stream LLM responses, and how do you do it?Medium
RAG and fine-tuning
Answer from your own documents with citations, measure retrieval quality, and know when fine-tuning is the right tool instead.
- 21What is Retrieval-Augmented Generation (RAG)?Easy
- 22How do you chunk documents for RAG?Medium
- 23What is a vector database, and how does approximate nearest-neighbour search work?Medium
- 24What are hybrid search and reranking, and why do they improve RAG?Medium
- 25How do you evaluate a RAG system?Hard
- 26What is the "lost in the middle" problem?Medium
- 27What are query rewriting and HyDE in retrieval?Hard
- 28How do you make an LLM cite its sources reliably?Medium
- 29What is LoRA and parameter-efficient fine-tuning (PEFT)?Medium
- 30How does DPO differ from RLHF?Hard
Agents, tools and MCP
Build an agent loop yourself, give it tools safely, connect tools over MCP, and know which workflow pattern fits a task.
- 31What is an AI agent, and how is it different from a workflow?Easy
- 32How does tool use (function calling) work?Medium
- 33What is the ReAct pattern?Medium
- 34How do you implement an agent loop?Medium
- 35How does memory work in AI agents?Medium
- 36What is the Model Context Protocol (MCP)?Medium
- 37How do multi-agent systems work, and when should you use one?Hard
- 38What planning strategies do agents use?Medium
- 39What is reflection or self-critique in agents?Medium
- 40What are the common agentic workflow patterns?Hard
Shipping to production
Make an LLM feature trustworthy and affordable: evals, guardrails, retries, tracing, cost control, and the system-design answer that ties it together.
- 41How do you evaluate LLM applications?Medium
- 42How do you make AI agents safe in production?Hard
- 43How do you reduce the cost and latency of an LLM app?Medium
- 44How do you handle rate limits, retries and errors with LLM APIs?Medium
- 45How do you monitor and debug LLM apps and agents in production?Medium
- 46What is context engineering, and how do you manage context in long-running agents?Hard
- 47How is LLM inference optimised for serving at scale?Hard
- 48How are AI agents benchmarked?Medium
- 49How do you test code that calls an LLM?Medium
- 50System design: how would you build an AI customer-support agent?Hard
Finished all five?
You can explain how LLMs work, build RAG and agents with tools and MCP, and talk about evals, safety and cost like someone who has shipped them. Go back through the Hard questions without looking at the answers, then try question 50 as a timed system-design answer.