Design Differences and Experience Accumulation Practices for Long-Running AI Agents
This article explores the design differences in long-running AI agents, focusing on two core orientations: execution-first and experience-first. It covers architectural foundations for task lifecycles, memory categorization, skill accumulation, security boundaries, evaluation metrics, and a phased deployment path to build reliable and self-improving agent systems.
1. Why Do Agents Differ in Design Despite Similar Capabilities?
A long-running agent residing on a server typically shares similar foundational capabilities: receiving user requests, invoking models, executing tools, reading and writing files, saving necessary information, and sending results upon task completion. Users can interact with it via a CLI or messaging interfaces.
However, these capabilities only describe what the system “can do,” not “how it organizes its work.”
What truly dictates the user experience and engineering complexity is the system’s approach to handling state, permissions, and experience. For example:
- Can the task continue after the user closes the chat window?
- Can execution progress be recovered after a service restart?
- Will subsequent tasks adopt new rules after a user corrects an error?
- Can a successfully completed workflow be transformed into a reusable skill?
- Can automatically accumulated experiences be traced and rolled back when issues arise?
Therefore, discussions about long-running agents should shift from feature lists to design orientations. This article categorizes these orientations into “Execution-First” and “Experience-First.” These are two dimensions for analyzing architecture; they do not strictly divide all systems into two mutually exclusive categories.
2. Two Design Orientations: Reliable Task Completion vs. Continuous Experience Accumulation
2.1 Execution-First: Reliably Completing the Current Task
This orientation prioritizes the task closed-loop: how requests enter the system, how tasks are decomposed, how tools are invoked, how failures are handled, and how results are delivered.
For instance, if a user requests daily summaries of newly added reports in a specific directory, the system must identify the file scope, extract content, generate a summary, and send the result to the designated endpoint. The engineering focus here is not on constantly changing the agent’s behavior, but on ensuring clear execution boundaries, recovery after failure, and preventing duplicate writes from repeated triggers.
It is better suited for relatively fixed, high-frequency tasks with clear result requirements. Design priorities include task state machines, permission isolation, retry strategies, execution logs, and delivery confirmations.
2.2 Experience-First: Reducing the Cost of Repeated Trial and Error
Beyond task completion, this orientation focuses on what remains after the task ends.
User preferences, project constraints, validated workflows, and common failure causes can all serve as references for future work. The system needs to remember not just that “the user prefers concise reports,” but also that “when processing certain files, encoding and field integrity should be checked first.”
The goal is not to let the agent modify itself unconditionally, but to enable validated experiences to be reused in appropriate scenarios. Accordingly, the system must answer three questions: What is worth saving? When should it be used? How should it be corrected if found inapplicable?
Execution reliability and experience reuse are not contradictory. The former ensures a single task is completed, while the latter reduces repeated trial and error across multiple tasks.
3. Foundation of Long-Running Systems: Task Lifecycle Cannot Depend on Chat Windows
Long-running does not mean letting the model generate content continuously. A more rational approach is to keep the service available, trigger tasks upon events or schedules, and persist execution state outside the model’s context.
A general architecture can include the following components:
- Interaction Layer: Receives requests from CLI, messaging endpoints, or business systems, handling authentication and input normalization.
- Task Scheduling Layer: Manages timed triggers, queuing, concurrency control, cancellation, and timeouts.
- Execution Layer: Invokes models and tools, managing step dependencies and execution results.
- State and Memory Layer: Separately saves task progress, user preferences, project constraints, and experience records.
- Result Delivery Layer: Sends summaries, files, or error descriptions, and logs notification status.
- Governance Layer: Provides permission verification, auditing, approval, and monitoring alerts.
These responsibilities can be deployed in a single service or split according to scale. The key is not the number of components, but clear ownership of state.
3.1 Distinguishing Task Status from Message Status
Task completion does not mean the user has received the result. If message delivery fails, the system should retry the notification rather than rerunning the entire task.
Therefore, at minimum, the following should be recorded separately:
- Task execution status;
- Result persistence status;
- Notification delivery status.
Otherwise, a brief communication failure could lead to duplicate processing, duplicate resource consumption, or repeated delivery of business content.
3.2 Designing Recovery Points for Long Tasks
For batch file processing or multi-step analysis, save checkpoints at appropriate stages, including processed scope, generated intermediate results, failure causes, and next actions.
Recovery cannot rely on a simple note like “last time reached step 3.” It must verify whether step 3’s artifacts exist, are complete, and are still applicable to the current input. Checkpoints are recovery references, not unverified facts.
3.3 Constraining Retries with Idempotent Design
Schedulers, networks, and tool calls may all trigger retries. For external write operations, use unique business identifiers, state checks, or deduplication records to avoid duplicate side effects from the same task.
For operations that cannot be safely repeated, confirm the state before execution and require human approval if necessary. Do not assume the model can determine if an operation has taken effect based solely on conversation history.
4. Memory System: Preferences, Facts, and Processes Must Not Be Confused
The value of long-term memory lies in reducing repetitive explanations, but saving more is not necessarily better. Unfiltered information introduces retrieval noise, privacy risks, and error propagation.
4.1 User Preference Memory
This describes relatively stable user choices, such as report structure, depth of explanation, output language, and notification timing.
When saving, record the source and scope of application. A user requesting “just the conclusion” in one task does not mean all future tasks should omit analysis. In-task instructions must be distinguished from long-term preferences, and explicit current requests should take precedence over historical preferences.
4.2 Project Fact Memory
This describes specific project environments and constraints, such as directory structures, approval workflows, data field definitions, and accessible resources.
Project facts are time-sensitive. The system should record update times and re-check relevant conditions before critical operations. Applying paths, permissions, or workflows from an old environment to a new one can cause execution failures or even misoperations.
4.3 Process Experience Memory
This focuses on “under what conditions, what method was used, and what result was achieved.”
A useful experience record cannot contain only a conclusion. For example, “retry on exception” lacks boundaries and may lead to repeated execution of operations with side effects. A more complete record should include task type, preconditions, failure phenomena, handling methods, validation basis, and non-applicable scenarios.
Experiences can retain failure cases, as explicit failure conditions often help the system rule out invalid paths earlier.
5. Skill Accumulation: Turning Experience into Verifiable Operational Flows
Skills should not merely be compressed summaries of historical conversations. They are closer to work instructions that can be understood, invoked, and verified by an executor, potentially including steps, checklists, templates, or controlled scripts.
Taking “organizing periodic reports” as an example, a reusable skill should clearly define:
- Goal: Generate report summaries within a specified scope.
- Input: File location, time range, field requirements.
- Preconditions: Source is accessible, file format meets requirements.
- Execution Steps: Filter files, validate content, summarize information, generate results.
- Output Agreement: Summary, exception list, processing scope description.
- Validation Method: Check record counts, source coverage, and result consistency.
- Permission Boundary: Read-only source files, no automatic modification of original data.
- Failure Handling: Explain limitations when data is missing, rather than fabricating it.
Such a skill forms the basis for reuse. A mere record of “this worked last time” is insufficient to support stable execution.
5.1 Do Not Automatically Upgrade a Single Success into a General Rule
A single task may rely on accidental conditions or contain undiscovered errors. A user’s one-time correction may also just be a special requirement for the current task.
A more robust process is:
Discover candidate experience -> Extract applicable conditions -> Check sensitive information -> Validate workflow -> Review and publish -> Record usage effects.
For low-risk format preferences, a lighter confirmation process can be used. For skills involving configuration changes, data deletion, or external content delivery, stricter review and execution limits should be set.
5.2 Skills Need Version Management and Rollback
When a workflow changes, save old and new versions, modification reasons, and validation records instead of directly overwriting the original description.
If a new version causes failures, the system should be able to suspend its use and roll back. Skills may also conflict, such as two experiences offering different handling methods for the same scenario. In such cases, judgments should be made based on scope of application, validation status, and update time. If necessary, defer to user confirmation rather than simply selecting the most recently retrieved one.
6. The Reasonable Boundary of “Self-Improvement”
In most engineering practices, an agent’s continuous improvement primarily occurs at the level of external memory, skill libraries, and execution strategies. This does not mean the underlying model parameters have changed, nor does it mean the system naturally forms stable and reliable new capabilities.
Improvement can be categorized into three levels:
- Context Adaptation: Adjusting behavior based on feedback for the current task; effects primarily exist within this execution.
- Persistent Experience: Saving preferences, facts, or workflows for reference in subsequent tasks.
- Controlled Workflow Updates: Updating skills or execution rules after validation and authorization.
These three levels require different governance approaches. Notably, instructions in external documents or tool outputs should not directly become long-term rules. Such content should be treated as data for analysis, not as commands superseding user authorization and system constraints.
A more accurate understanding of continuous growth is: under the premise of non-expanding permissions, traceable experience, and verifiable effects, the system gradually reduces repetitive explanations and repeated trial and error.
7. Security Focus for Long-Running Systems: Continuous Access and Memory
Long-running agents may hold resource access capabilities for extended periods, so they should adhere to the principle of least privilege. Reading data, writing files, modifying configurations, and sending messages should not share an unrestricted authorization scope.
7.1 Separate High-Risk Operations from Ordinary Analysis
Reading files and generating suggestions can be done in a lower-risk environment. Deleting files, changing configurations, or publishing content externally should use a restricted execution environment with approvals based on impact scope.
Approval prompts should display the actual operational targets and expected impacts, not just a vague “continue?”
7.2 Separate Credentials from Experience Storage
Keys, passwords, and access tokens should not enter skill descriptions or general memory. The executor can obtain necessary credentials through controlled mechanisms, but the model should not gain plaintext access to all credentials just because it needs to invoke a tool.
Logs and experience extraction processes also require desensitization to avoid permanently saving sensitive information from a single execution.
7.3 Allow Users to View, Modify, and Delete Memory
Persistent memory is not an invisible internal asset. Users should be able to understand what preferences and project facts the system has saved and correct erroneous records.
For sensitive or outdated information, deletion and expiration mechanisms should be provided. Enterprise scenarios also require clear isolation boundaries between different users, projects, and organizations to prevent cross-scope experience leakage.
8. How to Verify if the Experience Mechanism Truly Adds Value
The fact that an agent generates skills does not mean those skills improve task quality. Evaluation should cover efficiency, correctness, and risk.
Focus on the following metrics:
- Task Completion Quality: Does the result meet acceptance criteria, or is it just returning text?
- Repetitive Explanation Cost: Are users providing supplementary information less often for similar tasks?
- Workflow Reuse Effectiveness: Have validated skills reduced unnecessary exploration?
- Error Reuse Incidents: Have outdated or inapplicable experiences caused new failures?
- Human Intervention Needs: Does the system request confirmation at the correct nodes?
- Recovery Capability: Can it correctly resume after interruptions, restarts, and notification failures?
- Governance Capability: Can it trace experience sources, revoke rules, and delete memory?
Testing should retain a set of repeatable tasks to compare performance with and without the experience mechanism in similar environments. Include anomalies like environmental changes, insufficient permissions, missing inputs, and incorrect experiences. Only after both benefits and risks are observed can you determine whether an improvement mechanism is worth scaling.
9. Practical Path: Reliable Operation First, Then Gradual Experience Reuse
When building a long-running agent, do not pursue fully automatic experience accumulation from the start. A more controllable path is to advance in phases.
Phase 1: Establish a Reliable Execution Foundation. Complete authentication, permission control, task state persistence, timeout handling, logging, and result notifications, making the task closed-loop observable and recoverable.
Phase 2: Introduce Limited Memory. Prioritize saving user-confirmed preferences and project constraints, providing capabilities to view, modify, and delete. Avoid converting all conversations into long-term memory by default.
Phase 3: Build a Human-Confirmed Skill Library. Start with high-frequency, low-risk tasks with clear acceptance criteria. Organize mature workflows into structured skills and enable them after validation.
Phase 4: Add Automatic Candidate Experience Extraction. The system can automatically discover practices worth reusing, but publishing and execution remain constrained by scope of application, validation results, and permission rules.
The core competitiveness of a long-running agent is not just the number of tools or chat interfaces, but whether it can organize task execution, state recovery, experience accumulation, and security governance into a reliable closed-loop. Good design allows the system to remember valuable information while knowing what information needs re-validation, what actions require authorization, and what experiences should be revoked in a timely manner.
