Specify bounded ownership, inputs, outputs, and measurable acceptance.
Section 1.1 1 of 7
Overview
Focus
Specify bounded ownership, inputs, outputs, and measurable acceptance.
Your route through the lesson
1.2 Task decomposition and dependency boundaries
1.3 Artifact contracts and acceptance criteria
1.4 Budgets and conditions for human escalation
1.5 Put it into practice
1.6 Guided comparison
1.7 A specification with incompatible requirements
All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.
Section 1.2 2 of 7
Task decomposition and dependency boundaries
Focus
Decompose work along stable inputs and bounded ownership.
Task decomposition divides a goal into pieces whose completion can be checked and integrated. A useful piece has known inputs, an owned output, and a clear dependency boundary. Splitting by impressive role titles is weaker than splitting by artifacts and interfaces because titles do not tell workers what they may change.
For an invoice importer, one task can normalize rows into a specified schema, another can calculate totals from that schema, and a final check can compare totals with expected fixtures. The calculator depends on the schema and normalized data. It should not invent a different schema while the normalizer is working. Freeze the interface first, then assign independent implementation work where possible.
One writer per artifact prevents conflicting changes. A delegate owning normalized.json may read source.csv but must not edit it, alter acceptance tests, or change another worker's output. If two tasks must edit one artifact, use sequential ownership transfer or an explicit integrator. A smaller bounded contract is easier to verify than a request to improve everything. Decomposition should reduce uncertainty at boundaries, not merely distribute the original ambiguity among more agents.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 1.3 3 of 7
Artifact contracts and acceptance criteria
Focus
Translate a vague request into observable acceptance conditions.
An artifact contract states what is produced and how a consumer interprets it. Include filename or interface, schema version, units, required fields, error behavior, and input identity. Acceptance criteria then state observations that would establish the result meets the requirement. Good criteria can fail; they are not compliments such as clean, intelligent, or production ready.
Turn make invoice import reliable into a concrete contract: accept a list of integer amounts in cents; reject a row missing amount; preserve row count; emit a total equal to the sum of accepted amounts; write only normalized.json. A test with 125 and 250 cents expects 375, while a missing amount expects a structured rejection and no published partial total.
Choose boundary and negative cases alongside a normal path. An empty list may validly total zero, or it may be invalid according to the business rule; the specification must say which. The verifier should know expected behavior independently of the producer. If the contract leaves empty input undefined, record that unresolved requirement instead of allowing whichever implementation happens to appear first to define correctness.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 1.4 4 of 7
Budgets and conditions for human escalation
Focus
Bound attempts, time, authority, and escalation triggers before execution.
A delegation budget limits resources and autonomy. State maximum attempts, permitted calls, elapsed deadline, editable artifacts, and forbidden effects. A budget is not only a cost control: it prevents an agent from repeatedly changing unrelated components when a narrow correction fails. The coordinator needs a terminal state when the budget is exhausted.
For the invoice normalizer, allow two implementation attempts against fixed development fixtures and no external writes. Escalate if the source contradicts the contract, if required currency is missing, or if both correction attempts fail. Escalation should include the exact input version, observed failure, attempted corrections, and the decision needed. It should not ask a person to reread an unstructured transcript to discover the problem.
Human escalation is appropriate when the workflow lacks authority or a required specification decision. It is not a fictional teacher review or a completion requirement for the student. In the local lab, an explicit escalate status represents the boundary; no message is sent. A real integration would need an authorized recipient and delivery mechanism. Safe stopping with useful evidence is a successful control outcome even when the business task remains unresolved.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 1.5 5 of 7
Put it into practice
Focus
Run a concrete delegate contract and inspect the invariants it encodes.
Download week15.py, save it in an exercise folder, and run python week15.py --lesson 1. This is the lesson's single practice. The processor-only standard-library fixture writes a contract into an automatically removed temporary folder and normally finishes within seconds. It performs no model call and executes no agent-generated code.
The contract dictionary identifies parser_worker, one owned output normalized.json, source version v1, cents, a two-attempt limit, an accepted range, and escalation on conflict. json.dumps serializes the dictionary to text; Path.write_text stores it with explicit UTF-8 encoding. UTF-8 is a standard representation of text characters as bytes, making the file encoding explicit across machines.
The first assertion compares the length of writes with the length of set(writes). A set contains unique values, so unequal lengths would expose duplicate output ownership entries in this list. The next assertion checks 250 lies inside the declared range. The final assertion confirms the conflict route. These checks validate selected contract fields; they do not establish that an importer implementation satisfies every criterion. Read PASS as contract-fixture evidence, then use the taught acceptance pattern to understand what a future implementation must prove.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 1.6 6 of 7
Guided comparison
Focus
Distinguish a checked contract from a completed delegated implementation.
The worked contract gives the delegate a narrow target rather than an open-ended improvement request. It owns normalized.json and consumes v1. Its amounts are in cents, and it has two attempts before conflict escalation. This makes later behavior attributable: an output in dollars or an edit to source.csv would violate a visible condition.
The script checks internal contract properties. Duplicate entries in writes would be rejected; 250 satisfies the declared bounds; on_conflict equals escalate. These are useful sanity checks, but a single list cannot prove no other worker has been assigned the same file. A full coordinator must check ownership across all active contracts. Similarly, a declared budget must be enforced by execution control rather than trusted as a suggestion to the model.
Acceptance therefore has layers. The contract must be coherent, the executor must enforce ownership and budgets, the produced artifact must satisfy its schema, and behavior must match the requirement. Passing an early layer cannot substitute for later evidence. The lab deliberately proves a small layer completely and labels its limit. That discipline prevents a convincing contract document from being mistaken for a functioning and verified system.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 1.7 7 of 7
A specification with incompatible requirements
Focus
Surface incompatible requirements before a delegate chooses one silently.
A request says accept every invoice row and reject every row lacking currency. The supplied file contains a row without currency. Under a literal reading, the requirements demand both accepting and rejecting the same row. A delegate cannot satisfy both by clever implementation; the specification is inconsistent.
The worked response names the conflicting clauses and the exact fixture row. It proposes a decision point: either acceptance applies only to valid rows, or missing currency must be supplied through an authorized source before import. It keeps the current run unresolved and publishes no accepted financial total. The coordinator can then obtain a specification decision and issue a new contract version.
This differs from ordinary error handling. A program can implement a defined rejection rule, but it cannot invent which business requirement has priority. Testing both contradictory clauses would produce an impossible suite. Quietly weakening a test would conceal the contradiction. Keeping the failing fixture and updated requirement together provides traceability when the contract changes. A later accepted result should name the resolved contract version rather than implying it satisfied the original incompatible specification.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Your personal notes
Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.