Building Plan Confirmation and Execution Loops with AI Agent Platforms
AI agent platforms can demonstrate the full "plan, confirm, execute" flow, but reliability in production depends on system design, not just model capabilities. This article explains what a complete agent loop looks like, why execution plans must be structured and version-bound, how persistent state machines and per-call tool security enable controlled execution, and how to evaluate platforms and roll out from prototype to production safely.
Key Takeaway: It Can Be Built, but Completeness Depends on System Design
An agent platform with model access, tool calling, and workflow orchestration can support the basic flow of understanding a user request, generating an execution plan, presenting the plan, waiting for confirmation, calling tools, and reporting results.
However, two things should be distinguished: whether a platform can demonstrate the full flow, and whether a system can run reliably in a real business environment. The former usually requires only model configuration and workflow setup. The latter also requires persisted state, authentication, access control, task scheduling, audit logging, and failure recovery.
For this reason, “can we build a complete agent?” cannot be answered with a feature checklist alone. A more accurate test is:
Whether the combination of the platform’s native capabilities and external business services can meet the target scenario’s requirements for security, reliability, maintainability, and governance.
For low-risk tasks such as knowledge lookup and information gathering, the platform itself may carry most of the workload. For tasks with external side effects—modifying orders, processing payments, changing production configuration—critical control logic should live in deterministic services, not in the model’s own judgment.
What a Complete Agent Loop Actually Includes
A complete agent is not a single model request, nor a fixed sequence of tool calls. It involves at least six stages.
1. Understand the Goal and Fill in Constraints
The system must first determine what outcome the user wants and whether the available information is sufficient to act.
For example, when a user asks to “summarize this month’s abnormal orders and notify the owners,” the system should identify:
- Which time range and time zone “this month” refers to;
- Which statuses count as abnormal;
- Which orders the user is allowed to access;
- Which channel should be used for notifications;
- Whether already-handled records should be excluded.
When key conditions are missing, the system should ask follow-up questions instead of letting the model silently fill in parameters that could affect business outcomes.
2. Generate a Verifiable Plan
A plan should specify steps, inputs, dependencies, expected outputs, and risks—not just a vague description like “I’ll query, analyze, and then send.”
For complex tasks, the plan can be represented as a directed dependency graph: independent query steps can run in parallel, while steps that depend on earlier results must wait. The model proposes the plan; the system validates it against tool constraints and business rules.
3. Present the Plan and Obtain Confirmation
The system should show users the information they need to make a decision: query scope, target objects, intended actions, and possible impact.
“Explaining the plan” here means describing the proposed actions, the reasoning, and the constraints. It does not require exposing the model’s internal reasoning.
4. Controlled Execution
Once the user confirms, the executor invokes tools according to the authorized plan. Every call should still be checked for permissions, parameters, and business state. User confirmation must never be treated as a license to bypass validation.
5. Observe Results and Handle Exceptions
The executor should read the actual tool responses, determine whether each step succeeded, failed, or ended in an unknown state, and decide whether to continue, pause, compensate, or escalate to a human.
6. Report and Retain Records
The final report should distinguish completed actions, incomplete actions, and actions whose outcome cannot be confirmed. Plan versions, confirmation records, and execution traces should be retained for auditing and troubleshooting.
Recommended Architecture: Model Plans, Services Control, Tools Execute
A production system can be divided into four logical layers.
1. Interaction Layer
Handles receiving requests, presenting plans, collecting parameters and confirmations, and showing execution progress.
A confirmation UI should not offer only a vague “Continue” button. For write operations, the affected scope should be shown explicitly—for example, “an abnormal-order summary will be sent to the designated owners”—along with whether sensitive information is included.
2. Planning and Orchestration Layer
Calls the model to understand the task, generate candidate plans, and organize step dependencies.
This layer can leverage the platform’s workflow capabilities, but you must verify whether the platform supports pausing, resuming, branching, timeout handling, and interaction with external state. If any of these are missing, they can be implemented in business services—do not assume every agent platform provides them natively.
3. Control and Execution Layer
Handles plan validation, authorization checks, state transitions, tool dispatch, idempotency control, and failure recovery.
This is the security boundary. The model cannot decide which permissions it has, nor modify the scope of operations that have already been confirmed.
4. Business and Data Layer
Provides the actual capabilities—querying, computing, notifying, writing—and enforces data access control.
The overall flow can be summarized as:
User submits a request
→ Model generates a candidate plan
→ Validation service checks the plan
→ User confirms a specific version
→ Executor verifies authorization and invokes tools
→ Real results are aggregated
→ Feedback and audit
The platform mainly reduces the cost of model interaction and workflow orchestration; the surrounding services ensure the flow stays within business boundaries.
Execution Plans Must Be Structured, Not Just Natural Language
Natural-language plans are easy to read but unsuitable as the sole basis for execution. Executors need stable, unambiguous data structures.
The following is an example of a custom plan structure; it does not represent any real platform interface:
Plan ID: task-001Version: 1Goal: Compile abnormal orders and send a summaryStatus: Awaiting confirmationStep 1:Action: Query abnormal ordersInputs: Time range, abnormality rules, authorized data scopeDepends on: NoneType: Read-onlyStep 2:Action: Generate summaryInputs: Query results from Step 1Depends on: Step 1Type: Internal processingStep 3:Action: Send notificationInputs: Summary, verified recipient listDepends on: Step 2Type: External writeConfirmation required: Confirm exact content and recipients before sending
Structured plans should also account for:
- Input constraints: field types, lengths, value ranges, and required conditions;
- Execution boundaries: maximum processing volume, allowed data scope, allowed actions;
- Stop conditions: terminate on insufficient permissions, data anomalies, or exceeded impact scope;
- Output contracts: success states, failure reasons, and result references;
- Validity period: when the plan and its authorization expire.
Note in particular that data not yet available when the plan is generated may determine the actual impact of later write operations. Users should not be able to confirm an abstract “send notification” and thereby authorize arbitrary recipients and content. A better pattern is to confirm the read-only query first, then show the specific retrieved objects and content to be sent for a second confirmation.
Confirmation Must Bind to a Specific Plan, Not a Verbal “OK”
A user replying “yes” does not inherently constitute reliable authorization. The system must know which plan, which version, and which operations that confirmation applies to.
A confirmation record should include at least:
- User and tenant identity;
- Plan ID and version;
- A digest of the normalized plan content;
- The approved scope of operations;
- Confirmation time and validity period;
- Where required, approver identity and approval outcome.
When a user adjusts recipients, time ranges, or target objects, a new plan version should be created and the old version’s confirmation invalidated. Before starting execution, the executor should re-verify that the plan matches the confirmation record.
Plan digests help detect content changes, but a digest is not itself an authorization credential. Authorization records must still be stored by trusted services and protected by authentication and access control.
For high-risk operations, conversational confirmation alone may be insufficient. Combine it with existing enterprise approval workflows, secondary authentication, or manual review.
Cross-Turn Execution Depends on a Persistent State Machine
“Present the plan and wait for confirmation” means the process must span multiple requests—and potentially long periods of time. Relying solely on chat context to hold state is unreliable.
A conceptual state model might be:
Drafting → Awaiting confirmation → Confirmed → Executing → Completed
Additional states should cover rejected, cancelled, expired, failed, partially completed, and awaiting human action.
1. State Transitions Are Controlled by Services
Transitioning from “Confirmed” to “Executing” must require satisfied conditions. A model outputting “the user has agreed” must not directly trigger a state change.
2. State Updates Must Be Atomic
Repeated confirmation clicks, duplicate submissions, or multiple executors handling the same task can all cause duplicate execution. Use transactions, conditional updates, or equivalent mechanisms to ensure a task cannot be claimed more than once without control.
3. Long-Running Tasks Are Decoupled from Chat Requests
Time-consuming work belongs in asynchronous execution. The user session checks progress while a background executor advances the task, preventing request timeouts from misleading users into thinking the task failed and re-submitting it.
4. Cancelling Is Not the Same as Reversing
Cancellation typically only prevents steps that have not started. Whether completed sends, writes, or payments can be reversed depends on business capabilities. Never describe “cancel task” as automatically restoring the previous state.
Tool Security Applies to Every Single Call
The more capable tool calling becomes, the clearer the security boundaries must be.
1. Tool Descriptions Support Planning, Not Authorization
Tool descriptions tell the model what a capability is for, but actual access decisions must be made by the tool service based on user identity, tenant, and resource scope.
Credentials should be managed in a trusted execution environment—never embedded in prompts or shown to the model.
2. Distinguish Read-Only Tools from Write Tools
Read-only operations are usually lower risk but can still leak data; write operations can change business state. Set access scope, confirmation requirements, and audit intensity separately for each.
“Read-only” does not mean free access to all data, and it certainly does not mean query results can be sent to any external recipient.
3. Validate Model-Generated Parameters Deterministically
Before execution, check field validity, object ownership, quantity limits, and business state. Parameters involving dates, amounts, and resource identifiers should not be taken directly from unverified model output.
4. Treat External Content as Data, Not Instructions
Documents, emails, and tool responses may contain text designed to manipulate the model’s behavior. The system must clearly separate trusted control instructions from external data, and prevent external content from changing permissions, tool scope, or approval rules.
Defense cannot rest on a single prompt instruction alone; it requires tool allowlists, data boundaries, and pre-execution validation.
Exception Recovery Determines Usability More Than the Happy Path
In real environments, tool calls can time out, return incomplete results, or complete the business operation without reporting success in time.
1. Design Idempotency for Side-Effecting Operations
Operations such as sending notifications or creating records should use business-level idempotency keys or deduplication records to prevent duplicate execution.
Never assume a network request happens exactly once, and avoid claiming absolute end-to-end “exactly once” semantics.
2. Distinguish Retryable from Non-Retryable Errors
Transient network failures may justify limited retries; insufficient permissions, invalid parameters, and business-state conflicts usually call for stopping or replanning.
Retry counts and backoff policies need boundaries to avoid infinite loops.
3. Verify Timeouts Before Acting
After a write operation times out, the state may be “unknown” rather than “failed.” Query the business result or use idempotency mechanisms to confirm the actual state before deciding whether to retry.
4. Compensation Must Genuinely Exist
Partially completed tasks can use compensation strategies, but compensation is not a universal rollback. Sent messages usually cannot be truly recalled, and operations with external effects may be irreversible.
The system should state explicitly what compensation can and cannot restore.
5. Replanning Must Not Expand Authorization
After a tool failure, the model may propose alternatives—but if the new plan changes target objects, impact scope, or tool permissions, it requires re-confirmation. “Automatic recovery” must never be used as justification for executing actions the user never authorized.
Platform Selection Should Assess Delivery Boundaries, Not Feature Counts
Different platforms lean toward rapid application building, online interactive publishing, or enterprise-grade engineering. When selecting one, focus on whether your requirements match the platform’s capability boundaries.
Validate against these questions:
- Model and tool integration: Can it connect to your target models and internal business APIs, and how is API authentication managed?
- Flow control: Does it support pausing, resuming, branching, and exception handling? Which capabilities need external implementation?
- State and data: How is task state persisted, and how is multi-tenant data isolated?
- Permissions and approvals: Can it integrate with enterprise identity systems and existing approval workflows?
- Deployment and operations: Does it meet requirements for network isolation, data retention, backup and recovery, and deployment environments?
- Observability: Can model requests, plan versions, tool calls, and final results be correlated?
- Extensibility and maintenance: When business rules change, which configurations must be updated and which code must be maintained?
A platform is suitable not because it claims to support agents, but because every critical step in your target flow has a clear implementation path.
From Prototype to Production: A Phased Path
Phase 1: Validate Planning Quality
Choose read-only, low-risk scenarios and test goal understanding, parameter completion, and tool selection. Focus on whether plans are executable and whether the system asks clarifying questions when information is insufficient.
Phase 2: Build the Confirmation and State Loop
Introduce structured plans, version management, persisted state, and confirmation records. Test duplicate confirmations, plan modifications, session interruptions, and confirmation expiry.
Phase 3: Introduce Controlled Write Operations
Start with small-impact, easily verifiable operations. Implement idempotency, permissions, pre-execution validation, and result verification. For dynamically determined targets, use staged confirmation.
Phase 4: Add Exception Handling and Governance
Simulate tool timeouts, executor restarts, permission changes, partial successes, and malicious inputs. Verify that the system stops safely, reports accurately, and retains audit evidence.
Acceptance criteria should go beyond whether answers sound natural. They should include plan validity, interception of unauthorized actions, protection against duplicate execution, result traceability, and recovery behavior. Quality, latency, and resource consumption should also be measured separately, so a single success rate does not mask execution risks.
Conclusion
An agent platform can be a critical foundation for a complete business agent—but “complete” does not mean letting the model call more tools autonomously. It means every action has a clear goal, valid authorization, reliable execution, and truthful feedback.
For “plan first, confirm, then execute” requirements, the recommended architecture is: the model generates candidate plans, services validate them, users confirm a specific version, and the executor invokes tools under control. Keep flexibility with the model; put permissions, state, and business constraints in deterministic systems. That is how a demonstrable agent flow becomes a durable business capability.
