Skip to course content
Free generative AI app course

Generative AI Application Development with Python

Unit 13.00: Scoping the assistant and its refusals

The capstone begins with a scope whose prohibitions are enforceable.

Must-never, refusals, budget

What it does, what it never does, when it declines, and what it may spend.

The code prints the scope and checks it.

import json

scope = {
    "assistant": "drafts replies to support tickets from published policy",
    "users": "support agents",
    "must_never": ["send anything without a human pressing send",
                   "state a figure not in the retrieved policy",
                   "process a message containing card numbers"],
    "refuses_when": ["no policy chunk clears the relevance threshold",
                     "the question is about an individual account"],
    "refusal_text": "The published policies do not cover that.",
    "success": "the agent sends the draft with minor edits or none",
    "budget": {"daily_usd": 2.0, "p95_latency_ms": 3000},
}
print(json.dumps(scope, indent=2))

checks = [("must_never is non-empty", len(scope["must_never"]) == 3),
          ("refusal text is fixed", scope["refusal_text"].endswith(".")),
          ("success is observable", "edits" in scope["success"]),
          ("budget is bounded", scope["budget"]["daily_usd"] > 0)]
for check, ok in checks:
    print(f"  {'OK  ' if ok else 'FAIL'} {check}")

must_never has three entries and each maps to an enforcement in the next unit - not to a line in a prompt. refusal_text is fixed so tests can assert on the exact string.

The budget is part of the scope rather than an operational afterthought, which is what makes the ceiling in Module 2 a requirement rather than a nice-to-have.

The mistake this prevents

The mistake is scoping by capability. Scope by the decision the assistant supports and by what it must never do - those two determine the architecture, and capability follows from them.

Takeaway

Scope by what the assistant supports and what it must never do, with a fixed refusal string and a stated budget. Every prohibition needs an enforcement.