Text size
Dark mode
RecallRunGuides & benchmarks
Learn to build real systemsGuides•Benchmarks•Experiments•Community
Search the site/Free checklist
Read the latest

Guides/AI Engineering

AI Engineering guide

LLMs, RAG, agents, MCP, observability and guardrails: how to build AI features that hold up in production, with runnable Python.

  1. 01What an LLM actually isA large language model is a function with one job: given some text, predict the next token (a word or a piece of a word).
  2. 02Tokens, embeddings & the transformerInside the model, text goes through four steps. It is split into tokens (integers), each token becomes a vector , a stack of transformer layers lets every token…
  3. 03Sampling, latency & costThe model hands back a probability for every possible next token. Sampling decides which one is used, and it is why the same prompt can give different answers.
  4. 04Prompt engineering that holds upA demo prompt is a sentence typed into a playground. A production prompt is a component .
  5. 05Why RAG existsRetrieval-augmented generation (RAG) means: before asking the model, search your documents for the passages relevant to the question, put those passages in the…
  6. 06Embeddings & vector databasesAn embedding model turns a passage into a vector so that passages with similar meaning point in similar directions.
  7. 07Ingestion & chunkingBefore anything can be retrieved it must be loaded (turned into clean text), chunked (split into passages small enough to retrieve precisely and send cheaply)…
  8. 08Retrieval that actually works'Embed the question, take the top 5' is where RAG starts, not where it ends.
  9. 09Build a RAG pipeline in PythonTime to connect the pieces: retrieve, build a prompt with numbered sources, call the model, and return an answer whose citations are checked against what was…
  10. 10Evaluating RAGA RAG system can fail in two places: retrieval did not find the right text, or generation misused the text it was given.
  11. 11Tool use & agentsWith tool calling the model can ask your code to run a function (search, query a database, call an API) and then continue with the result.
  12. 12MCP: the Model Context ProtocolEvery AI application wants tools and data: files, databases, tickets, calendars, internal APIs.
  13. 13Build an MCP server in PythonWith the official MCP Python SDK , a server is a set of type-hinted Python functions with decorators.
  14. 14MCP clients & securityAn MCP client is the part of a host that connects to a server, lists its tools, and routes the model's tool calls to it.
  15. 15Why LLM apps need observabilityA classic web service is healthy if it is fast and returns no errors. An LLM application can be fast, error-free and wrong : it answers from the wrong document…
  16. 16OpenTelemetry fundamentalsOpenTelemetry (OTel) is the open standard for producing telemetry: an API your code calls, an SDK that processes the data, a wire protocol ( OTLP ), and a Collector…
  17. 17Tracing LLM calls with OpenTelemetryOpenTelemetry has semantic conventions for generative AI : agreed span names, attribute names and metrics for model calls, retrieval, tool execution and agents.
  18. 18Langfuse: LLM tracing & evalsLangfuse is an open-source LLM engineering platform (cloud or self-hosted).
  19. 19Grafana, Prometheus, Tempo & LokiThe Grafana stack is the operations view of your LLM system. Prometheus stores metrics, Tempo stores traces, Loki stores logs, and Grafana puts them on one screen…
  20. 20Guardrails, security & cost controlGuardrails are the checks around the model: on what goes in (injection attempts, personal data), on what comes out (schema, grounding, policy), and on what it is…
  21. 21Project: an observable docs copilotEverything in this guide, in one small production-shaped system. docs-copilot indexes every part on this website , answers questions with verified citations …