<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: dreamyman</title>
    <description>The latest articles on DEV Community by dreamyman (@dreamyman).</description>
    <link>https://dev.to/dreamyman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4229930%2F8ffd4b68-318a-4c46-a5d5-07df3c10968c.png</url>
      <title>DEV Community: dreamyman</title>
      <link>https://dev.to/dreamyman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dreamyman"/>
    <language>en</language>
    <item>
      <title>Outsourcing AI Projects? Don't Settle for Model Accuracy—Write These 4 Metric Categories Into Your Contract</title>
      <dc:creator>dreamyman</dc:creator>
      <pubDate>Sat, 07 Nov 2026 04:37:24 +0000</pubDate>
      <link>https://dev.to/dreamyman/outsourcing-ai-projects-dont-settle-for-model-accuracy-write-these-4-metric-categories-into-your-3ag1</link>
      <guid>https://dev.to/dreamyman/outsourcing-ai-projects-dont-settle-for-model-accuracy-write-these-4-metric-categories-into-your-3ag1</guid>
      <description>&lt;p&gt;Writing "Model accuracy shall not fall below the agreed threshold" in an AI outsourcing contract is virtually equivalent to having no acceptance criteria at all. &lt;/p&gt;

&lt;p&gt;That sounds harsh, but the reality is straightforward: according to a &lt;a href="https://www.folio3.com/ai/blog/ai-project-failure-rate-stats" rel="noopener noreferrer"&gt;RAND analysis of over 2,400 enterprise AI projects&lt;/a&gt;, 80.3% of projects failed to deliver their expected business value. Technical metrics pass inspection while business implementations fail—this happens all the time.&lt;/p&gt;

&lt;p&gt;My view: model accuracy belongs in internal vendor testing and pre-launch evaluations. It should never serve as the primary acceptance criteria in a vendor contract. Contracts for outsourced AI projects must be built around four distinct categories of metrics: &lt;strong&gt;Business Outcomes&lt;/strong&gt;, &lt;strong&gt;Scope Boundaries&lt;/strong&gt;, &lt;strong&gt;Latency &amp;amp; Availability&lt;/strong&gt;, and &lt;strong&gt;Error Handling &amp;amp; Retraining Liabilities&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Here is how to structure each one.&lt;/p&gt;




&lt;p&gt;Model accuracy simply measures the percentage of predictions a model gets right. It tells you nothing about &lt;em&gt;where&lt;/em&gt; errors occur or &lt;em&gt;how expensive&lt;/em&gt; those errors are to your operation. &lt;/p&gt;

&lt;p&gt;Imagine a manufacturing company outsourcing a visual quality control AI. The contract specifies: "Average accuracy on the test dataset shall meet vendor commitments." Once deployed, strong ambient light reflections on the shop floor trigger a wave of false alarms, flagging good parts as defective. To keep the line moving, operators bypass the system entirely, letting real defects slip through to customers. When confronted, the vendor points to the contract: the test set accuracy was met. &lt;/p&gt;

&lt;p&gt;This example doesn't disprove the value of accuracy; it illustrates how aggregated test scores mask error distributions and real-world operational costs. &lt;/p&gt;

&lt;p&gt;A secondary issue is data quality. Gartner research attributes 85% of AI project failures to poor data quality—issues that rarely show up on curated test sets and only surface after deployment. If your contract omits business outcomes and post-launch retraining liabilities, you will end up paying for a high model score that fails in production.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Business Outcomes: Stop Accepting Test Set Scores
&lt;/h2&gt;

&lt;p&gt;Business outcome metrics must be drawn directly from your operational systems, not from static test datasets. Test sets are exam questions prepared by the vendor; your business systems represent the unpredictable reality of daily operations.&lt;/p&gt;

&lt;p&gt;Take a mid-sized manufacturer outsourcing visual quality inspection as an example. Instead of model accuracy, the contract should specify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Within an agreed post-launch evaluation window, the defect escape rate (missed defects) on Line A shall not exceed &lt;strong&gt;X%&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Manual review volume shall not exceed &lt;strong&gt;Y units per shift&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Production line downtime caused by false positives shall not exceed &lt;strong&gt;Z minutes&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The baseline numbers for X, Y, and Z should be measured from your existing operational data before project kickoff—never guessed off the top of your head.&lt;/p&gt;

