← Back to list

AI Agent Anti-Patterns: Six Hard-Won Lessons from Production

What we learned building agent systems that actually work

Allen Chan · 2026-06-01 13:22 · 0 claps · 6.7 min read
#ai-agent #agentic-ai-architecture #design-patterns
Open on Medium ↗
Wiki topics: AGT · AI Agents 🏛️ · Architecture

AI Agent Anti-Patterns: Six Hard-Won Lessons from Production

What we learned building agent systems that actually work

📚 Series Navigation: Part 1: Agent Design Anti-Patterns | Part 2: Tooling & Scale Anti-Patterns | Part 3: Knowledge and Document Processing Anti-Patterns | Part 4: MCP Tools & Integration Anti-Patterns | Part 5: The Illusion of Control | Six Hard-Won Lessons from Production

After documenting 23 anti-patterns across foundational design, scale traps, and knowledge management, a clear pattern emerged: most agent failures aren’t random. They follow predictable paths. More importantly, they share common root causes that, once understood, point to better approaches.

This article distills those patterns into six core lessons — three about building agents right, and three about running them right. Each lesson represents a shift from what seems intuitive to what actually works in production.

Part 1: Build It Right

Lesson 1: Don’t Mistake Prompting for Control

The trap: Teams often expect deterministic behavior from agents while designing prompts at the wrong extreme. Some overload a narrowly scoped agent with pages of instructions, constraints, and exceptions in an attempt to force reliable behavior. Others keep the prompt loose and underspecified, yet still expect the agent to behave in a tightly bounded way. Both approaches fail for the same reason: the model is still approximating instructions, not executing them.

This shows up most clearly in the Monolithic Mega-Prompt anti-pattern — not because teams are always trying to build all-purpose super-agents, but because they are trying to make an agent behave predictably by piling on more and more instructions. As Part 1 notes, Liu et al. showed a “Lost in the Middle” effect: retrieval accuracy dropped to ~55% for information in the middle of long context, compared to ~80% near the beginning. A 500-line instruction set places most steps in this degraded zone. At the same time, a vague prompt with broad autonomy does not magically produce disciplined behavior either.

What works better: Right-size the agent and right-size the prompt. Keep the agent focused on a clear job, give it a concise instruction set, and constrain its action space through system design — not just wording. If the system needs multiple capabilities, split them across specialized agents or workflows with explicit coordination. If the behavior must stay within hard boundaries, enforce those boundaries in code, tools, and workflow logic.

The caveat: Over-specialization creates the opposite problem — super fine-grained agents that require multiple handoffs just to perform one task. As a rule of thumb, limit agent hierarchies to no more than 2 levels, and scope agents by use case domain rather than individual operations. The goal is focused capability, not fragmentation.

The insight: The problem is not simply “super-agents.” It is the belief that prompt tuning alone can create deterministic behavior. Too many instructions and too few instructions can both fail. Reliable systems come from calibrated agent scope plus architectural controls.

Lesson 2: Stop Asking Prompts to Do the Job of Systems

The trap: As soon as approvals, branching, retries, validations, or compliance rules are embedded in prompt text, the system becomes brittle because the model is approximating those rules instead of executing them.

This is the Agent-as-Business-Process Fallacy — replacing structured business processes with agent reasoning. Even frontier models achieve only 70–80% accuracy when prompts contain multiple simultaneous constraints. Business processes require 100% compliance, not 70%.

What works better: Put deterministic logic where it belongs: in workflows, code, and tool contracts. Use agents for judgment, ambiguity, and open-ended reasoning. Use workflows for order, control, approvals, rollback, and enforcement.

Curate tool access aggressively. The Tool Soup anti-pattern shows that tool selection degrades as catalogs grow, while large tool definitions also consume substantial context and increase cost. The agent should see only the tools it actually needs, not a giant action catalog that increases confusion and mistakes.

The insight: If a step must happen, don’t describe it in a prompt — enforce it in the system.

Lesson 3: RAG Does Not Clean Up Bad Knowledge

The trap: If the underlying knowledge is messy, outdated, duplicated, poorly chunked, or not structured for agent consumption, the agent just retrieves that mess faster and with more confidence.

This appears in multiple anti-patterns: Assumed Trust in the Knowledge Source, “RAG Will Fix Disorganized Knowledge”, and One-Size-Fits-All Chunking. RAG retrieves semantically similar text, not verified truth. Similar ≠ correct. Enterprise content is rarely clean — outdated policies, conflicting versions, stale information all get retrieved with equal confidence.

What works better: Curate knowledge before expecting agents to use it well. Add structure, metadata, ownership, versioning, and clear content boundaries. Use the right mechanism for the job:

  • Semantic retrieval for contextual lookup
  • Databases and APIs for structured facts and counting
  • Targeted extraction for documents

The goal is not to give the agent more information — it is to give the agent the right information in a usable form.

The insight: RAG does not fix knowledge problems — it amplifies them.

Part 2: Run It Right

Lesson 4: Demo Success Proves Almost Nothing

The trap: A system that looks great in a curated demo can still fail badly when users are vague, contradictory, adversarial, or when tools misbehave. Testing only “good” cases is one of the main reasons agent systems collapse in production.

