Agent Frameworks: The Architecture Made Concrete
The previous four lessons defined the components of an agent in the abstract: the LLM core, planner, tool layer, memory system, and orchestration loop. Building all of these from scratch for every agent is prohibitively expensive. Agent frameworks are software libraries that implement these components as reusable, composable abstractions — so that engineers can focus on defining agent behavior, tools, and goals rather than re-implementing loop mechanics and context management. Knowing which frameworks exist, what they emphasize, and where they differ is essential for anyone who will build or evaluate real agent systems.
The Major Frameworks
LangChain, released in late 2022, was the first widely adopted agent framework. It introduced the concept of chains (sequences of LLM calls and operations) and agents (chains with a tool-selection loop). LangChain's key abstraction is the AgentExecutor, which implements the orchestration loop, and its tool and memory abstractions are widely copied. The library is broad — it supports dozens of LLM providers, hundreds of tool integrations, and multiple agent reasoning strategies — but this breadth has made it complex and difficult to debug for newcomers. LlamaIndex focuses primarily on data ingestion, indexing, and retrieval pipelines — making it the dominant choice for RAG-heavy agents that need to work with private document collections. Its QueryEngine and ReActAgent abstractions make it straightforward to build agents that query structured and unstructured data sources. Autogen, from Microsoft Research, focuses on multi-agent conversations — systems where multiple specialized agents exchange messages to collaboratively solve a task. Its ConversableAgent abstraction allows any participant in the conversation to be an LLM, a human, or a code executor. AutoGen is particularly well-suited for tasks that benefit from debate or verification between agents. CrewAI is a higher-level framework built on top of LangChain that makes multi-agent collaboration intuitive by framing agents as team members with roles, goals, and backstory. An engineer defines a crew (a team of agents), each agent's role and tools, and the tasks to assign — CrewAI handles orchestration. The Anthropic Agents SDK (part of the Claude integration ecosystem) provides a typed Python SDK for building agents on top of Claude models. It supports tool use, multi-turn conversations, and structured output out of the box with native integration of Claude's tool-use API format.
Every framework above implements the same underlying architecture: orchestration loop, tool layer, memory. They differ in API style, abstraction level, default reasoning strategy, and community ecosystem — not in fundamental architecture. If you understand the architecture deeply, you can learn any framework in a day. If you only know a specific framework, you are lost when the architecture changes or you switch tools.
Match each framework to its defining emphasis or primary use-case.
Terms
Definitions
Drag terms onto their definitions, or click a term then click a definition to match.
Inside a Framework's Agent Loop
To make the architecture concrete, consider how LangChain's AgentExecutor implements the orchestration loop. On each iteration, it calls the LLM with the current agent scratchpad (a text record of all previous thoughts, actions, and observations). The LLM produces either an AgentAction (a tool name and input) or an AgentFinish (a final answer). If an AgentAction is returned, the executor looks up the tool in its tool registry, calls it with the provided input, and appends the Observation to the scratchpad. If the observation matches a defined stopping condition or the max_iterations limit is reached, the loop terminates. The AgentExecutor also handles callbacks at each step — for logging, tracing, and human approval — making the loop's behavior observable and auditable. This is not LangChain-specific magic. It is the canonical five-step loop from Lesson 6, expressed in LangChain's class and method names. Every other framework's agent loop is isomorphic to this structure.
Framework selection in practice is driven by four factors. First, model compatibility: some frameworks are tightly coupled to specific LLM providers; others are provider-agnostic. Second, tool ecosystem: frameworks vary enormously in how many pre-built tool integrations they provide (LangChain has hundreds; the Anthropic SDK requires you to write your own). Third, debugging and observability: complex multi-step agents fail in subtle ways; frameworks with rich tracing (LangSmith for LangChain, Phoenix for LlamaIndex) are significantly easier to debug than those without. Fourth, abstraction level: high-level frameworks like CrewAI get you running quickly but can obscure what the agent is actually doing, making edge cases hard to handle.
Agent frameworks are among the fastest-moving libraries in the AI ecosystem. LangChain, for example, underwent a major breaking rewrite between versions 0.1 and 0.2, changing core abstractions. Always check the framework's changelog and target a pinned version in production. Tutorials written six months ago may describe a substantially different API.
A team is building an agent that must answer questions by querying a 50,000-document internal knowledge base. Which framework emphasis is most aligned with this use-case?
A developer switches their agent from LangChain to CrewAI. They find that the agent's tool selection behavior changes in subtle ways they cannot explain. This is most likely because:
Framework Comparison Matrix
- Using what you have learned in this lesson and any additional research, create a comparison matrix for three of the five frameworks discussed.
- Step 1: Choose three frameworks from: LangChain, LlamaIndex, AutoGen, CrewAI, Anthropic Agents SDK.
- Step 2: For each framework, fill in four cells: primary use-case, model compatibility (specific LLMs or provider-agnostic), built-in observability/tracing tools, and one significant limitation.
- Step 3: Given the following scenario — 'You need to build an agent that monitors a shared Slack channel, summarizes daily discussions, and posts the summary to Notion each evening' — which framework would you choose and why?
- Goal: develop the habit of framework selection based on requirements analysis, not familiarity or hype.