Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Separate natural-language requests from transaction state

Examine intent understanding, business rules, authorization and traceable execution.

Learning objectives: Models explain appeals and policies, and controlled business facts are required for qualifications, amounts, and transaction completion. Commitment text, generated reply, and real money effects must remain distinct.

Content checked: 2026-10-03 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Debugging · Diagnose failures. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Separate natural-language requests from transaction state
Models explain appeals and policies, and controlled business facts are required for qualifications, amounts, and transaction completion. Commitment text, generated reply, and real money effects must remain distinct.

How does the mechanism work?

Step-by-step explanation
  1. The user said that customer service promised a refund last time. Do you believe it?

    A model interprets user statements; explain when those statements can become facts that justify execution.

  2. What should I do if the policy document is inconsistent with the rule service?

    Conflicts between policy explanations and executable rules can affect eligibility decisions.

  3. What content should be passed during manual takeover?

    After pausing automation, retain state that allows the process to continue.

Debugging · Diagnose failures

Diagnose failures · Separate natural-language requests from transaction state

Objectives of this level: Repair unsafe retries while preserving owner and tenant rejection.

Visual guide · Ledger state changes the next step

Ledger state changes the next step

These are fictional refund-planning states, not executed payments. Current tenant and ownership checks precede ledger decisions; a receipt is not settlement. Select the figure to open it at full size.

Same after-sales project

The same after-sales Agent receives a refund request. The model may propose an action, but the trusted principal, current order, merchant rule, approval and ledger decide whether it is permitted. A refund request/receipt is distinct from money arriving; Stripe’s refund lifecycle illustrates why an API acknowledgement is insufficient. These integer-cent fixtures do not contact a payment provider.

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.

Same-input fault reproduction

In your own copy resend when ledger is unknown. With the fixed unknown-effect payload, locate the first failed effect-state guard and show why re-running the whole workflow is unsafe. Retain a separate owner-mismatch negative control; an eligibility fix must not weaken identity checks.

{
  "principal": {
    "tenant": "t1",
    "user": "u1"
  },
  "order": {
    "tenant": "t1",
    "owner": "u1",
    "state": "paid",
    "amount": 300
  },
  "rule": {
    "eligible": true,
    "max_auto": 300
  },
  "ledger": {
    "status": "unknown",
    "operation_key": "refund-42"
  },
  "amount": 300,
  "operation_key": "refund-42",
  "now": 100,
  "approval": null
}

Use this expected result from the foundation sample, unchanged:

{
  "expected": {
    "action": "reconcile",
    "reason": "unknown_effect",
    "operation_key": "refund-42"
  },
  "error": null
}

Evidence before repair

After implementing, preserve a faulty student-before.py. Run the before command, inspect its first actual mismatch, then repair student.py and rerun the after command. Keep both reports, source hashes/diff, an evidence→hypothesis→distinguishing-evidence note and the named negative control. Reports may contain an earlier first mismatch than the named probe; explain both. The public suggested fault is a reproducible exercise, not an unannounced incident or unseen test.

python3 lab_runner.py grade --course customer-service-action-design --module student-before.py --out before-report.json
python3 lab_runner.py grade --course customer-service-action-design --module student.py --out report.json
import json
from pathlib import Path
report = json.loads(Path("before-report.json").read_text())
first = next((row for row in report["checks"] if not row["passed"]), None)
print(json.dumps(first, indent=2, ensure_ascii=False))

Optional retrospective after evidence

No. Query the original key and preserve the uncertainty before another write.

code example

Preserve the same-input red/green repair

In your own copy resend when ledger is unknown. With the fixed unknown-effect payload, locate the first failed effect-state guard and show why re-running the whole workflow is unsafe. Retain a separate owner-mismatch negative control; an eligibility fix must not weaken identity checks.

Acceptance task for this level

Freeze a faulty copy, submit evidence and competing hypotheses, reproduce the same-input failure, repair it and preserve red/green reports plus a negative control. Contract: decide_service_action(payload).

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Can an unknown receipt be treated as a failed refund?

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.