&lt;p&gt;If you are outsourcing an AI customer support system for cross-border e-commerce, relevant metrics might include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The error rate in extracting buyer inquiry details.&lt;/li&gt;
&lt;li&gt;The percentage of incoming orders requiring human takeover.&lt;/li&gt;
&lt;li&gt;The frequency of repeated questions for the same issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key is writing exact metric definitions, measurement methodologies, data sources, and evaluation windows directly into the contract.&lt;/p&gt;

&lt;p&gt;Focusing on business outcomes also prevents the "Pilot Success, Scale Failure" trap—a common pattern analyzed in detail in &lt;a href="https://www.pierceliu.top/en/blog/ai-pilot-success-scale-failure" rel="noopener noreferrer"&gt;AI Pilots Always Succeed, But Scale Fails: What's Missing Isn't the Model&lt;/a&gt;. Without concrete business metrics in the agreement, final acceptance easily devolves into vendor slide decks in a conference room.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Scope Boundaries: Lock Down the Perimeter
&lt;/h2&gt;

&lt;p&gt;The most common source of friction in AI outsourcing isn't complete model failure—it is the scope dispute: &lt;em&gt;"We never agreed to cover that scenario."&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;A model might perform impeccably on Assembly Line A, only to break down on Line B due to different lighting. An AI assistant might handle Chinese and English inquiries well, then garble Italian ones. Contracts that only specify overall accuracy implicitly assume complete coverage across all scenarios when none exists.&lt;/p&gt;

&lt;p&gt;Your contract must explicitly define scope boundaries, including at least:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product models or SKUs&lt;/li&gt;
&lt;li&gt;Specific defect types or ticket categories&lt;/li&gt;
&lt;li&gt;Supported languages and communication channels&lt;/li&gt;
&lt;li&gt;Data input conditions (e.g., image resolution, lighting levels)&lt;/li&gt;
&lt;li&gt;Hardware models or machine specs&lt;/li&gt;
&lt;li&gt;Permissible operator behavior boundaries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The contract must also specify what happens when operational realities exceed these bounds. If a new defect type appears post-launch, is the vendor obligated to update the model under the existing agreement? If left unsaid, vendors will almost certainly quote it as a brand-new custom project. Your contract should explicitly distinguish between &lt;strong&gt;"in-scope optimization"&lt;/strong&gt; and &lt;strong&gt;"out-of-scope additions"&lt;/strong&gt;, setting response times and costs for each.&lt;/p&gt;

&lt;p&gt;Industry leaders already treat scenario adaptation capability as a core delivery benchmark. In September 2025, Alibaba Cloud earned the highest level (Level 5) certification for enterprise LLM delivery from the China Academy of Information and Communications Technology (CAICT), evaluating &lt;a href="https://ue.aliyun.com/news/20251014" rel="noopener noreferrer"&gt;34 core capabilities&lt;/a&gt; across requirements analysis, fine-tuning, scenario adaptation, and ongoing maintenance. Regardless of vendor size, demanding clearly defined scenario boundaries is a basic sanity check of vendor delivery maturity.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Latency &amp;amp; Availability: Don't Be Fooled by 99.9% Uptime
&lt;/h2&gt;

&lt;p&gt;Many AI contracts include standard SLA language like "System availability shall not fall below 99.9%." While 99.9% sounds impressive, it offers very little protection for AI workloads.&lt;/p&gt;

&lt;p&gt;Consider the &lt;a href="https://redresscompliance.com/azure-openai-sla-and-support" rel="noopener noreferrer"&gt;public SLA for Azure OpenAI&lt;/a&gt;. While it guarantees 99.9% monthly availability, it strictly measures whether the API &lt;em&gt;returned a response&lt;/em&gt;—not how fast that response arrived. Furthermore, the first 43.2 minutes of monthly downtime trigger zero financial credits. Beyond that threshold, credits are capped at 10% of the monthly bill, reaching 25% only if total downtime exceeds 7 hours and 12 minutes in a single month. &lt;/p&gt;

&lt;p&gt;In other words, the issues that actually cripple business operations—high latency, rate-limiting, and severe queueing—often carry zero vendor financial penalty.&lt;/p&gt;

