From the "Lobster Farming" Craze to Agent Engineering: Reliable Deployment and Cost Governance

    "Lobster farming" has become a popular metaphor in China for running AI agents: instead of just asking a model questions, users hand over a goal and expect the system to decompose tasks, call tools, and handle errors autonomously. This article explains why deploying an agent is only the beginning—real value comes from continuous operations. It covers the closed-loop architecture of production agents, how to choose tasks and automation levels, controllable planning and execution, tool design principles, state and memory governance, execution-layer security, cost measurement per successful task, evaluation frameworks, and a pragmatic path from a minimal closed loop to an operable business system.

    1. The Key to “Lobster Farming” Is Not Deployment, but Continuous Operations

    In the context of agent applications, “lobster farming” is a vivid metaphor: users no longer just ask a model questions. Instead, they hand over a goal and expect the system to autonomously break it into steps, call tools, handle exceptions, and complete the task.

    This means application form is shifting from “generating an answer” to “executing a workflow.” For example, given the request “organize this week’s project risks and produce a weekly report,” a conventional chat system might provide a writing template. An agent system, however, needs to read materials within its authorized scope, extract progress, identify risks, verify information sources, and then generate a reviewable result.

    However, being able to call tools is not the same as being able to do the work reliably. A prototype only needs to prove that “a task can succeed once.” A production system must answer stricter questions:

    Is it reliable when tasks run continuously? Does it read data beyond its permissions? Can it recover from mid-task failures? Are its conclusions backed by evidence? Are execution costs predictable? Can it avoid duplicate operations when writing to external systems?

    Therefore, the essence of “farming” is not installing the agent and letting it run, but continuously maintaining task boundaries, permission policies, knowledge sources, evaluation samples, and operating budgets. The closer an agent gets to real business, the more important engineering governance becomes.

    2. From Model Capability Progress to System Capability Maturity

    The attention on agents is related to model progress in understanding long instructions, generating structured content, using tools, and handling complex tasks. But model capability is only one part of system capability.

    A deliverable agent needs at least the following closed loop:

    User goal → Task constraints → Planning and decisions → Tool execution → Result verification → State update → Completion or handoff to a human.

    Within this loop, the model is mainly responsible for understanding, reasoning, and proposing actions; the orchestration system controls the flow, enforces permission checks, and records state; business tools perform the real operations; and verification modules determine whether results meet requirements.

    These responsibilities should not all be delegated to the model. For instance, the model may propose “send the report to the designated person,” but whether the recipient is within the allowed scope, whether the report contains sensitive information, and whether approval is required before sending should be determined by deterministic rules and permission systems.

    This layered design has two benefits: it reduces the uncertainty introduced by natural-language judgment, and when problems occur, it allows the responsible component to be identified—rather than attributing every error vaguely to “the model.”

    3. Choose the Task First, Then Decide the Automation Level

    Not all work is suitable for autonomous agent execution. When selecting tasks, prioritize three dimensions: whether results can be verified, whether errors can be undone, and whether the execution scope can be bounded.

    Tasks with easily verifiable results, reversible operations, and clearly defined permissions are better starting points. For example, document classification, read-only data queries, draft generation, and test case supplementation are generally easier to control than fund transfers, account permission changes, or public content publishing.

    Automation can be divided into three stages:

    Stage 1: Assisted generation. The system only provides analysis, suggestions, or drafts; humans perform the final operations.

    Stage 2: Controlled execution. The system can complete low-risk actions, but critical writes require confirmation, and exceptions must be handed off to humans.

    Stage 3: Bounded autonomy. Within a clear task scope, permission boundaries, and budget constraints, the system is allowed to execute continuously, supervised through auditing and monitoring.

    This is not a ladder that must be climbed. For high-risk business, retaining human confirmation long-term may be more reasonable than increasing autonomy. What truly needs optimization is the business outcome, not the number of automatically executed steps.

    4. Build a Controllable Task Planning and Execution Mechanism

    Agent planning cannot remain a paragraph of natural-language description. For production environments, tasks should be converted into execution units with clear inputs, outputs, and completion conditions.

    Each execution unit should specify at least:

    1. What problem it solves and what known information it uses;
    2. Which tools it may call and what permissions those calls require;
    3. What result counts as success and on what basis;
    4. Whether to retry after failure and whether alternative paths exist;
    5. Under what conditions it must stop or request human intervention.

    For fixed, repetitive business processes, prefer deterministic workflows, introducing the model only at nodes that require semantic understanding, information summarization, or dynamic judgment. For tasks whose steps change with the environment, adopt more flexible planning approaches.

    Replanning should be allowed during execution, but not infinite loops. When consecutive steps produce no meaningful progress, the same errors recur, the budget limit is reached, or critical facts cannot be verified, the system should pause and explain why.

    Stopping is not a sign of insufficient capability—it is essential behavior for a reliable system. Compared with continuing to try and consuming resources, exposing uncertainty in time is better for business safety.

    5. Tool Design Determines the Reliability Floor of an Agent

    Tools are not simply existing business APIs wrapped and handed to the model. Agent-facing tools should emphasize clear boundaries, constrained parameters, and judgeable results.

    First, tool responsibilities should be single-purpose. “Query order status within a specified time range” is easier to verify and authorize than “handle order-related matters.”

    Second, parameters should undergo both structural and business validation. Correct field types do not mean the operation is legitimate. Time ranges, resource ownership, the number of objects affected, and the current user’s permissions all need to be checked before execution.

    Third, return results should distinguish success, business rejection, and transient failure. Insufficient permissions should not trigger automatic retries; temporary connection failures can be retried with backoff within a limited count; parameter errors should enter a correction flow.

    For write operations, idempotency must be considered. A timed-out request does not mean the operation did not happen. If the agent retries directly, it may cause duplicate submissions. Risks can be controlled through unique business identifiers, operation status queries, and server-side deduplication.

    It is worth emphasizing: so-called “exactly-once execution” is usually not guaranteed by adding a retry parameter—it requires joint design with business state and storage mechanisms.

    6. State, Memory, and Retrieval Need Separate Governance

    When agents work for extended periods, it is easy to conflate task state, conversation history, and long-term knowledge, ultimately causing context bloat, accumulation of erroneous information, and even cross-task leakage.

    Task state records current progress: completed steps, pending approval actions, and the most recent failure reason. It should support persistence and recovery so that an interrupted process can resume without re-executing every step.

    Working memory retains the key facts of the current task: user constraints, verified conclusions, and important intermediate results. It can be compressed, but constraints that affect decisions must not be lost.

    Long-term materials should be obtained through controlled retrieval rather than being piled indefinitely into the context. Retrieval results need to preserve source, timestamp, and access permissions. Generated answers should distinguish “facts explicitly stated in the materials” from “inferences the system made based on them.”

    In particular, content previously generated by the model should not be treated as reliable fact by default. If unverified inferences are written into long-term memory, subsequent tasks may cite them repeatedly, creating error reinforcement. Writes to long-term memory should have source verification, update, and deletion mechanisms.

    7. Security Boundaries Must Be Enforced at the Execution Layer

    Agents both read natural language and may perform real operations, so malicious instructions embedded in external materials are a risk that must be considered. For example, a document might contain text instructing the system to ignore restrictions, read other files, or send sensitive content.

    Such content should be treated as data to be analyzed, not as instructions with execution authority. Merely reminding the model in the prompt to “not be distracted” is insufficient. Isolation must also be implemented at the system level:

    First, least privilege. Grant only the read or write permissions necessary for the current task, and avoid sharing long-lived high-privilege credentials.

    Second, read/write separation. Material reading and external sending should use different tools and authorization rules, preventing a single erroneous judgment from escalating directly into data leakage.

    Third, approval for high-risk operations. Deletion, permission changes, external publishing, and other hard-to-undo actions should have explicit confirmation checkpoints.

    Fourth, execution environment constraints. File operations, code execution, and network access should occur within limited scopes, with restrictions on accessible resources and resource consumption.

    Fifth, audit trails. Record key decisions, tool calls, permission checks, and operation results, while avoiding storing keys or unnecessary sensitive data directly in logs.

    8. Cost Optimization Should Look at Cost per Successful Task, Not per Call

    When discussing model costs, the easiest mistake is comparing only per-call prices. Agents often require multiple rounds of reasoning, multiple tool calls, and remediation after failures. A cheaper model that frequently takes wrong paths may not have lower total cost.

    A more reasonable metric is:

    Average cost per effectively completed task = total relevant cost in the measurement period ÷ number of tasks that pass acceptance.

    Relevant costs include not only model calls but also tool execution, compute resources, retrieval and storage, and human review and rework. Acceptance criteria must remain consistent; otherwise, different approaches cannot be fairly compared.

    In practice, layered processing can be adopted: rules handle deterministic work such as format checks and field filtering; lower-cost models handle simple classification and information extraction; only when tasks are complex, results conflict, or risk is high should the system escalate to stronger reasoning capability.

    Additionally, costs can be controlled by compressing irrelevant context, limiting the size of single retrievals, reusing stable results whose permissions and validity remain consistent, and setting maximum execution steps.

    Any claim of “significantly lower cost with similar results” should be scoped to a specific task set, success criteria, and operating conditions. Ratios detached from these conditions should not be used directly for business budgeting.

    9. Replace Demo Impressions with an Evaluation System

    Agent evaluation cannot be based solely on whether the final answer reads fluently. Metrics should be built around the complete execution chain, covering at least task success rate, factual accuracy, tool-call correctness, permission violations, end-to-end latency, and the proportion of human intervention.

    The test set should include three types of samples: routine tasks that can be completed normally; exceptional tasks involving missing information or temporarily unavailable tools; and security tasks involving malicious instructions, sensitive data, or permission conflicts.

    For document-generation tasks, check whether key facts have sources and whether necessary information is omitted. For data-operation tasks, verify whether the business state truly reached the goal, rather than trusting a single “success” message returned by a tool.

    Regression testing should also be conducted before launch. Changes to the model, prompts, tool descriptions, or retrieval strategy can all alter execution paths. A single improved experience cannot be used to infer overall quality improvement.

    In production, continuously observe failure types. If problems mainly stem from missing data, optimizing the model may not help; if they mainly stem from permission configuration or unclear tool responses, fix the corresponding system rather than stacking more prompts.

    10. From a Minimal Closed Loop to an Operable System

    A pragmatic adoption path starts with tasks of limited scope and clear value: define inputs and acceptance criteria, and connect only the necessary read-only tools. After stability is verified, add write capabilities gated by approval. Finally, gradually expand permissions and task scope based on operational data.

    At every step, the ability to pause, roll back, and hand over to humans should be preserved. The greater the system’s impact on the external environment, the stricter the validation and approval should be.

    What is truly worth attention in “lobster farming” is not how autonomous the system appears, but how automation capability continuously produces verifiable value. The model provides understanding and reasoning; the engineering system constrains that capability within executable, traceable, and recoverable boundaries.

    Only when task success rate, security, cost, and maintenance burden can all be continuously measured does an agent stop being merely an impressive demo and become a business system that delivers long-term value.