Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Cheat sheet · AI & Machine LearningFree

Sefism AI Engineering Cheat Sheet

A quick-revision companion to the AI engineering roadmap in eight chapters: how LLMs work, prompting and model APIs, RAG, evals, tool calling and structured output, MCP, agents and durable execution, and running AI systems in production. It comes in Python and TypeScript editions, with snippets using the official SDKs, Pydantic or Zod. Skim a chapter after each roadmap stage, before changing a prompt or model, or before a technical conversation about AI features.

Chapters

8

Sefism · Oct 2026

Concepts

64

Sefism · Oct 2026

Code snippets

24

Sefism · Oct 2026

Editions

2 (Python, TypeScript)

Sefism · Oct 2026

Rules of thumb

9

Sefism · Oct 2026

Format

Cheat sheet

Topic

AI & Machine Learning

Provider

Sefism

Time needed

Reference

Level

Intermediate

Access

Free

What this cheat sheet is

The AI engineering cheat sheet is the quick-revision companion to Sefism's AI engineering roadmap. In eight chapters it covers how LLMs work, prompting and model APIs, RAG, evals, tool calling and structured output, MCP, agents and durable execution, and running AI features in production.

Each of its 64 concepts says what the idea is and why it matters, and most name the mistake people make with it. Twenty-four concepts include a code snippet. It is written to be skimmed before a project or a technical conversation, with links to library resources when a concept needs more depth.

Two editions: Python and TypeScript

The ideas are the same in both editions; the code changes. The Python edition uses the official provider SDKs, Pydantic and NumPy. The TypeScript edition uses the official SDKs and Zod. Both editions are public at their own addresses, so you can read the snippets in your own language before signing up.

Chapter by chapter

1. How LLMs work: tokens and context (9 concepts)

The large language model, tokens and tokenisation (with code), the context window, token pricing, rate limits, temperature and sampling, hallucination, reasoning models and effort, and choosing a model. The chapter's thread is that every token costs money and time.

2. Prompting and model APIs (8 concepts)

The chat messages API, the system prompt, clear and specific instructions, few-shot examples, streaming responses, timeouts, retries and backoff, hosted versus local models, and prompts in version control. Three of these have code: the request shape, streaming and retry handling.

3. RAG: embeddings, chunking and retrieval (10 concepts)

Retrieval-augmented generation, embeddings, semantic search and cosine similarity, chunking strategies, vector databases and pgvector, approximate nearest neighbour indexes, hybrid search, reranking, grounded answers with citations, and when to choose RAG over fine-tuning. This is the most code-heavy chapter.

4. Evals: measure before you add more (8 concepts)

What evals are, error analysis, the eval dataset, code-based assertions, LLM-as-judge, retrieval metrics, regression runs in CI, and prompt injection test cases. The chapter's order is the method: read real outputs, build a small labelled set, check with code first, and trust a judge model only once it agrees with you.

5. Tool calling and structured output (7 concepts)

Tool calling, tool names, descriptions and parameters, the tool calling loop, structured output, validating and repairing model output, tool errors a model can recover from, and tool-selection evals. Most concepts here come with code.

6. MCP: Model Context Protocol (5 concepts)

The Model Context Protocol, hosts, clients and servers, tools, resources and prompts, transports, and building an MCP server, with a snippet for a minimal server.

7. Agents and durable execution (7 concepts)

Workflows versus agents, the agent loop, context engineering, step, time and cost limits, checkpoints and resumable runs, human approval before risky actions, and multi-agent systems.

8. Running AI systems in production (10 concepts)

Tracing and observability, guardrails, prompt injection, prompt caching, semantic caching, model routing, fallbacks and LLM gateways, latency, cost and rate-limit budgets, batch APIs, fine-tuning and self-hosted inference, and AI system design end to end.

Rules of thumb and glossary

Nine rules of thumb close the sheet, among them: read real outputs before writing metrics; start with one well-written prompt and build an agent only when the steps cannot be fixed in code; change one thing at a time and run the evals before and after; treat everything the model reads as untrusted input; put stable content first in a prompt so caching keeps working; log prompt version, model id, tokens, cost and latency from day one; give every agent a step cap and a cost cap; and pin model ids, rerunning evals before you move to a new version.

The A to Z glossary adds over a hundred smaller terms (114 in the Python edition, 115 in TypeScript) to the sheet's concepts.

How to use it with the roadmap

  • After each stage: read the matching chapter (the roadmap's fifth stage maps to chapters 5 and 6) and check you can explain every concept without notes.
  • Before changing a prompt, model or retriever: reread the evals chapter, so you measure the change rather than guess.
  • Before a design discussion or technical round: chapters 1, 3 and 8 cover cost, retrieval and production trade-offs, which is where most AI system questions go.
  • While building: keep chapter 5 open when you design tools; vague names and unhelpful errors cause most tool failures.

How it works on Sefism

The public page at /cheatsheets/ai-engineering/ shows every chapter's title and introduction, with the first chapters open to read in full. Everything on Sefism is free to learn from. Keeping a cheat sheet is one of the actions that uses credits; you get starting credits when you join, and if you are learning seriously and run out you can ask for more. Keeping it opens every chapter in the member area.

Following the AI engineering roadmap also unlocks this sheet, and your first roadmap is free. Roadmap topics link to the concepts here that cover them.

Related on Sefism

Frequently asked questions

Is this cheat sheet tied to one model provider? No. The concepts apply to any provider. The snippets use official SDKs, and the sheet advises pinning model ids in configuration and rerunning evals before switching.

Does it cover fine-tuning? As a decision rather than a tutorial: chapter 3 compares RAG with fine-tuning, and chapter 8 covers when fine-tuning and self-hosted inference are worth it.

I only need MCP. Is this the right sheet? Chapter 6 covers MCP in five concepts within the wider AI engineering picture. If MCP is all you need, Sefism also has a standalone MCP cheat sheet, and the LLM APIs cheat sheet goes deeper on calling models.

aillmpythontypescript

Ready to start?

Opens on Sefism in a new tab.

Open the cheat sheet
Link broken or out of date?

Report a problem

With "Sefism AI Engineering Cheat Sheet". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.