&lt;p&gt;When mid-sized businesses implement AI, they typically rely on an integrator or contractor who routes requests to upstream cloud LLM providers. Uncovered latency risks from upstream vendors must be contractually absorbed by your integration partner or accounted for in pricing.&lt;/p&gt;

&lt;p&gt;Define &lt;strong&gt;"Effective Availability"&lt;/strong&gt; separately in your contract:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Latency Thresholds&lt;/strong&gt;: Mandate that &lt;strong&gt;p95 response time&lt;/strong&gt; shall not exceed X seconds (p95 latency is a percentile metric that prevents extreme delays from being hidden by average figures). If the threshold is exceeded continuously for an agreed duration, it counts as a performance failure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity &amp;amp; Concurrency&lt;/strong&gt;: Explicitly define maximum supported concurrent requests, queueing logic, and graceful degradation plans during peak loads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Financial Remedies&lt;/strong&gt;: Ensure penalties are structured as direct cash refunds or invoice deductions rather than service credits restricted to future spend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Latency isn't a minor technical detail; it directly impacts revenue. If a quality control AI goes from responding within seconds to keeping the line waiting, the line may not be able to wait for it, and the whole system may end up bypassed.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Error Handling &amp;amp; Retraining Liabilities: Clarify Ongoing Ownership
&lt;/h2&gt;

&lt;p&gt;Once deployed, AI models inevitably encounter fresh data distributions and edge-case errors. Yet, small and mid-sized businesses rarely specify in their contracts what happens when a model makes mistakes after sign-off. As a result, the day after acceptance, every required tweak is billed as a paid change order.&lt;/p&gt;

&lt;p&gt;Your contract should explicitly cover four key governance points:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Error Severity Classification&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;P0 (Critical)&lt;/strong&gt;: Safety incidents, legal or compliance violations, or significant customer loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;P1 (Major)&lt;/strong&gt;: Errors in core functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;P2 (Minor)&lt;/strong&gt;: Cosmetic or low-impact anomalies. 
Set distinct response and resolution SLAs for each tier.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Drift Monitoring&lt;/strong&gt;: Over time, operational data deviates from training sets, causing accuracy degradation. Specify which party is responsible for monitoring metric drift and how frequently performance reports must be delivered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retraining Triggers&lt;/strong&gt;: When error rates cross agreed thresholds, or when new languages or defect types are added, require the vendor to deliver a remediation plan within a set number of business days. State clearly whether retraining costs are included in the initial contract or first-year maintenance agreement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data &amp;amp; Artifact Ownership&lt;/strong&gt;: Ensure full ownership rights to training datasets, custom annotations, prompt templates, and evaluation sets. Confirm that these assets can be exported without lock-in if the contract terminates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If your project involves an enterprise knowledge base or RAG (Retrieval-Augmented Generation) system, governance and update mechanics are even more critical. As noted in &lt;a href="https://www.pierceliu.top/en/blog/knowledge-base-failure-governance-mechanisms" rel="noopener noreferrer"&gt;Knowledge Base Governance: Three Essential Mechanisms&lt;/a&gt;, a knowledge base doesn't stay alive just because it was built: it needs write incentives, clear ownership, and expiration rules. Failing to contractually mandate these processes means paying for a static system destined to fail.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Does This Framework Not Apply?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standardized SaaS Products&lt;/strong&gt;: If you are buying an off-the-shelf SaaS tool rather than commissioning custom outsourcing, contract negotiation leverage is limited. However, you can still use these four categories to evaluate vendor suitability: Is the scope clearly bounded? Does the SLA cover latency? Is there a clear escalation path for performance regression?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Early-Stage Feasibility Pilots&lt;/strong&gt;: For small, low-budget experimental pilots, demanding strict business outcome SLAs may be impractical. The goal of a pilot is testing feasibility. The contract should instead focus on pilot scope boundaries, fallback conditions, and explicit constraints preventing unvetted rollout to production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  An Unresolved Operational Challenge
&lt;/h3&gt;

&lt;p&gt;Many SMBs lack historical baseline data and cannot quantify operational baselines when drafting the contract. You are left with two choices: pay upfront for an initial data audit, or insert a clause stating that &lt;em&gt;baselines will be established within an agreed window post-launch&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;I lean toward the latter, but it leaves the vendor room to argue, so it may need to be constrained through payment milestones.&lt;/p&gt;




