insideout Get Pro

10 · Capstone: a prompt pipeline for a support desk

Pro

Prompting, lesson 10

Capstone: a prompt pipeline for a support desk

Templates, examples, structured output and tool calls working together.

This walkthrough uses ideas from across the module, especially "How a chat request is built", "Few-shot examples", "JSON that always parses", "Letting the model call functions" and "A budget for the context window".

Part 1. The desk on one page

Spoke & Chain, the bike shop from "How a chat request is built", gets about 2,000 support emails a day. A model reads each one, tags it, looks up the order if there is one, and drafts a reply. A person on the support team reads every draft and clicks send.

The model has one tool, lookup_order, which only reads. Its final answer is JSON, and your code saves the reply inside it as a draft. Nothing the model writes can reach a customer on its own. Here is one email going through.

Example 1.1

One email through the desk

  1. email in"Hi, where is order 4417? It was meant to arrive Friday. Ana"

    An email arrives from [email protected]. Whoever wrote it, its text is only ever a user message.

  2. system prompt+tool+3 examples+2 articles+the email

    Your code builds a fresh request from parts. The provider turns the messages into its chat template.

  3. tool calllookup_order("4417")
    code checks:order 4417 belongs to [email protected]→shipped, DPD

    The model asks for a lookup. Code checks the order belongs to the sender before it runs anything, then sends the result back.

  4. {"summary": …, "label": "order", "order_id": "4417", "reply": …}
    checks pass→draft in the agent's queue

    The answer comes back in the schema's shape. Code checks the label and length, and the draft waits for a person.

Your turn

The model can look up orders, and your code saves its drafts, but nothing in the desk sends email by itself. Why leave sending out?

The desk reads text from strangers all day, and some of it will try to steer the model. With a person between every draft and its customer, the worst a fooled model can do is write an odd draft that someone deletes. Reading a draft costs the agent seconds.

Human in the loop

A person who approves a model's output before it takes effect. Here, a support agent reads every draft before it goes to a customer.

Part 2. Building the request

Keep going with Pro

You've done the first part. Pro opens the rest of this lesson, and every other one.

Still to come
  1. Building the request
  2. The answer's shape, and the one tool
  3. What it costs, and what comes next

Prompting overviewSpotted a mistake? Tell us.