← All articles

The AI Playbook

Strip away the branding and most production AI systems run on the same handful of building blocks, assembled in different orders to fit the job. A workflow tends to start as a single prompt and grow, one technique at a time, into a system that runs unattended every day. What follows is a field guide to those building blocks: what each one does, and the point at which it starts to earn its keep. Think of it as a vocabulary, enough to scope your own project and to see through the architecture behind a vendor's pitch.

Prompt engineering

The most basic lever is the instruction itself. A prompt defines the task, the role the model should adopt, the format of the output, and the rules it has to follow. Good prompts are specific and grounded in how the work is actually done: they name the fields to extract, the edge cases to watch for, and the standard the result has to meet. A few worked examples written into the prompt, often called few-shot examples, teach the model the pattern faster than a paragraph of description. A large share of the quality gap between a rough draft and a usable output closes here, before any more involved technique is added, which is why prompt design is the cheapest place to invest.

Diagram titled "Structured output as middleware": a "Classify the ticket" prompt feeds an output-schema contract with typed fields — intent (string), urgency (enum), entities (string[]), and a highlighted route_to (enum) — whose value routes the ticket to a billing agent, tech support, or human escalation.
Forcing the model's answer into a typed schema turns a wall of text into clean fields the next step can act on. Here a single field, route_to, decides whether the ticket goes to a billing agent, tech support, or a human.

Context management

A model only knows what sits in its context window at the moment it answers. Context management is the discipline of deciding what to put there: the relevant policy section, the prior steps of a workflow, the few records that bear on the current decision, and nothing that wastes the budget. Windows have grown large, but filling them with everything degrades both accuracy and cost, because the model has to weigh irrelevant text alongside the part that counts. In practice this means trimming inputs to what is needed, summarizing long histories, and passing forward only the results a later step depends on. As workflows get longer, disciplined context management keeps a chain coherent across many steps instead of letting it break down partway through.

Diagram titled "Assembling the context window": three heterogeneous sources — an ERP record, a market-intel API, and internal files — pass through an assembler that retrieves, ranks, and formats them, packing system instructions, the selected records, file excerpts, and the user query into a single context window that is sent to the model.
Context management is an assembly step: separate sources — an ERP record, a market-intel API, internal files — are retrieved, ranked, and packed into one ordered window before the model runs. What earns a place, and what is dropped to save budget, is decided here rather than by the model.

RAG & vector databases

Prompts and context handle what you can supply by hand. Retrieval-augmented generation, or RAG, handles the rest: it pulls the relevant material from a large corpus at the moment of the request and places it in the context for the model to use. The corpus is typically stored in a vector database, which indexes documents by meaning rather than by keyword. Each document is converted into an embedding, a numeric representation of its content, so a query can retrieve passages that are semantically close even when they share no exact words. For enterprise work, this is what lets a system answer from your contracts, your policies, and your prior deliverables rather than from generic training data. The quality of a RAG system depends less on the model than on how the corpus is chunked, indexed, and ranked, so retrieval is where a lot of the engineering effort goes.

APIs & MCP

A model becomes far more useful once it can reach systems beyond its own text. APIs are the standard way to give it that reach: a workflow can call a pricing service, query a database, pull a credit report, or write a record back to a system of record. The Model Context Protocol, or MCP, is a recent open standard that makes these connections consistent. Rather than writing bespoke glue for every tool, a team exposes its systems through MCP servers that any compatible model can discover and call in a uniform way. The practical payoff is reuse: a connector built once for a document store or an internal API can serve every workflow that needs it, which shortens the path from prototype to something wired into real systems.

Diagram titled "One protocol, many servers": an AI app containing an MCP client connects through a single MCP protocol layer to three interchangeable servers — a tools server, a data server, and a resource server.
MCP is a universal port: the app speaks one standard, and any tool, data store, or API plugs in behind it as a server. A connector built once is then reusable by every workflow, instead of bespoke glue for each integration.