&lt;p&gt;This article doesn't provide a contract template. But the core logic behind these four metric categories is simple: &lt;strong&gt;Acceptance testing should prove that your business problem was solved—not just that a vendor's model looks good on paper.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ue.aliyun.com/news/20251014" rel="noopener noreferrer"&gt;Alibaba Cloud Earns CAICT Level 5 Certification for Enterprise LLM Delivery&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://redresscompliance.com/azure-openai-sla-and-support" rel="noopener noreferrer"&gt;Azure OpenAI SLA: Credits, Latency, and Support Plans | Redress Compliance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.folio3.com/ai/blog/ai-project-failure-rate-stats" rel="noopener noreferrer"&gt;AI Project Failure Rate in 2026: What the Data Shows | Folio3 AI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.pierceliu.top/en/blog/ai-contract-acceptance-4-metrics" rel="noopener noreferrer"&gt;pierceliu.top&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>sre</category>
      <category>management</category>
    </item>
    <item>
      <title>Put an AI agent in one process and day one gives you two walls</title>
      <dc:creator>dreamyman</dc:creator>
      <pubDate>Fri, 06 Nov 2026 08:13:48 +0000</pubDate>
      <link>https://dev.to/dreamyman/put-an-ai-agent-in-one-process-and-day-one-gives-you-two-walls-2bli</link>
      <guid>https://dev.to/dreamyman/put-an-ai-agent-in-one-process-and-day-one-gives-you-two-walls-2bli</guid>
      <description>&lt;p&gt;Picture an ordinary request: have an AI pull data from thirty websites, clean it up, and turn it into a report. This is not a chat — one question, one answer, done. It runs &lt;strong&gt;for two hours straight&lt;/strong&gt;, downloads files, eats memory, and executes code the AI writes for itself along the way.&lt;/p&gt;

&lt;p&gt;Getting that working on your own laptop takes an afternoon. Turning it into a service several people use at once is where the difficulty starts.&lt;/p&gt;

&lt;p&gt;This opens a six-part series on building an agent sandbox from scratch. Each post fixes one problem the previous one exposed, and the code lives in &lt;a href="https://github.com/dreamyman/agent-sandbox-oss" rel="noopener noreferrer"&gt;agent-sandbox-oss&lt;/a&gt; so you can run it yourself. Terms get explained where they first appear; no Kubernetes background required.&lt;/p&gt;

&lt;p&gt;One thing about the code: it is a &lt;strong&gt;teaching skeleton&lt;/strong&gt;. Real crawling is replaced by "sleep for a bit", and the cluster runs on a laptop. It is not meant to ship. Its value is that every crash in it is a crash real projects have.&lt;/p&gt;

&lt;h2&gt;
  
  
  The obvious way to write it, and the assumption hiding inside
&lt;/h2&gt;

&lt;p&gt;The natural implementation: a web endpoint takes a task, starts working in the background, and keeps the progress in memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;IN_MEMORY_DB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;   &lt;span class="c1"&gt;# task progress lives here
&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_data_research_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_pages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;simulate_leak&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_pages&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                      &lt;span class="c1"&gt;# pretending to fetch a page
&lt;/span&gt;        &lt;span class="n"&gt;IN_MEMORY_DB&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pages_crawled&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;   &lt;span class="c1"&gt;# note it down: one more page
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deployment is equally natural: one program, one container, a 128MB memory ceiling.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;strong&gt;container&lt;/strong&gt; is best thought of as a disposable little server: the program and everything it needs, packed together, ready to start or destroy at any moment. The &lt;strong&gt;memory ceiling&lt;/strong&gt; is the line drawn around it — cross it and the system shuts it down.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nothing here is &lt;em&gt;wrong&lt;/em&gt;. It runs, returns task IDs, reports progress. What it does is quietly assume that &lt;strong&gt;every task behaves&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the real world it does not. Among thirty websites one page is always enormous, and AI-generated code eventually writes an infinite loop. The next two sections are what happens when that assumption breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall one: one task goes down, everybody goes with it
&lt;/h2&gt;

&lt;p&gt;The code has a switch that simulates hitting a giant page — every fetched page appends 20MB to memory. On the seventh page memory crosses the 128MB line and the system shuts the whole program down.&lt;/p&gt;

