←News detail

Tencent Cloud Developer CommunityUpdated Oct 27 16:14

A Panoramic View of 8 AI Application Design Patterns: What Really Holds You Back Is Never the Model

AI summary

Based on the team's implementation practice, the author categorizes the 8 AI application design patterns by function into three types: capability enhancement, reasoning and workflow, and organizational collaboration, and divides them into three tiers by usage frequency and implementation maturity. The first tier consists of Tool-Augmented, RAG Agent, and Memory-Augmented; the author believes that doing these three solidly is enough to beat 80% of competitors. Multi-Agent and Autonomous Loop belong to the high-end game, and their implementation is a disaster area of pitfalls. The article also proposes using a replaceability test to determine whether the layered contract holds, and emphasizes that the simpler the architecture, the better, and that Workflow should be emphasized over full autonomy.

Why read this

AI score 58

The article divides eight AI application design patterns into three tiers by implementation maturity and provides a replaceability criterion, helping teams decide what to build first.

Topics

Tags

Body · AI translation

Opening: a scene I've seen far too many times

A certain team wanted to build "intelligent report generation."

For the first version, they used the strongest model available at the time, wrote over two thousand words of prompt, and the demo was stunning—the whole room applauded. For the second version, they needed to connect to the enterprise knowledge base, so they added retrieval, and the results started to drift—sometimes accurate, sometimes confidently making things up. For the third version, they needed to connect to business systems to fetch data automatically, and the Agent started calling APIs erratically, occasionally even writing back fields that should never have been written back. For the fourth version, they added a "review Agent" to gatekeep quality, but the two Agents ended up passing the buck to each other, a single round of tasks took over forty minutes, and the Token bill sextupled.

Three months later, in the retrospective, the conclusion was: the model capability isn't good enough yet—let's wait for the next generation of models.

My judgment is exactly the opposite: this isn't a model problem, it's a pattern problem.

Across four iterations, the team never once did a real "selection": should the Agent plan autonomously? Should sub-Agents be split out? Is a reflection step worth adding? Every step was added on a whim, and each added step brought more uncertainty and more cost.

The model is the engine; the design pattern is the drivetrain. No matter how powerful the engine, if the gears mesh wrong, the car still won't go fast. If you don't pick the right pattern, swapping in a hundred models won't save you. 1. First, something that may offend people: the official documentation is the best teacher

Before getting to the main topic, let me be clear so you don't read on with the wrong expectations.

This article does not paste large blocks of code, does not explain parameters one by one, and does not hold your hand through getting some framework running. This isn't laziness—there are three very practical reasons: Details expire; patterns don't. Framework version numbers change every three months, APIs change every six months, and the invocation style you memorize today becomes a liability next year. But the answer to "when should an Agent plan autonomously, and when shouldn't it" will still hold five years from now. Video tutorials are pre-chewed by someone else. What you learn is his understanding, his version, his scenario. What's worse, the pitfalls you'll actually hit often don't appear in his video, because his demo was recorded along the one path that happened to work. Official documentation tells you the boundaries it admits to itself. First-hand definitions, interface contracts, and "under what circumstances this capability should not be used." The third thing is the most valuable, and no video will spend ten minutes telling you "don't use me." ### One-sentence methodology Don't binge-watch video tutorials one after another; go read the official documentation carefully. This is the fastest way to truly master a technology, bar none. Because it is the only material that won't omit boundaries for you just to "flow smoothly." 2. First, let's lay the foundation clear

Before discussing design patterns, there has to be a place to put them. In my previous article, "The Four-Layer Architecture of AI Implementation: What Really Holds You Back Is Never the Model," I mentioned: Based on reflections from the team's internal implementation practice, we divide internal AI into four layers: the hardware foundation layer, the AI Infra layer, the Harness service layer, and the application layer. What determines success or failure is not the layering, but the three contracts between layers—the upper layer raises requirements, the lower layer supplies capabilities, and any layer can be replaced wholesale without changing the upper layer's code. The deepest lesson from practice is about order: first converge model access into a gateway, then choose the Harness to establish permissions, sandboxing, and checkpoints, and only then talk about Skills and expert accumulation. If the order is wrong, the rework cost is far higher than building from scratch. 2.1 What it's really saying

Many people read this kind of article with their eyes fixed only on the four boxes, then go back and draw an identical diagram, paste it into a PPT, and call it done. But the value of that piece isn't in the layering—it's in the second half of the sentence.

Layering is a noun; anyone can draw it. A casual search will turn up twenty ways to layer things—four layers, five layers, seven layers—and they all look quite plausible when drawn. What really determines whether this architecture can survive is those three contracts between layers. It's a verb; it determines whether you can swap things out in the future. 2.2 The three contracts and what each governs

