Do you need an agent framework at all?
Often, no: the agent loop is a while loop and a switch. Why writing it yourself first shows you what you need, the four things a framework genuinely earns its place for, the middle path, and choosing between the Vercel AI SDK and LangChain in TypeScript.
Diagrams in this video · 2Free in archhy
The diagrams, full size
Copy any of them into archhy, free, and change it for your own system.
After this lesson you can
- Write down the agent loop in four steps
- Name the four things a framework earns its place for
- Keep a framework easy to remove
- Choose between the Vercel AI SDK and LangChain.js
Transcript
Do you need an agent framework at all?
Space Llama here. Four lessons of frameworks, and now the awkward question. Do you need one at all? Frequently, no. Let's see when you do.
The whole agent loop
Here's every agent, written as a sketch, not a real library. It's a loop. The model reads the current state and picks a tool. Or it decides it's done, and the loop stops. The tool runs. And the result is appended to the state. That's a while loop and a switch statement. Everything a framework adds is scaffolding around it.
Write it yourself first
So the advice is: write the loop yourself first. Not forever, just to find out what you actually need. It takes an afternoon, and it shows you exactly where the difficulty in your problem is. Then you choose a framework because it solves that difficulty, not because it had the best README. Choose first, and you adopt abstractions before you understand the problem. A month later they're load-bearing, and removing them is a rewrite.
Where a framework earns its place
Four things genuinely earn a framework its place. Durability: checkpointing and resuming a long run is real engineering. That's LangGraph's strongest argument. Observability: tracing every step and replaying it. Structured output, generated, validated and retried properly. And real multi-agent coordination. Notice what's not on that list. Tool calling, prompt templates, switching providers and conversation history are a few dozen lines each. Write those yourself, and they stay in your codebase, where you can see them.
The middle path
There's a middle path. Adopt a framework for the one thing it does best, and keep the rest yours. Use the Model Context Protocol for integrations, so no framework owns your connectors. Keep your prompts in your own files, and your tools as plain functions. The framework should be the easiest part to remove.
In TypeScript
If you're building in TypeScript, the question often becomes the Vercel AI SDK or LangChain. The AI SDK is built for putting model output into a web app: streaming to the user interface, structured output and tool calling, written in TypeScript from the start. LangChain dot JS wins on breadth of integrations, and on matching a team's Python code. And LangGraph's JavaScript version gives you durable graphs in TypeScript. They combine well: the AI SDK where a user is waiting, something heavier behind it for work that takes minutes.
Remember
Let's recap. An agent's loop is small enough to write yourself, and writing it first shows you what you need. Buy a framework for durability, observability, validation or real coordination. Not to avoid writing a loop. And keep it the easiest part of your system to remove.
The full article, and what's next
The full article, do you need an agent framework at all, is free on Alpaca Mango. The link is below. That's the end of the course. Thanks for watching, and good luck with your agents. If you learned something, there's more on the channel. If you didn't, also the channel. Mate.






