Large Language Models (LLMs) have taken the world by storm. But if you have ever tried to build a real application with just a raw LLM API call, or if you remember what 2022 ChatGPT was like, you know the truth. They are powerful, but they are also chaotic. They hallucinate, they get distracted, and they struggle with multi-step logic.
Recently, I’ve been diving into Agentic Design Patterns, and it’s changed how I view AI development. The LLMs are just the engines, not the entire machine, when we look at Agentic systems. I will be sharing some of the design patterns in Agentic Design Patterns that augment these LLMs and turn them into something truly intelligent.
Structure And Control
Prompt Chaining: The "pipeline" pattern which introduces sequential logic. In typical software design, we never write one massive function containing the logic for everything. It is too long, messy and difficult to debug. Yet, we often try to force LLMs to "read this file, extract the data, summarize it, and format it as JSON" all in one prompt. This rarely works reliably.
Prompt Chaining is the solution. It breaks a complex task into a sequence of smaller, manageable sub-problems handled by one prompt each. The output of one step becomes the input for the next. It’s essentially a Unix pipe (|) for AI. By isolating each step—like having one prompt just for extraction and another just for formatting—we reduce cognitive load on the model and make the system much easier to debug.
Routing: An additional "conditional logic". Sequential chains are great, but what if the input varies? A customer support bot doesn't need to run a "refund logic" chain for a user who just wants to reset their password.
Routing introduces conditional logic, analyzing the input intent first—often using an LLM or vector embedding—and then directs the flow to the correct specialized tool or sub-agent. This moves us from a rigid, linear script to a dynamic system that adapts to the user.
Quality And Efficiency
Reflection: This is perhaps one of the most human patterns in Agentic Design, where we include a specific "reflect" step in the agent pipeline. An LLM's initial output can be buggy or hallucinated, but LLMs are also capable of identifying such mistakes when given the chance.
Reflection introduces a feedback loop where the agent critiques its own work.
A common implementation is the "Generator-Critic" model. One agent generates code, and a second agent (the Critic) reviews it for errors or security flaws. The generator then refines the output based on that feedback. It increases latency, but the jump in quality and reliability is massive.
Parallelization: An asynchronous pattern where we execute multiple LLM calls at the same time where possible. This effectively reduces the latency of a complex job to the time it takes to complete the longest single sub-task. One big task could be broken down into several independent sub-tasks to be run in parallel, and that is where this pattern shines.
Agency
Tool Use: An LLM without tools is just a brain in a jar. It knows a lot, but it can’t do anything. The Tool Use pattern (or Function Calling) is how we bridge the gap between the model and the external world—APIs, databases, and the web.
The model doesn't execute code itself. Instead, it generates a structured request (like a JSON object) specifying which tool to call and what parameters to use. Our agentic system executes the tool and feeds the result back to the model. This is the critical leap from "chatbot" to "agent."
Planning: While we talked about chaining prompts in a logical, sequential manner, we realize that we need not implement this ourselves either. The LLM can be leveraged to understand a complex problem, and as a dedicated planning agent, decide on the sequential steps that are needed to get from an initial state to the desired goal state.
Conclusion
The patterns we explored so far are building blocks of agentic AI systems. We see these patterns whenever we use AI applications like ChatGPT or Gemini, and they deploy these patterns to deliver an answer as fast and accurate as possible.
Developers of AI applications are not just writing sequential logic now. LLMs give us the ability to orchestrate cognition itself, which is really cool.
Comments
Post a Comment