What you will be able to do
- Break a business use case into the pipeline's inputs, outputs and constraints
- List the data the pipeline must fetch because the user does not supply it, and classify it as structured or unstructured
- Write a business output requirement as a JSON schema that serves as the pipeline's output contract
- Write down the input and output of each chain component
- Use constraints such as auditability and domain breadth to choose between a deterministic chain, a single agent and a multi-agent system
Key concept
Pipeline input/output specification — A written description of a generative AI pipeline in three parts. The inputs are what the user sends plus the data the pipeline has to fetch. The outputs are the format a named consumer needs. The constraints are the latency, cost, accuracy and compliance limits the pipeline must meet. Every later design choice, from the task type to the agent pattern, is checked against this specification.
1.Inputs, outputs and constraints of a business use case
A business goal such as "help customers return orders faster" does not tell you what to build. Before you pick a model, a retriever or an agent pattern, rewrite the goal as a specification in three parts: what goes into the pipeline, what comes out of it and for whom, and the limits it has to work within. Each part answers a different design question, so a gap in any one of them shows up later as a wrong choice.
The questions come from ordinary ML scoping, carried over to generative AI. What is the target, and so what kind of task is it? What input data exists, and is it enough? Which metrics define success? What latency, throughput and data freshness does serving require? Which stakeholders must sign off, and what do they require? A generative pipeline has the same questions. Its output is just more often text or JSON than a single number.
| Part of the specification | Question to answer | Example for a returns assistant |
|---|---|---|
| User input | What does the caller send? | A chat message plus the conversation history |
| Fetched input | What must the pipeline look up itself? | The customer's recent order and the return policy |
| Output | What format, and who reads it? | A reply to the customer, plus a triggered return and a shipping label |
| Constraints | Latency, cost, accuracy, compliance | Answer within a chat turn; send out-of-window items to a human |
Write the accuracy constraint down as examples, not as an adjective. An evaluation set does this: a curated, representative set of queries with ground-truth answers and, optionally, the documents that should be retrieved. It records the expected input and the expected output side by side, so it serves as the specification in a form you can test. Databricks recommends at least 30 questions, and ideally 100 to 200. The set should include difficult and adversarial cases, such as prompt-injection attempts, because production traffic will include them.
Checkpoint 1 of 8· Match them up
A team is writing the specification for a returns assistant. Match each part of the specification to the item that belongs in it.
Tap a term, then the definition that fits it.
The customer never sends the order record or the policy. The pipeline has to look them up itself, so they belong under fetched input, not under the request. The output covers everything the pipeline produces for its consumers, including actions. Latency and escalation rules are limits the pipeline must work within.
“The agent queries the order database to retrieve the relevant order and references a policy document.”Source: docs.databricks.com
2.Identifying the data the pipeline must fetch
Most of what a pipeline needs is not in the user's message. Take a call-center request: "Can you help me return my last order?" The customer supplies an intent and nothing else. To answer, the agent has to query the order database for the order and check a policy document for the return window. Listing those missing inputs is a separate step, and it comes before choosing tools. Each item on the list later becomes a retriever, a SQL query, a function or an API call. How you define and order those tools is covered in Deterministic chain vs single agent vs multi-agent supervisor.
For each fetched input, record whether it is unstructured or structured, because that decides which kind of component retrieves it. Unstructured supporting data includes PDFs, office documents, wikis, images and videos. Structured data is tabular data with a schema: customer records in a warehouse, transactions in a SQL database, and data from application APIs such as SAP or Salesforce.
| Fetched input | Data type | Databricks capability that serves it |
|---|---|---|
| Return policy document, product manuals | Unstructured | AI Search indexes the knowledge base for semantic or hybrid search |
| Order history in a database table | Structured | Serverless SQL integrates tables and SQL queries into the app |
| Natural-language questions over tables | Structured | Genie agents answer queries about structured data inside multi-agent systems |
| Real-time per-customer features | Structured | Online feature stores provide real-time feature access |
Note who is allowed to see each input as you list it. The retrieval step can be designed to return personal or proprietary data only according to the user's credentials, which turns a compliance constraint into a property of a specific input. Freshness is also a property of each input: if the policy changes weekly, the knowledge base has to be refreshed weekly. Retrieval from an updated knowledge base is one of the main reasons to fetch data instead of relying on what the model learned in training.
Checkpoint 2 of 8· Check yourself
When drafting the input list for a support assistant, you note that it must look up each caller's past transactions, which are stored in a SQL database table. How should the specification classify this fetched input, and which Databricks capability fits it?
Transactions in a SQL database are tabular data with a schema, so they are structured. The capability for structured tables is Serverless SQL, which brings tables and SQL queries into the app. AI Search is for unstructured knowledge such as policy documents. The caller states only an intent, so the pipeline still has to fetch the record itself.
“Serverless SQL lets you integrate tables and SQL queries into your AI app for analytics or transformations.”Source: docs.databricks.com
3.Writing the output as a contract for its consumer
Define an output by who reads it. A person reads prose. A dashboard, a database table or a downstream job needs fields it can parse. Once you name the consumer, the task type follows; the catalogue of types is in Foundation model task types (chat, embeddings, vision, reasoning). Write that task type into the specification next to the output.
In the review case, every alternative fails the consumer in a specific way. Summarization returns a paragraph the dashboard cannot filter on. Open-ended generation, such as a thank-you reply, answers a different business goal. Entity extraction without a fixed structure returns different fields for different reviews. The output that fits is a label limited to the three allowed values plus a confidence number, in the same shape on every call. That fixed shape is the contract.
Write the contract as a JSON schema. On Databricks, the schema goes in the response_format field of a chat request; the mechanics are in Structured outputs with response_format and JSON schema. Here the schema is a design document: the field names and types are the business requirement, written in a form the model, the parser and the consumer all share. The example below records a research-paper extraction requirement as four typed fields.
response_format = {
"type": "json_schema",
"json_schema": {
"name": "research_paper_extraction",
"schema": {
"type": "object",
"properties": {
"title": { "type": "string" },
"authors": {
"type": "array",
"items": { "type": "string" }
},
"abstract": { "type": "string" },
"keywords": {
"type": "array",
"items": { "type": "string" }
}
},
},
"strict": TrueKeep the contract flat and small. Simpler schemas produce higher-quality JSON, and heavily nested schemas produce lower-quality output. A schema can have at most 64 keys. Length limits such as maxLength or maxProperties are not enforced. If the business requires "a summary under 200 characters", the schema will not guarantee it, so the check belongs in post-processing.
Checkpoint 3 of 8· Check yourself
Your draft output contract for a review-analysis pipeline must feed a dashboard. The business also wants a summary of each review under 200 characters. Which way of writing the contract fits these requirements?
Simpler, flatter schemas produce higher-quality JSON, and heavily nested schemas reduce quality. A schema can have at most 64 keys, so 90 keys is over the limit. Length keywords such as maxLength are not enforced, so the 200-character rule has to be checked in post-processing.
“Heavily nested JSON schemas result in lower quality generation. If possible, try flattening the JSON schema for better results.”Source: docs.databricks.com
Checkpoint 4 of 8· Exam question
A retail company wants a pipeline that reads customer reviews and returns a single sentiment label (positive, negative, or neutral) together with a numeric confidence score, so a downstream dashboard can programmatically filter and chart results. Which combination of model task and output design best matches this business goal?
Correct answer: A — A classification task, with each reply validated against a fixed schema that holds a sentiment category and a confidence score
- A. Assigning one of three fixed sentiment values plus a numeric score is a classification problem. The reply must be validated against a fixed schema so the dashboard can read the fields without any text parsing.
- B. The JSON wrapper is structured, but its contents are a prose summary and a topic list. Neither is one of the three sentiment values or a numeric confidence score, so the dashboard has nothing to filter or chart by sentiment.
- C. The model does state a sentiment and a percentage, but they are buried in free-form prose. Wording and placement vary from reply to reply, so the dashboard cannot reliably filter on them. A schema-validated output is needed for that.
- D. Extraction returns text spans copied from each review. It does not return a single sentiment value from the fixed set or a numeric confidence score. Valid JSON does not make these spans the fields the dashboard needs.
Sources5
4.Specifying the input and output of each component
The pipeline as a whole has one input and one output, but every step inside it has its own, and those should be in the specification too. A chain is a series of components in which each one's output is the next one's input; how to choose them is covered in Chain components as an input-to-output pipeline. Writing down each handoff lets you test a component on its own. That matters because a change upstream, such as a different document format, can quietly change the chunks retrieved and so the quality of the answer.
The running example is retrieval-augmented generation (RAG), a technique that combines an LLM with data retrieval so responses draw on proprietary or frequently changing information. During data preparation, documents are split into chunks and each chunk is embedded for a vector database. When a request arrives, the query is embedded with the same embedding model, which is what lets query and chunks be compared by semantic similarity so the most similar chunks come back. The series of steps that runs at request time is the RAG chain.
| Component | Input | Output |
|---|---|---|
| Query preprocessing (optional) | The user's query | A retrieval query, possibly rewritten or reduced to keywords |
| Retrieval | The retrieval query, embedded with the same model as the chunks | The top-ranked most similar chunks |
| Prompt augmentation | The user's query plus the retrieved chunks | A prompt built from a template, often with format instructions |
| LLM generation | The augmented prompt | A response grounded in the retrieved context |
| Post-processing (optional) | The LLM's response | The response after business logic is applied or citations are added |
Two settings in this table are business decisions, not tuning details: how many chunks retrieval returns, and how the augmentation step combines them with the query. Both have a large effect on answer quality. Guardrails also attach to specific handoffs. You can filter inappropriate requests at the input, check user permissions before a data source is read, and moderate content on the generated output. Specifying each handoff tells you where each guardrail belongs.
In the optional post-processing step. Its input is the LLM's response, and its output is that response with citations added or other business rules applied. You can only provide citations if retrieval passes source identity through to that step.
Checkpoint 5 of 8· Put it in order
Each component's output becomes the next one's input. Put these RAG chain components in the order they run when a user request arrives.
- 1.Prompt augmentation: combines the user's query with the retrieved chunks in a template and outputs the prompt
- 2.Query preprocessing: takes the user's query and outputs a retrieval query, possibly rewritten or reduced to keywords
- 3.Post-processing: takes the LLM's response and outputs it with business logic applied or citations added
- 4.Retrieval: embeds the retrieval query with the same model as the chunks and outputs the top-ranked most similar chunks
- 5.LLM generation: takes the augmented prompt and outputs a response grounded in the retrieved context
Each handoff fixes the order. Retrieval needs the retrieval query, augmentation needs the retrieved chunks, generation needs the augmented prompt, and post-processing needs the LLM's response. If you write down each component's input and output, the sequence follows from them.
“The LLM takes the augmented prompt, which includes the user's query and retrieved supporting data, as input.”Source: docs.databricks.com
5.Letting constraints choose the pipeline pattern
The constraints in the specification usually decide the architecture before any model is chosen. Agent designs range from a single LLM call with a prompt, through deterministic chains and single tool-calling agents, to multi-agent systems. The comparison of these patterns belongs to Deterministic chain vs single agent vs multi-agent supervisor. Here the job is to read the right one off the business constraints.
Predictability and auditability point to a deterministic chain. Its steps are fixed in code, so every input follows the same path. That path is easy to test and audit, and latency stays low because no LLM call is spent on orchestration. The cost is flexibility: unexpected requests are handled badly, and new capabilities require code changes. A free-text "describe what looks wrong" prompt fails a compliance requirement for the same reason, because nothing guarantees which checks actually ran.
Varied requests within one domain point to a single agent. In a single-agent system, the LLM decides which tools to call, when to make more LLM calls, and when to stop. Consider a help desk: it can answer a policy question directly, or call lookup_order(customer_id, order_id) and ask the user for a corrected ID if the lookup fails. Because the agent chooses its own path, you need iteration limits or timeouts to prevent loops.
Several distinct specialties behind one entry point point to a multi-agent system. Suppose billing, technical support and returns each need their own logic. A coordinator, or supervisor, inspects each request and routes it to the right specialist, treating each subagent as a tool. A chain that calls all three specialists in sequence for every request misreads the requirement. So does a single generic prompt, or a retriever that returns the whole knowledge base. Before building any of these by hand, check whether Databricks already offers a guided option that covers the use case, such as Knowledge Assistant or an AI function; Agent Bricks vs a simpler pattern vs a custom agent covers when each wins. If its inputs and outputs already match the specification, start there, since a custom system is only worth its added complexity when the guided option cannot cover the need. For example, a schema-driven field extraction matches what ai_extract does: extract structured fields from documents or text using a schema you define.
| Constraint in the specification | Pattern it points to | Cost you accept |
|---|---|---|
| Fixed steps, consistency and auditing first, minimal latency | Deterministic chain | Inflexible; code changes needed to adapt |
| Varied queries in one domain, some on-the-fly tool use | Single-agent system | Less predictable; guard against repeated or invalid tool calls |
| Large or cross-functional domains with distinct expert logic | Multi-agent system with a coordinator | Complex to orchestrate |
Checkpoint 6 of 8· Match them up
Three business specifications each state different constraints. Match each specification to the pipeline pattern its constraints point to.
Tap a term, then the definition that fits it.
Fixed steps, auditability and low latency call for a deterministic chain, where the developer fixes the path in code. Varied requests within one domain, with tool calls decided on the fly, fit a single agent. Several distinct specialties behind one entry point need a coordinator that routes each request to the one specialist that fits. Calling every specialist in turn would not be routing.
“from deterministic chains, through single-agent systems that can make dynamic decisions, up to multi-agent architectures that coordinate multiple specialized agents.”Source: docs.databricks.com
Checkpoint 7 of 8· Exam question
A finance team's business goal is an invoice-processing pipeline in which every invoice must be checked against three specific validation rules in a fixed, unchanging order, with no deviation permitted for compliance reasons. Which agent design pattern best matches this input/output requirement?
Correct answer: A — A deterministic chain in which the developer predefines which validation checks run, in what order and with what parameters
- A. In a deterministic chain the developer's code sets the checks, their sequence and their parameters ahead of time, so the model never chooses what runs. The three rules are applied in the same order to each invoice, which the no-deviation compliance requirement demands.
- B. Tool calling lets the LLM pick the validation tools and their order at run time, so a check could be skipped or reordered from one invoice to the next. Compliance allows no deviation from the fixed order of the three rules, and nothing in this design enforces that order.
- C. A coordinator that picks specialist agents and their order makes the routing a run-time judgment that can differ between invoices. That suits open-ended cases, but not three rules that must run in one unchanging order with no deviation.
- D. Here the model chooses which issues to mention and in what order, so there is no guarantee that the three specific rules were each checked, or checked in the required sequence. A free-form model judgment cannot meet a compliance rule that forbids deviation.
Checkpoint 8 of 8· Exam question
A customer support organization wants incoming requests routed to one of three specialized handlers, a billing agent, a technical support agent, or a returns agent, based on the content of each request, with a top-level component deciding which handler to invoke. Which agent system design best matches this business use case?
Correct answer: A — Supervisor multi-agent pattern: a lead agent reads each ticket's topic and hands the work to the matching domain agent
- A. A supervisor (orchestrator) pattern has a top-level agent classify each incoming ticket by content and delegate it to one domain agent. That is the routing to billing, technical support or returns that the business wants.
- B. Prompt chaining is a fixed pipeline in which every step runs on every input. Each ticket would pass through all three specialists instead of reaching only the one that fits its content, and no top-level component makes a routing decision.
- C. A single agent with several tools and one prompt does everything itself. It has no separate billing, technical or returns handlers and no top-level component that chooses between them, so the required delegation structure is missing.
- D. Evaluator-optimizer is a quality loop in which a generator and a reviewer iterate on a reply. Neither agent is a billing, technical or returns specialist, and nothing sends a ticket to a handler based on its content.
Sources
(9)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“What are the serving and production requirements: latency, throughput, and data freshness?”
↩︎ Inputs, outputs and constraints of a business use case“What input data is available, and is it sufficient to learn the target pattern?”
↩︎ Inputs, outputs and constraints of a business use case - 2.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/evaluate-define-qualityOfficial docs
“An evaluation set is a curated, representative set of queries, along with ground-truth answers and (optionally) the correct supporting documents that should be retrieved.”
↩︎ Inputs, outputs and constraints of a business use case - 3.
“The agent queries the order database to retrieve the relevant order and references a policy document.”
↩︎ Identifying the data the pipeline must fetch“Deterministic chains offer predictable, rule-based flows for well-defined tasks.”
↩︎ Letting constraints choose the pipeline pattern“The LLM adaptively decides which tools to use, when to make more LLM calls, and when to stop.”
↩︎ Letting constraints choose the pipeline pattern“If your use case can be addressed using Knowledge Assistant or an AI functions offering, then start with that guided, simpler option.”
↩︎ Letting constraints choose the pipeline pattern“The agent queries the order database to retrieve the relevant order and references a policy document.”
↩︎ Exam trap 1“When consistency and auditing are top priorities.”
↩︎ Exam trap 3“The agent queries the order database to retrieve the relevant order and references a policy document.”
↩︎ Checkpoint“When consistency and auditing are top priorities.”
↩︎ Prediction“from deterministic chains, through single-agent systems that can make dynamic decisions, up to multi-agent architectures that coordinate multiple specialized agents.”
↩︎ Checkpoint - 4.
“RAG architecture can work with either unstructured or structured supporting data. The data you use with RAG depends on your use case.”
↩︎ Identifying the data the pipeline must fetch“The retrieval step can be designed to selectively retrieve personal or proprietary information based on user credentials.”
↩︎ Identifying the data the pipeline must fetch“combines large language models (LLMs) with real-time data retrieval to generate more accurate, up-to-date, and contextually relevant responses”
↩︎ Specifying the input and output of each component“it's important to evaluate individual components in addition to the overall application.”
↩︎ Specifying the input and output of each component“Assess the RAG application to determine its quality, cost, and latency to ensure it meets your business requirements.”
↩︎ Key concept - 5.
“using a simpler JSON schema for JSON schema definitions results in higher quality JSON generation.”
↩︎ Writing the output as a contract for its consumer“The maximum number of keys specified in the JSON schema is 64.”
↩︎ Writing the output as a contract for its consumer“Heavily nested JSON schemas result in lower quality generation.”
↩︎ Exam trap 2“identifying and classifying product review feedback as negative, positive or neutral.”
↩︎ Prediction“Heavily nested JSON schemas result in lower quality generation. If possible, try flattening the JSON schema for better results.”
↩︎ Checkpoint - 6.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/fundamentals-inference-chain-ragOfficial docs
“The output of this step is a retrieval query which will be used in the subsequent retrieval step.”
↩︎ Specifying the input and output of each component“the retrieval query is translated into an embedding using the same embedding model that was used to embed the document chunks during data preparation”
↩︎ Specifying the input and output of each component“The LLM takes the augmented prompt, which includes the user's query and retrieved supporting data, as input.”
↩︎ Checkpoint - 7.
“The orchestrator treats each subagent as a tool and uses its instructions to route requests to the right one.”
↩︎ Letting constraints choose the pipeline pattern“a multi-agent orchestrator routes requests to specialized subagents from a single entry point.”
↩︎ Exam trap 4 - 8.
“Extract structured fields from documents or text using a schema you define.”
↩︎ Letting constraints choose the pipeline pattern
Also cited
“Serverless SQL lets you integrate tables and SQL queries into your AI app for analytics or transformations.”
↩︎ Checkpoint