跪拜 Guibai
← All articles
AIGC · Agent

Six Ways a Production Agent Dies: A 200K-User Project's Four Hard-Won Refactors

By vaskilab ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Agent latency and hallucination budgets are decided by architecture, not by prompt wording. The hard-won numbers here show that a production agent serving a Western-scale user base can hit 90% hallucination reduction and sub-10s P95 only after you stop trusting the model with decisions that can be made deterministically.

Summary

A business-facing agent serving 200,000+ users and 500,000+ daily conversations went through four complete rewrites in under two years. Each version died from a specific mistake: V1 leaned on intent recognition, which forced retraining for every business scenario and broke multi-turn. V2 dumped all tools and context into a ReAct loop, ballooning tokens from 3,200 to 12,000 and making the shared prompt so risky that nobody dared edit it. V3 added an orchestration layer to narrow the tool list, but simply moved the failure point and created a new corpus-maintenance bottleneck.

The fourth version stopped trying to make the model smarter and instead put constraints in the right layers. It split tool descriptions by purpose, made prompt configuration hot-updatable, narrowed the candidate pool before reasoning, and replaced raw JSON memory with semantic summaries. The result: roughly 90% of hallucinations gone, P95 latency under 10 seconds. The author also identifies six distinct hallucination types, explains why early exit and deterministic-chain stripping are the biggest wins, and lays out an evaluation methodology where rules judge before models and diagnosis data never overlaps acceptance data. The post is candid about what's unsolved: RAG recall errors, leftover hallucinations, 80% human evaluation, and an unimplemented self-evolution loop.

Takeaways
— V1 used intent recognition and had to retrain the algorithm for every new business scenario, making delivery cycles measure in weeks.
— V2 fed all tools and context into the core agent, causing token usage to jump from 3,200 to 12,000 per request and making the shared prompt untouchable because any change required re-review across all businesses.
— V3 moved tool selection to an orchestration layer, but just relocated the problem: the core agent would confidently use a wrong tool while appearing professional.
— V4 eliminated about 90% of hallucinations and cut P95 latency from over 15 seconds to under 10 seconds.
— There are six distinct hallucination types: skipping tools, fabricating parameters, false success, cross-turn contamination, cross-object contamination, and routing hallucination.
— Storing tool-returned JSON verbatim in memory causes the model to mistake any number for an order ID; storing semantic summaries instead prevents that, saves tokens, and helps coreference resolution.
— Early exit for terminal tool results saves one full model reasoning turn, which is the main source of the latency and hallucination reduction.
— Evaluation must use two physically separate data sets: one for diagnosis, one for final acceptance, or the model overfits and looks accurate without learning anything.
— Human review still makes up 80% of the current evaluation workload.
— Self-evolution is hardest not in finding problems but in changing safely; the loop must have brakes and rollback at every step before it can ship.
Conclusions

The root cause across all four versions was mixing the decision of "which tool" with the execution of "how to use it"; separating those makes the candidate pool the real control point.

A classification model gives observability, not capability — it can tell you the category but not the specific entity, which is why it failed for a customer-service agent that must resolve references.

The most dangerous failure mode is false success: when a tool call errors but the model reports success, it amplifies trust, and that's the one that will burn a business relationship fastest.

Treating the prompt as a shared code file creates organizational paralysis; the author's shift to treating it as configurable, versioned, and hot-deployable operational asset is what unlocks continuous improvement.

Self-evolution will fail if the loop optimizes against the same data it uses for diagnosis; the structural fix of separating data sets is more valuable than any model improvement.

Concepts & terms
ReAct
A reasoning-and-acting loop where an agent alternates between thinking about the next step and calling a tool, then incorporates the tool's output into the next thought, until it reaches a final answer.
P95 latency
The 95th percentile response time, meaning 95% of requests complete at or below that duration; it's a tighter latency bound than an average and catches tail-end slowness.
Early exit
Ending the agent's reasoning loop as soon as a tool returns a terminal result, without sending that result back into the model for another reasoning turn; saves a token and removes a hallucination opportunity.
Candidate pool
The set of tools made available to the model at reasoning time. A smaller, pre-narrowed pool reduces the model's tendency to guess at a plausible-looking tool, which is a common source of hallucinations.
Semantic summary memory
Storing retrieved data not as raw structured JSON but as a condensed text summary that retains the meaning and relationships, preventing the model from misreading raw numbers as entity IDs and reducing coreference errors.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