| Contract | What it governs | What happens if it's broken | | ---------------------------- | -------------------------------------------------------- | ------------------------------------------------ | | The upper layer raises requirements, not implementations | Interfaces are defined by "what I want," not by "who provides it and how" | The moment a lower-layer product name appears in upper-layer code, the contract is already broken | | The lower layer supplies capabilities, and capabilities are measurable | Clearly state latency, success rate, cost ceiling, and how to degrade on failure | An "capability" you can't articulate is essentially just a demo | | Replacement doesn't penetrate | The result of the first two, and the only acceptance criterion | Changing one layer means changing a swath of code; the architecture degenerates into dependencies |

There is only one criterion for judging whether a contract is good, and it's especially brutal: The replaceability test: if you replace an entire layer (swap the model, swap the framework, swap the vector store, swap the hardware), does the upper-layer business code need to change? If it needs to change → that contract is fake. What you drew isn't layering, it's dependency. 2.3 The most expensive lesson: order costs more than choice

The line in the original that I agree with most is "get the order wrong, and the cost of rework is far higher than building from scratch." Why?

Because if you make the wrong choice, all you lose is that one layer; if you get the order wrong, all your prior work is built on false assumptions. Build a pile of Skills first, then go back and add the Harness: you'll find that every Skill has its own scattered permission checks, its own sandbox logic, its own error handling—all of which must be rewritten. Build the Harness first and then consolidate the gateway: you'll find that the permission system was designed around one model's calling conventions, and switching models means starting over.

The correct order is a one-way road; you can't skip steps:

The closer something is to the business, the later you do it, because it's the most easily overturned by changes at the lower layers. III. The application layer to focus on: 8 AI application design patterns

The four-layer architecture answers "how to build the house"; design patterns answer "how to arrange things inside the rooms." At the L4 layer, the decision you actually have to make every day is: for this task, which pattern should I use?

First, let me address an intuitive question: why call them "design patterns"?

Because they're the same kind of thing as the 23 GoF design patterns: not code, but reusable "problem → solution" pairings, plus the cost of that solution. The value of the singleton pattern isn't in those three lines of code; it's in explicitly telling you the intent of "a single global access point" and the cost of "hidden dependencies, hard to test." AI application design patterns are the same: the real value of each pattern lies in its honest labeling of how much it will charge you.

By functional dimension, these 8 patterns fall into three major categories (these are the application patterns I commonly use in my own thinking and practice): 3.1 The eight patterns in one sentence each

| # | Pattern | What problem it solves | What you pay | | --- | -------------------------------- | -------------------------------------------------- | -------------------------------- | | 1 | Tool-Augmented | Lets the model touch real systems: call APIs, query databases, write data back | Permission boundaries, parameter validation, privilege-escalation risk | | 2 | ReAct reasoning-action synergy | Problems that can't be answered in one shot are advanced through a "think—act—observe" loop | High token consumption, prone to infinite loops | | 3 | RAG Agent retrieval augmentation | Brings in private knowledge, suppresses hallucinations; autonomously decides when to retrieve and how to rewrite queries | When retrieval quality is poor, hallucinations are actually amplified | | 4 | Memory-Augmented | Remembers preferences and history across sessions for personalization | User isolation, expiration cleanup, storage costs | | 5 | Plan-and-Execute | Decomposition and step-by-step execution of complex long tasks | If the first-step plan is wrong, everything collapses; fault tolerance is hard | | 6 | Reflection | Self-correction after generation, raising the first-pass success rate | Slow, expensive, and the reflection itself can be wrong | | 7 | Multi-Agent collaboration | Division of specialized capabilities (coding / testing / review) | Extremely high coordination cost, message distortion, debugging nightmare | | 8 | Autonomous Loop | Give it a goal and it keeps going until done, with no human intervention | Risk of runaway budget; must cap iterations and spend | 3.2 Three categories of patterns, three ways of thinking Capability enhancement (1 / 3 / 4): solves the problem of what the model can't see, can't remember, can't reach. The common cost is that the external attachment itself must be governed. How to constrain permissions, how to isolate memory, how to update indexes—none of this work is any less than the model itself. Reasoning and workflow (2 / 5 / 6 / 8): solves the problem that one conversation can't finish the job. The common cost is time and money. They all trade extra reasoning rounds for better results, and rounds are the most expensive thing. Organizational collaboration (7): solves the problem that one person can't do it all. The common cost is coordination cost. Note that Multi-Agent isn't just a few more Agents; it's a whole extra set of coordination costs: message formats, responsibility boundaries, infinite-loop detection, failure attribution—you have to write all of it yourself. IV. Not all patterns should go to production: three tiers for implementation