This is Happy Path Engineering combined with Demo-Grade Agent in Production. Research shows that without recovery training, agents achieve success rates below 50% — sometimes below 30% — when tools fail. Personal testing covers <10% of the input space; 90% of production issues come from untested scenarios.

What works better: Evaluate the system under the conditions that actually matter:

  • Ambiguity and conflicting instructions
  • Tool failures and recovery
  • Multi-turn corrections
  • Non-cooperative inputs
  • Adversarial testing and red-teaming

Measure whether the system can recover, stay bounded, and remain useful when things go wrong — not just whether it looks polished when everything goes right.

The insight: If it only works in the demo, it doesn’t work.

Lesson 5: Latency Is an Architecture Problem, Not Just a Model Problem

The trap: Long prompts, too many planning loops, too many handoffs, oversized tool payloads, and excessive retrieval all add delay before the user gets value. Worse, all that extra context often hurts quality as well as speed.

This manifests as Responsiveness Afterthought and Tool Data Overload. Research shows 53% of mobile users abandon sites that take more than 3 seconds to load. Each model call adds 200–2000ms latency; nested planning loops push latency beyond acceptable SLAs. Tools returning megabytes of data when only kilobytes are needed create the “Firehose Effect” — context window exhaustion and prefill latency.

What works better: Treat responsiveness as a design constraint from day one:

  • Keep prompts lean
  • Reduce unnecessary model calls
  • Avoid nested planning when a direct path will do
  • Filter tool outputs at the source
  • Parallelize only where it genuinely helps

Don’t make the model read a novel just to answer a question.

The insight: If the agent is slow, chances are the design is bloated.

Lesson 6: Don’t Use More Context to Compensate for Bad Design

The trap: Oversized system prompts, huge tool definitions, verbose tool outputs, and large knowledge passages stuffed into context “just in case” all drive cost up fast. This gets even worse when knowledge sources are not curated for agents, because the system starts returning maximum context in the hope that somewhere inside it is the answer.

This is Unbounded Execution Cost combined with poor knowledge curation. As Part 2 shows, costs accumulate through oversized models, repeated retrieval, re-planning loops, and oversized tool catalogs whose schemas are sent repeatedly across turns. As Part 3 adds, over-retrieved knowledge passages compound token costs because they are carried forward turn after turn.

What works better: Design for precision, not volume:

  • Curate knowledge so retrieval can return smaller, more targeted passages
  • Filter data before it reaches the model
  • Use the smallest useful context
  • Use the smallest useful toolset
  • Use the smallest useful model for the task

More tokens do not mean more value; they often mean the system is compensating for weak structure upstream.

The insight: “Give the model everything” is not a strategy — it’s an expensive way to hide poor knowledge design.

The Pattern Behind the Patterns

These six lessons share a common thread: architecture wins at scale, not prompt engineering.

The instinct when an agent fails is to add more instructions, more context, more tools, or a smarter model. But the real solution is usually structural:

  • Agents reason; workflows execute — use the right tool for the job
  • State must be explicit — not inferred from context
  • Autonomy must be calibrated — not all-or-nothing
  • Tools should filter, not firehose — return only what’s needed
  • External components are dependencies — verify before trusting
  • Cost and latency are design constraints — not afterthoughts

Quick Executive Summary

  • Agents: Don’t mistake prompting for control. Overloaded prompts and underspecified prompts both fail when teams expect deterministic behavior.
  • Workflows & Tools: If a rule must hold, enforce it in the system — not in the prompt.
  • Knowledge: RAG does not clean up bad knowledge; it surfaces it faster.
  • Agent Quality (Eval): If it only works in the demo, it doesn’t work.
  • Performance (Latency): Slow agents are usually overdesigned agents.
  • Cost (Tokens): More context is often just a costly workaround for poor design.

What’s Next

These lessons emerged from analyzing production failures across foundational design, scale traps, and knowledge management. The full anti-pattern series provides detailed evidence, failure modes, and architectural alternatives for each pattern.

The goal isn’t to avoid agents — it’s to build them in ways that actually work when users are unpredictable, tools fail, and scale matters.

Because in production, architecture beats cleverness every time.

To learn more …

Read this article for free using my friend’s link. You can also read all the stories in my GenAI and AI Agent series. Follow us to be first notified about our next article.

📚 Series Navigation: Part 1: Agent Design Anti-Patterns | Part 2: Tooling & Scale Anti-Patterns | Part 3: Knowledge and Document Processing Anti-Patterns | Part 4: MCP Tools & Integration Anti-Patterns | Part 5: The Illusion of Control | Six Hard-Won Lessons from Production


메타데이터
post_id
e9de592fd7d6
slug
ai-agent-anti-patterns-six-hard-won-lessons-e9de592fd7d6
url
https://medium.com/@achan2013/ai-agent-anti-patterns-six-hard-won-lessons-e9de592fd7d6
canonical_url
https://medium.com/@achan2013/ai-agent-anti-patterns-six-hard-won-lessons-e9de592fd7d6
author_url
https://medium.com/@achan2013
status
ok
fetched_at
2026-07-14 04:48:47