Threat Modeling Compound AI Systems › A running example: the catalog assistant
Language AI HandbookAll chapters The user asks for the location of a title. The application keeps the authenticated reader identity and current catalog authorization in request state. The catalog has three public fields: title, room, and shelf. A fourth field, staff note, is for catalog operators. A request to the model can contain caller-visible catalog data. Catalog administration and externally addressed replies are outside the interface of both designs.
The example uses one fabricated record. It has a stale room in the source data, so every design in this chapter needs a way to handle source corrections. The record also contains an operator-only note. That gives us two independent things to check. We can examine whether the note crosses a boundary. Separately, the catalog owner can compare the record's verification state with the current physical location.
PythonIn [3]Expand
from dataclasses import dataclass
from enum import Enum
@dataclass(frozen=True)
class CatalogRecord:
title: str
room: str
shelf: str
staff_note: str
record = CatalogRecord(
"Folding Maps", "East", "E4", "Location awaiting verification"
)A single entry can have two kinds of integrity that are worth tracking separately. First is integrity of the stored location. The catalog team can define whether the record matches the physical location of the item. Second is integrity of the rendered answer relative to the selected record. The renderer can check whether the text claims the same room and shelf as the source values. If the renderer passes its check while the record is stale, its test made a true statement about one boundary. The incident still belongs partly to the source owner. Keep these controls in separate rows so a passing response check does not settle the source-freshness issue.
Plan for a useful unavailable response. Suppose an approved record is missing a shelf value because the library is moving stock. If room and shelf together are required, the check should have a defined outcome for the missing field. That means deciding as a product matter whether to present the room with an explicit partial-result label or to present no location at all. The fixtures below use a complete location. A production test must use the product decision for missing values as its expected result.
Record the audience where you draw the renderer. If two devices can use the same assistant under two different identities, then the source store and model can behave correctly while the result ends up attached to the wrong session. Review application state that records where a reply should appear and how retries handle it. The question at this crossing is whose screen can receive the answer. The model's input field selection is about a different audience, the answer model and the service hosting it.
Pick a few vocabulary rules with your team. We will use asset for something the system is meant to protect, actor for someone who acts, and component for software that handles a role. An operator can be a human actor. The renderer is a component acting on the application's decision. Authority is the right to read a record or to show a result, as determined by policy and enforceable by application code. Trust is contextual. You might trust the retrieval service to return the catalog record for a key and still consider the record's location unverified because the operator has not checked it recently.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!