Skip to content
Agent Field Notes
Practice topicsFilter practice questions by topic.All practice →
knowledge unit 12AdvancedSystem designAbout 15 minutes

Understand → Implement → Debug → Design

An approval binds an intent, not a permanent permission

Bind one reviewed intent and test the current authority and operation ledger at execution.

Permission isolationManual approvalMCPPrompt Injection

Knowledge content check2026-10-11 · Check the source of the original question2026-10-11

Which step do you want to learn from this knowledge point?

Select the starting point based on the current basis, or you can go deeper one by one. When you encounter an unfamiliar concept, go back to the core principles first; use the knowledge exercises to check your understanding when you are finished.

Understand first

New to this knowledge point

Complete the prerequisite concepts, read the principles and counterexamples, and then explain why in your own words.

Start with core principles →

Implement next

Prepare to write the principles into code

Understand implementation steps and boundaries, complete small tasks, and check results against acceptance requirements.

View the code example →

Debug failures

Need to handle failures and changes in conditions

Follow the continuous questioning to locate the failure premise, and then compare the migration cases to explain how the plan should be adjusted.

Continue to delve deeper into the problem →

Compare designs

Need to design or review plans

Combine engineering deductions and senior self-evaluation standards to explain the applicable conditions, costs and alternatives of the plan.

Analyze engineering scenarios →
Knowledge unit directory

LEARN · PRACTICE · REFLECT

Knowledge learning and personal records

My notes and review ↗

First read along the principles, Q&A and migration cases. When you need to check your understanding, switch to reinforcement exercises or start personal recording.

Answers and personal notes

Each modified commit will be kept as an independent history. Your level of mastery is up to you to evaluate yourself against the standards.

Core concept · An approval binds an intent, not a permanent permission

Understand the core principles first

Preparatory concepts:Trusted identity and object authorization, Normalized action envelope and digest, Durable operation identity and result reconciliation

Unchanged reviewed semantics, current authority and deduplicated execution are separate predicates required by a safe write boundary.

Visual guide · Approval needs three independent predicates

Approval needs three independent predicates

A matching digest prevents proposal changes, current checks enforce authority, and operation identity deduplicates dispatch. Select the figure to open it at full size.

Hash binding prevents a changed proposal from borrowing approval, but it does not establish permission at dispatch. Revocation can happen during a human wait, and duplicate deliveries can happen after a successful write. Checking only one of these dimensions leaves another failure window.

The local course exposes each reason and ledger value. A cross-service design must add the authority's own validation/deduplication and an explicit contract for revocation propagation and unknown outcomes. Framework pause/resume alone cannot provide those guarantees. See the approval course.

Approval: intent identity and current authority at the effect boundary
  1. 1
    Requester

    Propose typed arguments under authenticated context.

  2. 2
    Intent store

    Freeze normalized semantics and a durable operation ID.

  3. 3
    Reviewer

    Approve the exact digest with current review authority.

  4. 4
    Executor

    Check digest, permission/epoch, expiry and resource preconditions.

  5. 5
    Business authority

    Commit one effect and receipt, or reconcile an existing receipt.

Digest identity, authorization and deduplication are separate predicates. The lab shares one SQLite authority; the design layer changes this constraint.

Check understanding with a question

How do approvals survive argument changes, revocation and duplicate dispatch?

Compare with the reference answer

Freeze a normalized envelope with trusted identity, operation ID, tool semantics, target, amount/currency and resource preconditions. A trusted reviewer approves that digest before expiry. Execution still checks current requester/reviewer authority, permission epoch and resource version. Changed semantics need fresh review; identical duplicate dispatch reconciles the same receipt.

Implementation and trade-offs

The authored reviewer approves refund-1 for 300 USD minor units. A later amount800 is rejected as proposal_changed with zero effects. Revoking the requester after review yields permission_revoked with zero effects. Duplicate delivery of the unchanged intent yields committed then replayed and leaves remaining700/effect_count1.

The envelope is stored under trusted tenant/actor and fixed refund-approved/v2 semantics. It includes all normalized arguments and a permission epoch; the approval record includes the separately authorized reviewer and expiry. Sorted-key SHA-256 compares this limited integer/string profile. It is not a credential and does not authenticate the human or allow the model to declare approved=true.

The local execute transaction checks current authority, epoch, submitted digest, active review, expiry and resource version before committing one effect and receipt. Permission regrant changes epoch, so an old review cannot silently resume. Once done, an authorized unchanged request may read the receipt after approval expiry because that read dispatches no new effect.

Moving policy and refund to independent services changes the race. A preflight permission read cannot atomically protect remote commit. Define resource-side capability/epoch enforcement or a bounded validity contract and preserve unknown outcomes for reconciliation. Revocation after a committed action stops later actions; any compensation requires its own authorized intent.

Requester and reviewer authority have independent generations. Revoking reviewer-a and re-enabling approve must leave the old review invalid (approver_permission_epoch_changed) with zero effects. The SQL below simulates only the trusted teaching permission service; model text cannot regrant authority. A new valid proposal/review is required for a new dispatch.

code example

Reproducible local boundary check

