# Applications

> Prompt engineering, structured outputs and function calling, RAG, agents, and MCP and the tool ecosystem: the engineering methods that turn a model that can talk into a product that is reliable, measurable and easy to iterate on.

- URL: https://dmxsf.com/en/wiki/applications/
- [DMXSF](https://dmxsf.com/en/about/)
- Updated: 2026-11-18

## After this chapter you will be able to

- Write a task as a checkable spec, layer the messages, and measure every prompt change on a small evaluation set.
- Make a program use model output reliably: JSON mode, constrained decoding and the message round trips of function calling, and know that format constraints can hurt reasoning.
- Build a RAG pipeline with evaluation: chunking, hybrid retrieval, reranking and citations, measured with Hit@k and MRR.
- Design a controllable tool-calling loop that handles failures, write confirmation and prompt injection, and measure its stability with pass^k.
- Read MCP messages and error semantics, measure how many tokens tool definitions cost, and choose between listing every tool, retrieval and progressive disclosure.

For a first application, start with [Your first agent](https://dmxsf.com/en/wiki/applications/first-agent/) to learn tool dispatch and stopping with a read-only function.

A strong model handed straight to users is still only a demo. Application engineering is about making the model do the right thing **reliably** in real scenarios. This chapter starts with the cheapest levers, prompts and structured output; then RAG, which makes the model answer from your own material; then agents, which call tools and finish multi-step tasks, and [agent evaluation](https://dmxsf.com/en/wiki/applications/agent-evaluation/), which grades the system of model, tasks and protocol together; and finally MCP and the tool ecosystem, for when there are too many tools to fit in the context. The further along, the more complex the system, and the more it needs evaluation to hold it up.

Every page comes with experiments you can run: on a small reproducible corpus or task, they measure the gain of each step instead of tuning by feel. After building an application, go back to the [Evaluation](https://dmxsf.com/en/wiki/evaluation/) chapter and set a regression baseline for your system; and before launch, read [Safety and Alignment Risks](https://dmxsf.com/en/wiki/safety/): untrusted content gets treated as instructions by the model, and answers it is unsure of get treated as facts.

Related paper explainers: [Chain-of-Thought](https://dmxsf.com/en/blog/chain-of-thought-prompting/), [ReAct](https://dmxsf.com/en/blog/react-reasoning-and-acting/), [Toolformer](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/) and [RAG survey](https://dmxsf.com/en/blog/rag-survey/).

[Agent context and memory](https://dmxsf.com/en/wiki/applications/context-and-memory/) covers token budgets, atomic tool turns, and versioned cross-session preferences.

[Chapter labs on GitHub](https://github.com/dmxsf/dmxsf/tree/main/labs/applications)
