We humans generally have the urge to classify things and rightfully so - it makes our lives easier. Ever since I've been reading about, and trying to build AI agents, I've always struggled with how to put the different practices and ‘agents’ in buckets. Initially, the axes that actually tend to work quite well for me is the framework axis. So you have low-level frameworks like LangGraph and you have high-level frameworks like CrewAI. There is this pattern axis that is just getting clearer to me more recently.
In my last newsletter, I wrote about the popular Anthropic essay: “Building Effective Agents”. In my mini commentary in the newsletter, I contrasted it with the philosophy up at Langchain, I wrote:
“One last comment I will make pertains to Anthropic’s framework for thinking about agents, and how it's different from that of LangChain’s (LangGraph). For example, Anthropic places great emphasis on the autonomous capabilities of AI agents, while LangChain is more focused on the decision-making process within predefined application structures. Some of Anthropic’s workflows turn out to be LangChain’s ‘agents’.”
I wasn’t sure of how sound that take was, but it certainly felt reasonable to me that there seems to be, at the very least a misalignment in philosophy (or, say, definitions), which is not surprising as everyone is figuring out how to build (and think) of this stuff in ‘realtime’. And indeed it seems one definition of agents are systems that have control flow defined by an LLM, where agents can range from just being a router to being fully autonomous - that will be more aligned to the LangChain school of thought contra Anthropics’.
The Anthropic essay also has some level of negative sentiments (I think) with regards *frameworks, so it’s quite deserving that LangChain released a tutorial which kicks off by presenting a case for frameworks a la LangGraph. While you can technically build language model workflows and agents from scratch, LangChain and LangGraph offer valuable benefits like persistence for memory and human-in-the-loop systems, more control over streaming outputs, and easier deployment. LangGraph acts as supporting infrastructure, simplifying the process of building and deploying complex language model applications - and I believe here is an important detail - without abstracting away the core components like prompts or architecture. (I tried a very high level AI agent framework many months ago, and I couldn’t make myself use it the second time given the high level of abstraction and the sheer amount of errors, that left me quite dizzy.)
More importantly, is the code implementation of the five agentic patterns of Workflows and Agents fleshed out in the video tutorial (notes and code available here)
In brief: 1) Prompt Chaining (breaking tasks into sequential subtasks), 2) Routing (classifying an input and sending it to a specialized follow-up), 3) Parallelization (handling multiple task components at once, sometimes aggregating diverse outputs) 4) Orchestrator-Workers (a central LLM that dynamically breaks down tasks and assigns them to specialized “workers”), 5) Evaluator-Optimizer (one LLM generating a response while another iteratively refines it based on feedback). Finally we have Agents, which can operate independently for extended periods, relying on feedback from the environment at each step, and potentially pausing to gather human input.
(Sketches adapted from LangChain & Anthropic)
Workflows now turn out to be scaffolding of predefined code paths around LLM calls + LLM directing control flows through predefined paths.
And for agents: let ‘em loose.
Blog Notes
[I]: A reader, Chen Hsieh pointed out this document on AI agents from Hugging Face (smolagents), it follows a different classification methodology from the one I have highlighted above. As opposed to the 'agentic pattern' axis, this is 'agency level' axis.
[II]: Another reader suggested motivating examples of the agentic patterns discussed, I decided to make a figure abstract.
This is interesting, Olatomiwa. Thanks for sharing.
From the diagram, I see there's a difference between agents and other workflows. However, could you possibly explain the applications of these with use-cases so that enthusiasts can understand better?