Python 3.9+, standard library. Extract /lab/deep-dive/agent-core-deep-dive-v1.zip and run this snippet beside approval_deep_dive.py; /lab/deep-dive/approval_deep_dive.py is also available. Authored fixtures only; not a live model or external service.

from approval_deep_dive import approved_service, ARGS
s = approved_service()
assert s.execute('tenant-a','user-a','refund-1',dict(ARGS,amount_minor=800))['reason'] == 'proposal_changed'
assert s.state()['effect_count'] == 0
assert s.execute('tenant-a','user-a','refund-1',ARGS)['status'] == 'committed'
assert s.execute('tenant-a','user-a','refund-1',ARGS)['status'] == 'replayed'
r=approved_service()
r.revoke('tenant-a','reviewer-a',role='approve')
r.db.execute("UPDATE permissions SET enabled=1 WHERE tenant='tenant-a' AND actor='reviewer-a' AND role='approve'")
assert r.execute('tenant-a','user-a','refund-1',ARGS)['reason']=='approver_permission_epoch_changed'
assert r.state()['effect_count']==0
r.close()
print(s.state()['effect_count'],s.state()['remaining_minor'])
s.close()

expected output

1 700

Engineering deduction

scene
Authored local approval schedules: amount mutation, permission revoke, expiry/resource changes and two duplicate dispatches.
design decisions
Store one immutable normalized proposal and enforce current predicates before local atomic effect/receipt commit.
Verify target
Mutation/revocation/expiry/stale resource schedules write zero effects. Identical duplicates write one effect and return the same receipt.
applicable boundary
Trusted identities are fixtures; no login, remote capability issuer, DNS enforcement or external payment is executed.

Continuous questions and answers

Continue reading along with the premises and constraints of the problem. Understand the reference answers first, then try to put away the answers and explain the cause and effect and trade-offs in your own words.

Draw inferences from one example: If the conditions change, how to deduce it?

First find out the conditions for change, and then determine which premises in the original plan still hold true. The following cases are teaching deductions to facilitate the transfer of principles to new problems.

External send instead of local draft

Changing conditions:The approved artifact becomes an email or public send that cannot be transactionally undone.

Extended question:How should duplicate delivery and cancellation be treated?

Derivation and reference solutions

Bind exact recipients/content, use the send provider's operation identity/receipt, reconcile unknown outcomes and preserve already sent history. Cancellation before dispatch blocks a new send; after send it cannot make the event disappear. A correction or recall is a separate action with its own limits and approval.

The principles that remain unchanged:Approval identity and current authority must hold for one business operation; historical effects remain facts.

Separate permission and resource services

Changing conditions:Permissions, resource state and tool semantics can change without one transaction.

Extended question:What mechanism and tradeoff can replace the local execution check?

Derivation and reference solutions

Use resource-side validation of scoped/versioned authorization and operation identity, plus an explicit immediate or bounded revocation contract. Current reads improve freshness but do not remove the post-read interval. Immediate enforcement couples authority/availability; bounded capabilities accept a stated validity window.

The principles that remain unchanged:Enforcement belongs at the resource effect boundary and cannot be inferred from an orchestrator check.

Easy to make mistakes

  • Using approved=true or a known hash as business authority.
  • Hashing unresolved defaults that change before execution.
  • Reusing an approval after resource or permission generation changes.
  • Confusing acknowledgment loss with non-execution and sending a new operation.

References

Official mechanisms were checked on 2026-10-11. Examples and schedules are authored; local Python/SQLite outputs are actually executed. No enterprise incident, live model accuracy or production reliability is asserted. New Q&A and migration cases are added for principle explanation, and source verification and case operation verification are recorded separately.

Check how far you understand

After reading, you can explain the principles, boundaries, and trade-offs against these standards. It is up to you to evaluate your mastery; if further verification is needed, complete the small tasks below.

Basic standards met
Binds approval to exact normalized action and rechecks current authorization.
Intermediate and advanced signals
Demonstrates changed arguments, revoke/regrant, expiry/resource preconditions and identical receipt replay with actual local values.
Senior criteria
Defines canonical semantics, target pinning and resource-side enforcement across independent services; handles unknown outcomes and post-commit revocation.

View verification records for independent examples

Hands-on verificationComplete on demand · Suggestions40 minutes

Run approval_deep_dive.py and ApprovalTests. Save evidence for changed_amount, revoked_after_approval, resource_changed and duplicate_dispatch. Draft a remote enforcement contract for one changed default target.

Expand acceptance requirements and checkpoints
  • Mutation and revoked requester are denied before an effect.
  • Resource-version and expiry checks are evidenced separately.
  • Identical duplicate delivery leaves one effect/one receipt.
  • The remote design identifies enforcement and the allowed revocation window.
  • Requester and reviewer revoke/regrant invalidate their old authority generations; no new effect.

Key inspections

  • Distinguishes hash identity from authenticated reviewer authority.
  • Checks argument, default/target, resource-version and expiry changes.
  • Rechecks revocation and regrant epoch at execution.
  • Keeps one operation receipt across repeated approval or delivery; states remote limitations.