This is the section I most want to emphasize.

The panorama above is a capability list, not a procurement list. Using all eight patterns is precisely the mistake beginners are most prone to. You think you're building a system, but you're actually building an uncontrollable cost black hole.

By real-world enterprise engineering usage frequency × implementation maturity, these eight patterns fall into tiers. Some are utilities like water, electricity, and gas; some are luxuries; some are still futures. 4.1 Three tiers at a glance

| Tier | Included patterns | Implementation status | One-line judgment | | ----------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | Tier 1 · Utilities | ① Tool-Augmented ③ RAG Agent ④ Memory-Augmented | No need to choose; you can't avoid them. An Agent that doesn't connect to external systems is just a chatbot; an Agent that doesn't connect to private data will sooner or later make things up | Get these three solid and stable, and you've already beaten 80% of competitors | | Tier 2 · Advanced tools | ② ReAct ⑤ Plan-and-Execute ⑥ Reflection | Used frequently in complex scenarios, but must be strictly controlled. ReAct is often wrapped by frameworks; plan-and-execute is mostly used for long tasks; reflection works well in code generation but is too slow in customer service | Stability and cost always trump flexibility | | Tier 3 · High-end game | ⑦ Multi-Agent ⑧ Autonomous Loop | Concepts are hot, but implementation is a disaster zone. Multi-Agent communication consumes enormous tokens and easily deadlocks; an autonomous loop without budget limits can burn tens of thousands of yuan in API fees in one night | You must be able to explain it clearly in interviews, but don't rush to deploy it in production | 4.2 Three unwritten rules in enterprise engineering practice The simpler the architecture, the better. If one prompt can solve it, never use ReAct; if a single Agent can solve it, never use Multi-Agent. This also aligns with the KISS principle of architecture design. Emphasize Workflow, de-emphasize full autonomy. Fix planning and tool calls in a flowchart (Agentic Workflow), trading determinism for stability and low latency—this is the real popular practice in enterprises today. Latency and cost are two blades. ReAct / Reflection / Loop all significantly lengthen response time; making consumer users wait 10 seconds is a disaster. 4.3 A counterintuitive but correct conclusion

If you're doing business implementation, getting Tier 1 solid and stable is already enough to beat 80% of competitors. The remaining five patterns are things you should consider only after Tier 1 is running smoothly and the business genuinely needs them.

This is another way of saying what I've always said: don't do AI for AI's sake. If it can be solved with deterministic engineering methods, don't hand it to probabilistic reasoning; if it can be solved with one pattern, don't stack three. Those plain principles from traditional software engineering—single responsibility, least astonishment, observability—not one of them has expired in the AI era; they're more valuable than ever. V. Patterns are not mutually exclusive; combination is the norm (but don't stack them)

The last frequently asked question: can you only choose one of these patterns?

No. They can be combined, and real systems are almost always combinations. In a mature Multi-Agent system, sub-Agents use ReAct to call tools, use RAG to query the enterprise knowledge base, use Memory to remember user habits, with an outer layer of Reflection for quality checks, and finally a Supervisor to close the loop.

But combination has one iron rule: every pattern you add must be able to answer what it saves me. If you can't answer that, it's just stacking. 5.1 Four questions to ask yourself when choosing

The only endpoint of this diagram is: keep it simple. All patterns are forced out by problems, not pushed out by trends. 5.2 Where the four-layer architecture and design patterns interlock

Looking at the two things together, the relationship is clear: L1 / L2 determine whether you can run cheaply. If the cost structure is wrong, no matter how elegant the pattern, it can't scale. L3 Harness determines whether you dare to run. The prerequisite for a pattern combination to go to production—without permissions, sandboxes, and checkpoints, Reflection and Loop are risk amplifiers. L4 determines whether running is worth it. The eight patterns are the arsenal for this layer; choose wrong and you end up like the team in the opening. The four-layer architecture tells you "whether it can be replaced"; design patterns tell you "whether you should do it this way." The former governs evolution, the latter governs the present. Summary The failure of the team in the opening wasn't a model problem; it was a pattern problem; To truly master a technology, don't binge videos—go study the official documentation. It's the slowest, and also the fastest; In the four-layer architecture, contracts are more expensive than layering, order is more expensive than choice, and replaceability is the only criterion; The eight design patterns are a capability list, not a procurement list. Roll them out by the three tiers, and make the utilities solid first; Combination is the norm, but every layer you add must clearly state what it saves me; if you can't answer, it's just stacking.

Back to the beginning. Models will get stronger and stronger—that's certain; but a strong model won't automatically answer the question "should the Agent plan autonomously?" for you. Don't treat the model as your moat; architecture is the moat.

Source

Tencent Cloud Developer Community