Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Delivery conditions and shared deadlines for parallel results
- Parallelism only shortens independent waiting and does not change task dependencies and success conditions. Global deadlines constrain all attempts and backoffs; the cancellation of a local task does not prove that the remote side effects have stopped, and the results must be retained and classified item by item.
How does the mechanism work?
Step-by-step explanation
- What's the problem with calling the synchronous HTTP library in the async function?
Concurrent execution requires yielding control; function syntax alone does not guarantee this.
- Are other tasks still running after aggregation wait encounters an exception?
Error handling changes the lifecycle of concurrent tasks, so check the library's actual semantics.
- Why does the tool retry reusing the remaining time?
Local retries must obey the global delivery budget.
Design · Explain the trade-offs
Explain design trade-offs · Delivery conditions and shared deadlines for parallel results
Objectives of this level: Interpreting blocking, task group semantics, and the boundaries of remote unknown outcomes.
Visual guide · One deadline governs every branch
Required failures block; optional failures may yield partial. Cleanup must run on exceptions too, and local cancellation proves no remote noncommit. Select the figure to open it at full size.
Extend the contract: external facts after local cancellation
Save deadline_write_probe.py and call your actual module. The write fixture commits at logical time 7 but responds at 8, after local deadline 5. settle_external advances independent provider fixture events without changing the local returned time.
from deadline_lab import LogicalRuntime
from deadline_student import run_batch
jobs = [{"id": "write", "required": True, "complete_at": 8,
"outcome": "ok", "value": "receipt", "effect_at": 7}]
rt = LogicalRuntime(jobs)
result = run_batch(rt, jobs, 5)
assert result["status"] == "blocked"
assert result["results"] == [{"id": "write", "state": "timeout", "value": None, "error": "deadline"}]
assert rt.now == 5 and not rt.pending_ids() and not rt.opened_ids()
assert rt.external_ledger == []
rt.settle_external(10)
assert rt.external_ledger == [{"job_id": "write", "committed_at": 7}]
print("local_cancel_then_external_commit_fixture")
The assertion demonstrates that this simulator can clean up locally before a later external commit. It sends no real write and establishes no provider cancellation guarantee. Real write workflows must preserve the business ID and reconcile receipts; conclusions about cancellation or noncommit require an external contract and evidence. A timeout alone cannot establish write failure.
Add your own negative control: copy your candidate to deadline_negative.py and remove close, or classify a required timeout as partial. Use the same grader to demonstrate exit 1 and at least one failing case. Keep its actual module SHA and audit rather than editing a report. Your successful module still needs 12/12.
python3 deadline_write_probe.py
python3 deadline_lab.py grade --module deadline_student.py --out deadline-final.json
For an interview, deliver your source, first failing run, repair diff, passing unchanged assertions, a negative control, and a one-page design note. Identify independent tools and sequential dependencies, propagation of the absolute deadline into retries/backoff, required delivery gates, reconciliation by the same business ID, and local cancellation/resource boundaries. This lab implements no real async adapter, retries, distributed recovery, or external transaction; describe the additional tests a real client would require.Python 3.12 asyncio semantics; lab source.
code example
Post-cancel commit fixture
Local timeout and cleanup at 5 can precede a fixture ledger commit at 7. This logical-event fixture motivates same-ID reconciliation; no remote call is measured.
Acceptance task for this level
Run your write_probe, add a resource-leak or wrong-required-gate negative control, and submit 12/12, negative exit 1, ledger evidence, and a real-client migration note.
Reading this browser’s record…
Hide the answer and check your understanding
Can successful local cancellation establish that a write was not committed?
Expand reference derivation
No. Local cancellation manages a local lifecycle; an external commit may occur later. Reconcile by the same business ID and rely on a verified provider contract for real cancellation claims.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.