Workflow orchestration

Real work is rarely one model call. It is a sequence: read the document, extract the fields, check them against a rule, decide a route, draft an output, and hand it to a person. Orchestration is the layer that runs that sequence as a defined plan, carrying state from one step to the next, branching when a condition is met, and retrying a step that fails. Frameworks such as LangGraph represent a workflow as a graph of steps with explicit transitions, which makes the logic inspectable and the failure points easy to locate. This is also where confidence thresholds live: a step can route a high-certainty result straight through and send a borderline one to review. Orchestration is what turns a capable prompt into a process that runs the same way every time.

Diagram titled "Revenue cycle management (RCM)": an orchestrator — labeled state machine, retries, audit log — advances a claim through Eligibility, Coding, Claim submission, and Adjudication, which branches to either "Payment posted" or "Denial"; a denial flows to Appeal and loops back to Adjudication on resubmission.
Orchestration runs the work as a defined plan: a claim advances through fixed stages and branches on the payer's decision, with denials looping back through appeal until they resolve. Holding state across steps, with retries and an audit log, is what makes the path repeatable.

Human review (HITL)

Few enterprise workflows should run fully unattended, and in regulated work that is rarely permitted. A human-in-the-loop design, or HITL, builds the review step in from the start instead of bolting it on later. The system produces a draft, a citation, or a recommendation, and a qualified person approves it, edits it, or sends it back. Done well, review is targeted: confidence scores and validation checks route the clean cases through quickly and reserve human attention for the items that need judgment. The review step also does double duty, because each correction is a signal the system can learn from, which feeds the quality loop described below. For a cautious compliance officer, a visible human-in-the-loop design is often what makes a project approvable at all.

Model selection

The model is a choosable input, and the right one depends on the task. Larger frontier models reason better over hard, ambiguous problems; smaller and faster models handle high-volume, well-defined steps at a fraction of the cost and latency. Many production systems route by step, using a capable model for a difficult extraction or a final draft and a lighter one for classification or simple formatting. Selection also covers practical constraints: context window size, support for tool calling, data-residency and privacy terms, and whether the model can be self-hosted. Because the frontier moves quickly, it helps to keep the model behind an interface you can swap, so a better or cheaper option can be adopted later without rebuilding the workflow around it.

Fine-tuning

Fine-tuning adjusts a model's own weights by training it further on examples from your domain. It is the most involved option, and often unnecessary, because prompting, retrieval, and orchestration solve most problems on their own. Fine-tuning earns its place when you need a consistent style or format at scale, when you have a large, high-quality set of labeled examples, or when a smaller fine-tuned model can match a larger general one on a narrow task at much lower cost. The cost is upkeep: a fine-tuned model is a trained asset that has to be versioned, evaluated, and retrained as the work changes, while a prompt or a retrieval index can be edited in minutes. For most teams it makes sense to prove the workflow with the lighter techniques and reserve fine-tuning for the cases where the numbers justify it.

Quality & cost considerations

Every choice above trades performance against cost, and the only reliable way to manage that tradeoff is to measure it. A quality-assurance set, or eval set, is a fixed collection of representative inputs paired with known correct answers. Running each version of a workflow against the same eval set converts vague impressions into numbers: extraction accuracy, how often a draft needs material correction, how many edge cases are handled, and the cost and latency per run.

Once that measurement is in place, each decision in the playbook can be made on evidence. A cheaper model, a shorter context, or a smaller retrieval set lowers cost, and the eval set shows whether quality holds or slips below the line the work requires. A more capable model, richer retrieval, or an added review step raises quality, and the same measurement shows whether the gain is worth the spend. Fine-tuning is judged the same way, by comparing a tuned small model against a larger general one on the identical set. The discipline is to fix the quality the work demands, find the cheapest configuration that clears it, and re-run the evals whenever a model, a prompt, or a corpus changes. An eval set converts cost and quality from a matter of opinion into an engineering problem a team can solve and defend.