Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- A controlled task chain from evidence to publication
- Enterprise tasks should be recorded separately for reading evidence, generating drafts and publishing results, and then connecting them with versions and authorizations. Durable orchestration restores control flow but does not automatically guarantee consistent evidence or that external writes occur only once.
How does the mechanism work?
Step-by-step explanation
- Reports involve multiple documents that are constantly updated. How to define a consistent snapshot of evidence?
Reports draw on multiple changing sources, so explain the scope of evidence consistency.
- The worker crashes after a successful release. How to avoid repeated releases during recovery?
Durable-task recovery must handle the window where an external action succeeds but is not recorded locally.
- When the user cancels the task, how to handle the external requests that have been sent?
The task chain must define how cancellation relates to an irreversible commit.
Implementation · Build it
Implement the contract · A controlled task chain from evidence to publication
Objectives of this level: Implement ordered publication guards and explicit unknown-result handling.
Visual guide · Publish from current facts
This planner only recommends a next step. Check current authority first; stale approval cannot turn committed or unknown receipts into a fresh send. Select the figure to open it at full size.
Same after-sales project
The after-sales Agent publishes a reviewed refund-policy notice. A stored checkpoint is control-flow data; current publishing authority, current document version, approval binding and the external receipt are separate facts. This local planner recommends a next step; it does not commit a database transaction, publish remotely or prove enterprise readiness.
The existing capstone main-return creates a return application; it does not execute a refund. These manifests are independent fictional extensions or policy/evidence/counting exercises. They do not add real refunds, publication, model calls or Java execution to the capstone runtime.
Complete function contract
Implement plan_publication(payload). now and approval.expires_at are nonnegative integer teaching ticks (bool invalid); operation_key is a nonempty string. current contains nonempty tenant/version and bool can_publish; document contains nonempty tenant/version; approval contains nonempty tenant/version and expires_at. receipt.status is none/unknown/committed and its operation_key must equal payload.operation_key. Malformed/missing fields or mismatched receipt key raise ValueError:input; extra fields ignored. Return exactly next/reason/operation_key. Apply priorities: document.tenant != current.tenant or can_publish false → deny/current_authority; otherwise committed receipt → done/confirmed_receipt; unknown → reconcile/unknown_receipt; then document.version != current.version → review/document_changed; then approval.tenant/version != document.tenant/version OR expires_at <= now → approval/approval_not_current; otherwise publish/guards_satisfied. Confirmed/unknown receipts precede approval checks because an existing effect must not become a fresh send. Lists are absent and no sorting applies. current/receipt are authoritative only in this offline fixture; a real adapter must retrieve them from trusted services, not request/model/checkpoint fields.
Every listed input key must exist; explicit null is not an absent key. All returns must be JSON-compatible fresh containers, with exact bool/int distinctions, and leave the input unchanged. Every invalid declared field uses exactly ValueError("input"); this includes malformed nested fields. Do not swallow NotImplementedError or return a self-declared passed flag.
Own blank implementation
Download the full local package, extract it and work in its lab_runner.py directory. Runner and this case manifest are alternatives: save the runner and cases/enterprise-agent-design.json with that exact directory layout. The manifest contains all public fixed inputs/expected outputs; it contains no general solution. It is not an unseen assessment. Python 3.9+ and standard library only; no model keys or network calls are needed while grading.
def plan_publication(payload):
raise NotImplementedError("Implement the documented contract yourself")
python3 lab_runner.py scaffold --course enterprise-agent-design --out student.py
python3 lab_runner.py grade --course enterprise-agent-design --module student.py --out report.json
The untouched scaffold must exit 1. Fill the function yourself and rerun; all 10 public checks must pass for exit 0. Submit student.py, the generated report.json, your source diff and one additional condition-changing test. The runner imports and calls your function on each actual payload, compares exact output/error, checks input preservation and container independence, and records runner/cases/student SHA. A manual passed flag is not accepted. Its 5-second process timeout is a hang guard, not an enterprise latency requirement.
code example
Deliver your own function and report
Implement plan_publication(payload). now and approval.expires_at are nonnegative integer teaching ticks (bool invalid); operation_key is a nonempty string. current contains nonempty tenant/version and bool can_publish; document contains nonempty tenant/version; approval contains nonempty tenant/version and expires_at. receipt.status is none/unknown/committed and its operation_key must equal payload.operation_key. Malformed/missing fields or mismatched receipt key raise ValueError:input; extra fields ignored. Return exactly next/reason/operation_key. Apply priorities: document.tenant != current.tenant or can_publish false → deny/current_authority; otherwise committed receipt → done/confirmed_receipt; unknown → reconcile/unknown_receipt; then document.version != current.version → review/document_changed; then approval.tenant/version != document.tenant/version OR expires_at <= now → approval/approval_not_current; otherwise publish/guards_satisfied. Confirmed/unknown receipts precede approval checks because an existing effect must not become a fresh send. Lists are absent and no sorting applies. current/receipt are authoritative only in this offline fixture; a real adapter must retrieve them from trusted services, not request/model/checkpoint fields.
The exact function and complete inputs are in the main body. Implement from the blank starter, not by copying expected outputs into branches.
Acceptance task for this level
Implement the blank function and submit the real generated report, own code/diff and one changed-condition test; Java candidates additionally deliver their real Java patch/build. Contract: plan_publication(payload).
Reading this browser’s record…
Hide the answer and check your understanding
What is the expiry boundary?
Expand reference derivation
expires_at <= now requires new approval for a fresh send.
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.
- LangGraph: Persistence and Thread Checkpointing
- Temporal: Activity retry, receipt and cancellation
- MCP:Authorization
- PostgreSQL: Transaction Isolation and Consistent Snapshots
- AWS: Transactional outbox and duplicate delivery
- Public fixed contract inputs
- Local pure-function checker
- Extended Agent local practice package