Skip to main content

Agent Operations on Real Transactions: Designing Permissions, Double Confirmation, Idempotency, and Rollback

· 5 min read
Jack Ning
Maintainer of Bytedesk

Letting an AI Agent execute refunds, cancel orders, or change delivery addresses on behalf of users is the daring leap of AI customer service from "can talk" to "can do". A wrong answer to a query earns a complaint; a wrong refund loses real money. The key to this leap is not model capability but a full set of product and engineering mechanisms that make operations controllable, confirmable, reversible, and backstopped.

This post is part of an experience-sharing series for AI customer service product managers and developers, drawn from hands-on practice as an intelligent service product manager at a large general e-commerce platform. In this post I want to share how to design tool-call permissions, user double confirmation, idempotency control, exception retry, operation rollback, and human fallback that keep business execution controllable when an AI Agent must perform real-transaction operations like refunds, order cancellation, or address changes.

This is a joint product-and-engineering effort: it takes transaction-safety product design plus a real product-level grasp of engineering concepts like idempotency and rollback.

Illustration: Confirmation, idempotency, retry, rollback, and human fallback for real transactions

Two Key Points in Transaction Control Design​

  • Dual perspective on transaction safety and execution control: confirmation and fallback design on the product side, permissions and exception handling on the engineering side.
  • Product-level understanding of idempotency and rollback: not reciting terms, but mapping them to concrete mechanisms in user experience.

The Overall Design​

Step 1: Tool-call permission system​

  • Tool tiering: read-only tools (queries) → low-risk writes (address change) → high-risk writes (refund, order cancellation).
  • Tiered authorization: the Agent may call read-only tools freely; low-risk writes must pass business-rule checks; high-risk writes must satisfy the triple condition of "rule check + user double confirmation + limit control" — no exceptions.
  • Operation limits: set an automatic-execution amount cap per order size and user risk level; anything above goes to a human. The limit is the ceiling of financial loss, and that ceiling must be set by people.

Step 2: User double confirmation​

  • Before execution, present a structured card showing operation elements — order, amount, destination — and require explicit confirmation; the confirmation binds to the session and operation ID, preventing mis-triggering or replay.
  • Confirmations expire; after timeout, re-confirm. Never ask twice for the same operation, or users will start doubting the system.

Step 3: Idempotency and exception handling​

  • Idempotency control: every operation generates a unique request ID, deduplicated at the API layer — retries can never produce duplicate refunds. This iron law of transaction systems still holds in the Agent era.
  • Retry strategy: retryable errors (network timeouts) get bounded retries with backoff; business failures (refund conditions unmet) are never retried — explain to the user and offer alternatives. Distinguishing "should retry" from "should explain" separates an Agent from a mindless script.
  • State confirmation: after initiating an operation, the final state of the business system rules (verified by query), never the model's assumption.

Step 4: Rollback and human fallback​

  • Define rollback flows for rollback-capable operations (cancel order → restore inventory); for non-rollback-capable operations (refund already received), define remediation flows (agent-mediated negotiation). Classify first, design second — not after the incident.
  • Full operation audit trail: who, when, based on what confirmation, called which API, with what result — supporting audit and traceability.
  • Fallback: on consecutive failures, escalating dissatisfaction, or risk-control interception, transfer to a human immediately with the complete operation history, so the human can actually pick it up.

One summary line and one lifeline​

"Permissions decide whether it can be done, confirmation ensures the user knows, idempotency ensures it is not done twice, retry ensures it gets done, rollback ensures it can be undone, and fallback ensures it never runs out of control." The six mechanisms interlock; missing any one can void the others.

"The business system's state is the lifeline" — the state inside the model's memory is never trustworthy. The model saying "refund initiated" does not mean it was; only API responses and business-database records count.

How This Maps to Bytedesk​

Bytedesk, the open-source AI customer service system (GitHub, site), provides the foundational forms of these mechanisms: the AI Agent's tool calls support per-tool permission boundaries; human-bot collaboration supports user confirmation before high-risk operations and transfer to humans anytime; tickets carry remediation and negotiation flows; and conversation and operation logs with statistics and quality inspection support audit and traceability. Limit control, idempotent request IDs, and rollback orchestration are business-side customizations extendable on Bytedesk's open Agent tool-call framework.

Key Takeaways​

  • Authorize tools in three tiers — read-only → low-risk write → high-risk write; high-risk requires rule check + double confirmation + limit, all three.
  • Confirm with structured cards + session/operation ID binding + expiry, preventing both mis-touch and nagging.
  • Idempotency via unique request IDs; retry only retryable errors, explain and offer alternatives on business failures.
  • Classify rollback first: rollback flows where reversible, remediation flows where not, with full audit trails.
  • The business system's state is the lifeline — the model's word does not count; the API's return does.