&lt;p&gt;In Kubernetes (a system for running containers, K8s from here on) you can watch it happen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pod &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;agent &lt;span class="nt"&gt;-w&lt;/span&gt;
&lt;span class="c"&gt;# NAME                 READY   STATUS      RESTARTS&lt;/span&gt;
&lt;span class="c"&gt;# agent-monolith-xxx   1/1     Running     0&lt;/span&gt;
&lt;span class="c"&gt;# agent-monolith-xxx   0/1     OOMKilled   0      ← over the memory line, killed&lt;/span&gt;
&lt;span class="c"&gt;# agent-monolith-xxx   1/1     Running     1      ← restarted seconds later, looks fine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;OOMKilled&lt;/code&gt; means "used too much memory, terminated". Watching it restart on its own, the natural reaction is relief: the system healed itself.&lt;/p&gt;

&lt;p&gt;Then you ask about a &lt;strong&gt;different&lt;/strong&gt; task that was running at the same time — the well-behaved one, quietly fetching small pages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl localhost:8000/status/&amp;lt;some-other-task-id&amp;gt;
&lt;span class="c"&gt;# {"detail":"Task not found. Data lost due to Pod crash!"}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is gone too. An hour and forty minutes of progress, back to zero.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What got killed was not "the task that misbehaved" — it was the program holding all of the tasks.&lt;/strong&gt; An analogy: ten people share a flat with one kitchen, one of them burns a pan and sets off the sprinklers. The sprinklers soak the whole flat. Everybody's dinner is ruined.&lt;/p&gt;

&lt;p&gt;There is a worse detail. Because progress only existed in memory, after the restart you cannot even find out which page it had reached. K8s restarts protect &lt;strong&gt;whether the service can be reached&lt;/strong&gt;, not &lt;strong&gt;how far the work got&lt;/strong&gt;. It reopens the door; it does not give back your two hours.&lt;/p&gt;

&lt;p&gt;I call it the monolith illusion: &lt;code&gt;RESTARTS: 1&lt;/code&gt; looks like a harmless number, and it costs every task that was running at the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall two: an agent executes code the AI just wrote
&lt;/h2&gt;

&lt;p&gt;This is where agents differ most from ordinary backend services. An ordinary service runs code you wrote, reviewed and tested. An agent runs code a model produced seconds ago.&lt;/p&gt;

&lt;p&gt;And whatever that program can reach is fully visible from inside the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /var/run/secrets/kubernetes.io/serviceaccount/token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That command reads the &lt;strong&gt;access credential&lt;/strong&gt; the platform mounted for the program — effectively a key. One program means one shared set of files, one shared set of environment variables, one shared key. So code generated for task A can read the data task B collected, and the key sitting next to it.&lt;/p&gt;

&lt;p&gt;No amount of care while coding fixes this. &lt;strong&gt;Inside one process there is no boundary&lt;/strong&gt; — the operating system simply does not offer "parts of the same process, protected from each other".&lt;/p&gt;

&lt;h2&gt;
  
  
  What this step settles
&lt;/h2&gt;

&lt;p&gt;The naive version is worth running by hand, because it disproves two very natural ideas at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"just give it more memory"&lt;/strong&gt; — a 1GB ceiling only postpones the crash by a few dozen pages; the collateral damage is identical;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"just catch the error"&lt;/strong&gt; — the kill comes from the operating system kernel, and the program never gets a chance to say a word.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which leaves one road: &lt;strong&gt;give every task a container of its own&lt;/strong&gt;. Sounds obvious enough.&lt;/p&gt;

&lt;p&gt;The bill arrives in the next post: creating a container on demand leaves the user waiting 45 to 90 seconds.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In one line: &lt;strong&gt;inside one process there is no boundary&lt;/strong&gt;. Isolation is not a performance optimisation, it is the precondition for offering this kind of service at all.&lt;/p&gt;

&lt;p&gt;Code: &lt;a href="https://github.com/dreamyman/agent-sandbox-oss/tree/main/lab1" rel="noopener noreferrer"&gt;agent-sandbox-oss/lab1&lt;/a&gt; — a local cluster and one command is all it takes.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.pierceliu.top/en/blog/agent-sandbox-monolith-illusion" rel="noopener noreferrer"&gt;pierceliu.top&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>aiagents</category>
      <category>cloudnative</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
