Agent Frameworks
20 min · 1,538 words
- Say what a framework does for you that you would otherwise write by hand
- Tell LangGraph, LangChain and deepagents apart by the level each one works at
- Pick between the Python and TypeScript options for a real project
- Explain the difference between an AI workflow and an AI agent
- Know when a no-code tool is the right answer
Everything up to here was about how agents work. This module is about what you actually install when you build one.
Here is the honest starting point: you do not need a framework. AI Agents showed the loop. It is a while loop around a model call. In the middle of the loop, your code runs whichever tool the model asked for. You can write that in an afternoon.
What you get from a framework is everything around the loop:
- Retries when a provider returns a 500 error.
- Streaming, so the user sees tokens as they arrive.
- A standard tool schema, so you do not write JSON by hand for every function.
- Memory that survives a restart.
- A place to put the traces.
That list is why most people stop writing their own loop after the second project.
The LangChain Stack
This is the one to learn first. It is the most complete and the most current. It is also the one most likely to run in production somewhere near you. But it confuses people, because "LangChain" is three separate libraries at three levels. Which one you want depends on the job.
Rendering FIG. 29.1
LangGraph is the runtime. It is the lowest level of the three. You describe your agent as a graph. The nodes are steps, the edges are what can happen next, and the state moves between them. The state is explicit, so the runtime can save it and resume from it. The runtime can also let a human interrupt the agent in the middle of a run. Use LangGraph when the control flow is the hard part and you want to control it yourself.
LangChain is the main interface, and it is where you should start. It sits on top of LangGraph. It gives you the ordinary agent in a few lines of code: a model, some tools and some middleware. The middleware is where the Harness Engineering work happens. It is also where the guardrails from Security live.
deepagents is the highest level. It is built on the other two. It calls itself a "batteries-included" agent harness. The batteries are exactly the list from Context Engineering:
- planning
- a filesystem
- subagents with their own context windows
- summarisation of long threads
If you want the deep agent architecture rather than a custom one, start here and skip the assembly.
So the practical rule is simple. Start with LangChain. Go down to LangGraph when you need to control the flow yourself. Go up to deepagents when you want the whole architecture already built for you.
The Other Python Options
None of these is wrong. They make different trade-offs. Usually the trade-off is how much they decide for you.
- Agno looks past the single agent to the whole platform. It helps you build, run and manage agents as a system rather than as a script.
- CrewAI organises everything around roles. You describe a crew of agents, each with a job, and let them work together. This fits well with the multi-agent shapes from Multi-Agent Systems.
- smolagents from Hugging Face is the small one, and it is small on purpose. It is a barebones library for agents that act by writing and running code, instead of by sending JSON tool calls. It is the CodeAct idea from Loop Engineering, packaged as a library. It is also the best one to read if you want to understand a loop rather than use one.
- Pydantic AI brings the thing Pydantic is good at: types. Every model and every interface is typed from end to end. So a malformed tool call becomes a validation error, not a mystery.
If Your Project is TypeScript
Two frameworks are worth knowing here. The reason is that the whole stack above is Python-first, and most product code is not written in Python.
- Mastra is the modern TypeScript framework for agents and AI applications. It is the closest thing to LangChain in that language.
- VoltAgent is an agent engineering platform built on top of an open-source TypeScript framework. So it focuses more on running, watching and managing your agents after you have built them.
AI Workflows
Here is a distinction that is important to get right. If you choose wrong, it costs you months.
An AI workflow runs a path that somebody wrote down. The steps are fixed. Code decides what happens next. The code calls the model at specific points to do specific jobs. An AI agent decides for itself. It picks the tools and the order, and the path is different on every run. The Prompt Engineering Guide's comparison describes this as hard-coded logic versus LLM-driven reasoning.
The mistake is to assume that the agent is the grown-up version. It is not. If the requirements are stable and you know the steps, a workflow is more predictable, cheaper and easier to debug. And when real users depend on a system in production, you usually want that system to be predictable. Keep the agent for open-ended work, where nobody can write down the steps in advance.
n8n is the tool that most people finally choose for the workflow half. With it, you:
- build on a visual canvas
- connect more than 400 integrations
- add your own code where you need it
- host it yourself, or use their cloud
Take a job like "when a form is submitted, classify it, look something up, write to the database, send a message". For that job, this tool is easily better than an agent.
And this connects back to Code Agents. n8n runs an MCP server. So your coding agent can connect to your n8n instance and build the workflow for you. You describe what you want in plain language, and the coding agent:
- assembles the nodes
- validates the result
- runs the workflow
- fixes what broke
Building workflows through MCP arrived in v2.13. So the agent and the workflow stop being alternatives. The agent becomes the thing that writes the workflow.
No-code Options
This is worth saying plainly, because engineers tend to skip it. For a lot of jobs, the right answer is a no-code platform. Lovable, Bolt and Replit turn a description into a working application. They deploy it, and you can keep writing prompts to change it. For a prototype, an internal tool, or a landing page with a form behind it, that takes hours instead of weeks.
The trade-off is the usual one. You get speed now and less control later. If you move off the platform, you must build the application again. Know which of those you are buying.
Summary
A framework does not give you the agent loop. You could write that yourself. It gives you everything around the loop:
- retries
- streaming
- tool schemas
- memory that survives a restart
- a place for the traces to go
LangChain is three libraries at three levels. LangGraph is the runtime. Its state is explicit, so you can save, resume and interrupt a run. LangChain is the ordinary interface and the place to start. deepagents is the deep agent architecture, already assembled. Start in the middle, and move up or down when the job needs it.
Agno, CrewAI, smolagents and Pydantic AI are the other Python options. They differ mostly in how much they decide for you. Mastra and VoltAgent are the TypeScript answers.
Then comes the distinction that matters most. A workflow runs a path that you wrote. An agent decides its own path. The agent is not the upgrade. If you can write the steps down, write them down, and n8n is where those steps live. With its MCP server, your coding agent can build those workflows for you. That makes the two approaches partners rather than rivals.
References
📄 Articles
- AI Workflows vs AI Agents: the distinction, and when each one is right
🛠️ Tools
🗃️ Repositories
- LangChain: the main interface, and the place to start
- LangGraph: the runtime underneath, for when you want to control the flow yourself
- deepagents: the deep agent architecture, already put together
- Agno: agents as a managed platform rather than a script
- CrewAI: agents organised as roles in a crew
- smolagents: the barebones one, and the best to read
- Pydantic AI: typed from end to end, so a bad tool call fails with a clear error
- Mastra and VoltAgent: the TypeScript options
- n8n: the workflow platform, with an MCP server that builds the workflows for you
Want a quick quiz?5 questions on the main points of this module
According to the module, what is the main thing an agent framework gives you?