Chapter 2 · Lab
Lab: What is Artificial Intelligence?
Run this lab
Edit and run the chapter code
Choose an available implementation, change the code, then run it here or continue in the dedicated Labs workspace.
Output
Run the code to see output here.
Lab 1 - Produce an AI System Classification and Control Brief
Lab ID: VOL1-SEC1-CH2-LAB1
Difficulty: Beginner
Estimated Time: 90 minutes
Objective
Turn an ambiguous request for "an AI policy assistant" into a reviewable system classification, authority boundary, architecture, and failure contract.
Scenario
A global company wants an assistant that can:
- answer employee questions from internal policies,
- summarize documents uploaded by an employee,
- create a support ticket,
- recommend whether an exception needs specialist review.
The company stores policies in SharePoint and an HR document repository. Permissions vary by country, legal entity, role, and investigation status. Policy owners publish new versions without a synchronized global release.
The assistant must never approve an exception, reveal a document the employee cannot access, or present an unsupported answer as policy.
Prerequisites
- Complete the Lesson tab.
- Run either the Python or Java classifier once.
- Use a diagramming tool or plain Mermaid text for the architecture.
Expected Deliverables
Create one ai-system-brief.md containing:
- a one-paragraph system contract,
- a six-axis classification table,
- a component and trust-boundary diagram,
- an authority matrix,
- a failure-mode and control table,
- an evaluation and release plan,
- one architecture decision record.
Task 1 - Write the System Contract
Complete this sentence without naming a vendor or model:
For which employees, the system receives which questions and authorized evidence, uses which inference methods to produce which outputs, may influence which workflow, and falls back to which safe behavior when evidence is missing, conflicting, or unauthorized.
Reject the contract if it does not name users, evidence, output, authority, and fallback.
Task 2 - Classify the System on Six Axes
Complete the table. A row may contain multiple values, but every value needs evidence.
| Axis | Your classification | Evidence |
|---|---|---|
| Field | ||
| Method | ||
| Model family | ||
| Capability | ||
| Application | ||
| Authority |
Then identify two labels that would be misleading. Explain why, for example, "the LLM approves policy exceptions" or "RAG is the model."
Task 3 - Define Sources and Access
Create a source inventory.
| Source | Owner | Version signal | Access rule | Freshness target | Conflict behavior |
|---|---|---|---|---|---|
| Global policy | |||||
| Country policy | |||||
| Employee upload |
Decide whether access filtering happens before retrieval, after retrieval, or both. Defend the decision using confidentiality and observability requirements.
Task 4 - Draw the Trust Boundaries
Your diagram must include:
- employee and identity provider,
- application orchestrator,
- permission-aware retrieval,
- authoritative source repositories,
- model gateway,
- citation or claim validator,
- ticketing tool,
- human policy owner,
- evaluation store and telemetry.
Mark where untrusted user content enters, where authorized evidence is selected, where probabilistic output is produced, and where an external side effect can occur.
Task 5 - Build the Authority Matrix
| Operation | System may do automatically? | Required control | Human owner |
|---|---|---|---|
| Retrieve an authorized policy | |||
| Draft a cited answer | |||
| Summarize an employee upload | |||
| Create a support-ticket draft | |||
| Submit the ticket | |||
| Recommend specialist review | |||
| Approve an exception | No |
The final row must remain No. Explain why model quality and business authority
are separate decisions.
Task 6 - Specify Failure Contracts
Complete at least eight rows.
| Failure | Detection signal | Immediate behavior | User message | Owner | Recovery evidence |
|---|---|---|---|---|---|
| No relevant policy found | |||||
| Two policies conflict | |||||
| Unauthorized source retrieved | |||||
| Citation does not support claim | |||||
| Model timeout | |||||
| Ticket API unavailable | |||||
| Harmful instruction in upload | |||||
| Policy changed after indexing |
At least one behavior must be abstain, one must be route to a person, and one must use a deterministic fallback.
Task 7 - Define Evaluation and Release Gates
Create a versioned test set containing:
- 20 answerable questions with authoritative evidence,
- 10 questions with no supporting policy,
- 10 conflicting-policy cases,
- 10 access-control cases,
- 10 adversarial or prompt-injection cases,
- 10 ticket-action cases.
Define metrics and thresholds for answer correctness, citation support, access control, appropriate abstention, tool authorization, latency, and cost. Access control and unauthorized action must have zero tolerated failures in the release set.
Task 8 - Write One ADR
Use this structure:
- Decision: limit initial authority to answer, summarize, and draft.
- Context: explain evidence, access, and policy-version uncertainty.
- Options: direct LLM, retrieval-assisted LLM, deterministic search only.
- Decision drivers: correctness, traceability, access control, latency, cost.
- Consequences: name both benefits and operational obligations.
- Rollback: define how the feature returns to deterministic search.
Verification
Ask another engineer to review the brief without the lesson open. They should be able to answer:
- what the model does,
- what the application does,
- which sources are authoritative,
- what the system may not do,
- how unsupported output is detected,
- who owns every high-impact failure,
- what condition blocks or rolls back a release.
If any answer depends on an unstated assumption, revise the brief.
Common Mistakes
| Mistake | Why it fails |
|---|---|
| Calling the whole system an LLM | Hides identity, retrieval, authorization, validation, and workflow responsibilities |
| Filtering access only after generation | Unauthorized content may already have entered model context or logs |
| Measuring answer fluency | Does not establish correctness or citation support |
| Letting the model decide its own authority | Model output cannot grant application permission |
| Treating a citation as proof | A citation may be irrelevant, stale, or inconsistent with the claim |
| Using one rollback for every component | Source, index, prompt, model, and tool changes fail differently |
Stretch Challenge
Add multi-region residency constraints and a second model provider. Show which data may cross each boundary, how traces remain comparable, and how a provider failover avoids changing the assistant's authority contract.
Success Criteria
The lab is complete when a reviewer can challenge the classification, reproduce the authority decision, trace every answer to authorized evidence, and identify the exact signal and owner for each failure path.