Can You Build a Complete AI Agent? Platform Selection and the Plan-Execute Loop
This article explains why evaluating an AI agent platform requires more than a feature checklist, and focuses on four native capabilities: state management, human-in-the-loop interruption points, tool governance, and observability with replay. It outlines a five-stage planning-confirmation-execution loop, contrasts prototype and production requirements, and offers a fallback architecture that decouples state and execution when a platform falls short.
1. The Real Difficulty Is Not Whether an Agent Exists
When evaluating agent platforms, many teams start with a visible feature checklist: can it connect to models of different sizes, configure prompts, attach a knowledge base, declare tools, orchestrate workflows, and publish an application in one click? These capabilities are indeed foundational, but they only determine whether you can build a demo, not whether the system can run stably for six months.
The original requirements contain three easily underestimated demands: autonomously planning tools based on the user’s question, explicitly telling the user the execution plan, and waiting for user confirmation before executing. Combined, these three cross the line from a “question-answering application” into a “stateful, interruptible, auditable automation system.” To judge whether a platform can support a complete agent, the key is whether it natively supports the following four capabilities:
- State management: whether intermediate state at the session and task levels can be persisted and recovered after a process restart.
- Human-in-the-loop interruption points: whether the execution chain can pause, return pending information to the frontend, and resume execution from user input.
- Tool governance: whether input/output schema validation, timeouts, retries, idempotency, and permission boundaries can be declared.
- Observability and replay: whether each step’s model input/output, tool call parameters, and latency can be traced and replayed.
If a platform only provides a workflow engine with “one-shot sequential execution,” then “plan confirmation” can only be patched together on the frontend. This typically shows up as concatenating the plan into the reply text and asking the user to say “agree” in natural language, with the system continuing via keyword matching. This works in a demo, but in production it quickly spirals out of control due to phrasing diversity, context loss, and the inability to replay.
2. How to Design the Plan-Confirm-Execute Loop
A reliable loop can be abstracted into five stages, and it is advisable to treat them as independently testable modules during the design phase.
- Intent recognition and task boundary determination. First determine whether the request falls within the coverage of available tools. If it exceeds the boundary, return a refusal or a human handoff strategy directly, rather than letting the model hard-code a plan.
- Plan generation. Output a structured plan rather than a natural-language paragraph, where each step includes the goal, the tool to be called, the source of parameters, the expected output, and the failure fallback strategy.
- Plan confirmation. Render the structured plan into a human-readable view, wait for explicit confirmation or revision feedback, and write the revision back as a new plan version.
- Step-by-step execution and state synchronization. Execute step by step, sync progress to the user after each step, and allow cancellation midway.
- Wrap-up and record keeping. Aggregate outputs, record the full chain, and mark human intervention points for subsequent auditing and optimization.
Example of a structured plan:
{"task_id": "T-20260822-001","plan_version": 2,"status": "awaiting_confirmation","steps": [{"id": 1,"goal": "Query abnormal order details from the last 30 days","tool": "data_query","inputs": {"range": "30d", "filter": "status=abnormal"},"on_failure": "retry_then_ask_user"},{"id": 2,"goal": "Generate a summary chart","tool": "chart_render","inputs": {"source": "step_1.output"},"on_failure": "fallback_to_table"}]}
It is worth emphasizing that the plan must be generated under the constraint of an “enumerable tool set.” A common and effective practice is to first perform a tool retrieval pass, injecting only the schema descriptions of the few tools most relevant to the current question into the model context, which both reduces the misselection rate and controls context length.
3. Why Prototype and Production Standards Differ
The prototype stage pursues the speed of getting the chain working, usually running on a single machine, with a single session, no concurrency, and no permission isolation; when something breaks, a restart is enough. The changes in the production stage concentrate in four areas:
- Concurrency and resources: with multiple sessions running in parallel, model quotas, tool connection pools, and queue backlogs all become bottlenecks, requiring rate limiting and degradation strategies.
- Permissions and data boundaries: who can call which types of tools and which data ranges can be read must be constrained uniformly on the platform side, not left to prompt self-discipline.
- Long-running reliability: tasks may span several minutes or longer, requiring task-level persistence and resume-from-breakpoint to avoid losing context when the user refreshes the page.
- Cost and capacity: multi-round planning amplifies the number of model calls, requiring per-step limits, caching of repeated retrieval results, and smaller models for low-risk steps.
Therefore, when selecting a platform, the more worthwhile questions are not whether a feature exists, but the answers to these: where is state stored and who cleans it up; are tool call timeouts and retries configurable; can chain logs be correlated by task; does the permission model support field-level or row-level control; and are there source-level extension points to integrate existing business systems.
4. Implementation Advice and a Self-Built Fallback
If the evaluation finds the platform lacking in interruption recovery and tool governance, a fallback combination of “platform orchestration + external state store + tool gateway” can be used: the platform handles conversation and display, an external key-value or relational store holds plan and step state, and a unified tool gateway handles authentication, validation, rate limiting, and auditing. The core is to decouple state from execution, with the platform serving only as the interaction layer.
# Pseudocode: skeleton of an interruptible plan executordef run_plan(task_id, user_input=None):ctx = store.load(task_id)if user_input:ctx = planner.apply_revision(ctx, user_input)if ctx.status == "awaiting_confirmation":return render(ctx) # return to frontend and wait for confirmationfor step in ctx.steps:if step.done:continueresult = tool_gateway.invoke(step.tool, step.inputs) # includes auth/rate limiting/auditstep.record(result)store.save(ctx) # persist after each step to support resumectx.status = "finished"store.save(ctx)return summarize(ctx)
In related practices at Baidu AI Cloud, such systems typically place state on a general-purpose storage service, consolidate tool calls into a unified API gateway, and use logging and monitoring with alerting to complete chain tracing and anomaly detection, moving the agent from “demo-able” to “operable.”
The conclusion is not complicated: the threshold for a complete agent is not model capability, but the engineering infrastructure of state, permissions, and observability. Design the loop and governance clearly first, then decide which type of platform to use, so that the selection order is not led astray by a feature checklist.
