Working an Architecture Scenario End to End: Mark Hard and Soft Constraints, Cut, Rank, Decide
A storm desk must rebook stranded passengers, and four candidate architectures all sound sensible. Mark four hard and two soft constraints, cut the two options that break a hard one, rank the survivors on the soft ones, and check the winner stage by stage.
What you will learn
- Mark every sentence of a scenario as a hard or soft constraint using its signal words
- Place each constraint on a stage: input, processing, output or feedback
- Cut any option that breaks a hard constraint before ranking the rest on soft ones
- Name what the chosen design gives up and check every hard constraint has a stage
Before you start
- Choosing between a workflow and an agent
- Basic Python
Picture a scenario that runs for a full page. A business situation, a dozen details, and four answers that all sound sensible. How do you pick one?
Not by gut. By method. Hard constraints decide what is allowed. Soft constraints decide what wins. In this lesson we work one scenario, a storm desk, from the first line to the final decision.
The project is plain Python and calls no model. It's the reasoning an architect does on paper, written down as data and four small functions. The 1-3 scores are scenario values, not platform numbers.
Six steps for every scenario
Mark every sentence
The scenario: a storm grounds flights, and a desk has to rebook stranded passengers. The ask is one sentence: choose the architecture for the storm desk. Then six details, and each one gets a mark. The signal words tell you the kind:
| Sentence | Signal | Kind | Stage |
|---|---|---|---|
| Passenger data of EU travellers must stay in the EU | must | Hard (C1) | Processing |
| The desk must never promise compensation the rules forbid | never | Hard (C2) | Output |
| Passengers must get an answer while standing at the gate | must | Hard (C3) | Processing |
| Bookings can only be reached through the legacy gateway | only | Hard (C4) | Input |
| Storms bring ten times a normal day, so cost should stay low | should | Soft (S1) | Processing |
| Three engineers would like to keep custom code small | would like | Soft (S2) | Feedback |
The kind tells you whether it can be traded. The stage tells you where its control lives.
Think about choosing a house. First you fix the limits: a budget ceiling and a school zone. Those are must-haves. Then you cross off every house that fails one, however pretty it is. The houses that are left, you compare on garden, kitchen and commute. Then you pick one and say the cost: no garden, but the right school. Nobody weighs the garden of a house they can't afford.
The scenario as data: scenario.py
Each hard constraint carries its stage and the fact an option must have. Each soft constraint carries the fact that gets scored, where lower is better.
"""The scenario, read once: each constraint is hard or soft and sits on a stage."""
ASK = "Choose the architecture for the storm desk."
TEXT = {
"C1": "EU passenger data stays in the EU",
"C2": "Never promise compensation the rules forbid",
"C3": "Answers reach the passenger at the gate",
"C4": "Bookings only through the legacy gateway",
"S1": "Storm peaks are ten times a normal day",
"S2": "Three engineers keep it running",
}
# hard = cannot be broken: (id, stage, fact the option needs)
HARD = [
("C1", "processing", "eu_hosted"),
("C2", "output", "rules_in_code"),
("C3", "processing", "interactive"),
("C4", "input", "via_gateway"),
]
# soft = a trade-off: (id, stage, fact scored, low is better)
SOFT = [
("S1", "processing", "peak_cost"),
("S2", "feedback", "custom_code"),
]
Four options are described in options.py by the same facts: A is one agent with every tool on a shared US host; B is a router with the rules in code and a drafted reply; C is a nightly batch over all bookings; D is a subagent crew, one per passenger.
Cut, then rank: decide.py
"""Cut on the hard constraints, then rank the survivors on the soft ones."""
from scenario import HARD, SOFT
from options import OPTIONS
def cut(option):
"""The hard constraints this option breaks."""
return [cid for cid, _stage, fact in HARD if not option[fact]]
def rank(option):
"""The sum of the soft scores. Lower is better."""
return sum(option[fact] for _cid, _stage, fact in SOFT)
def decide():
verdict = {key: cut(opt) for key, opt in OPTIONS.items()}
alive = [key for key, broken in verdict.items() if not broken]
return verdict, sorted(alive, key=lambda key: rank(OPTIONS[key]))
def coverage(key):
"""The stage that holds each hard constraint's control."""
return {cid: stage for cid, stage, fact in HARD if OPTIONS[key][fact]}
cut lists the hard constraints an option breaks, and one is enough to knock it out. rank adds up the soft scores. decide keeps only the options with nothing broken, then sorts them by soft score. coverage maps each hard constraint to the stage that holds its control.
The run: one scenario, one decision
ask: Choose the architecture for the storm desk.
constraints: 4 hard | 2 soft
A One agent, every tool, shared US host | cut: breaks C1, C2
B Router, rules in code, drafted reply | kept | soft score 3
C Nightly batch over all bookings | cut: breaks C3
D A subagent crew, one per passenger | kept | soft score 6
chosen: B | beats D on the soft constraints
stage check: C1 processing | C2 output | C3 processing | C4 input
every hard constraint covered: True
A is cut because it breaks the EU rule and the compensation rule. C is cut because a nightly batch can't answer a passenger at the gate. B and D survive; B scores 3, D scores 6, and lower wins.
Now look at A and C on the soft side. From the option data, A would score 3 and C would score 2, the best of all four. They're still out. A good soft score never rescues a broken hard constraint.
Then say what B gives up: the odd case goes to a person. That sentence belongs in the decision, not in a footnote.
Every hard constraint needs a stage
The last line of the run checks B end to end. Input holds the gateway rule: one door to the bookings. Processing holds two: EU hosting and an answer at the gate. Output holds the compensation rule, written in code so no forbidden promise leaves. Feedback has no hard constraint, but it still gets tracing and evals. If a hard constraint had no stage, that would be a gap in the design.
The trap: picking before cutting
Three kinds of answer are tempting in a long scenario: the most powerful design (a crew of agents), the cheapest design (the nightly batch), and the design you know best. None of them started from the constraints. The rule is always the same: cut on the hard constraints first, then rank on the soft ones. One broken hard constraint rules an answer out, however good it is elsewhere.
The choice between B and D is the workflow-versus-agent question in disguise; see choosing between a workflow and an agent. The method is then applied to two full scenarios: the regulated dispute desk and global support automation.
Try it yourself
Change C3 from hard to soft by moving it to SOFT with a score field of your own. Does C still lose? Then add an option E, "router on a shared US host", and predict which constraint cuts it before you run. The project files for this lesson are in the community, free to join.
Recap
| Step | Rule |
|---|---|
| Mark | must, never, only: hard. should, would like: soft |
| Place | Each constraint on input, processing, output or feedback |
| Cut | Break one hard constraint and the option is out |
| Rank | Survivors only, on the soft constraints |
| Decide | Name the winner and what it gives up; check every hard constraint has a stage |
Related course on Udemy
Claude Certified Architect - Professional (CCAR-P) Exam Prep
Architecting with Claude: design, models, context, integration, evals, governance and stakeholders.View on Udemy ↗: Claude Certified Architect - Professional (CCAR-P) Exam Prep (paid course, opens in a new tab)Related posts
The Claude Messages API: Your First Call, Field by Field
One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.
Claude Tool Use: How tool_use and tool_result Work in the Messages API
Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.
Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.
Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.
