Agent Frameworks
Choosing a Framework
Notice that "time to prototype" and "production
JrCodex·7 min read
Jr Codex Agentic AI Notes
Level: Intermediate Prerequisites: Chapter 4: AutoGen & CrewAI Time to complete: ~20 minutes
Table of Contents
- The Comparison
- The Questions That Actually Decide It
- Lock-In and How to Limit It
- A Portable Architecture
- The Recommendation
- Summary & Next Steps
1. The Comparison
| LangGraph | AutoGen | CrewAI | Your own loop | |
|---|---|---|---|---|
| Metaphor | State machine | Conversation | Org chart | A while-loop |
| Control precision | High | Low | Medium | Total |
| Durable state | Built in | Limited | Limited | You build it |
| Pause / resume | Built in | Manual | Limited | You build it |
| Multi-agent | Explicit graph | Native | Native | You build it |
| Learning curve | Steep | Gentle | Gentlest | None |
| Time to prototype | Slow | Fast | Fastest | Medium |
| Production maturity | Strongest | Improving | Improving | Yours to own |
| Debuggability | Good — state is explicit | Hard — emergent flow | Medium | Best |
| Best for | Production agents | Research, exploration | Known pipelines | Simple agents |
Reading the Table
─────────────────────────────────────────
Notice that "time to prototype" and "production
maturity" are almost inverted.
The frameworks that get you running in twenty
minutes are the ones whose control flow you cannot
fully pin down later — which is exactly what
production requires.
That is not a flaw. It is the trade, and it
suggests using different tools at different
stages.
─────────────────────────────────────────
2. The Questions That Actually Decide It
Feature lists rarely decide this. Five questions do.
1. DOES A RUN NEED TO SURVIVE A RESTART?
─────────────────────────────────────────
If a 40-step agent losing its work on a deploy is
unacceptable ──► LangGraph. This single
requirement decides more cases than every other
factor combined.
2. DOES A HUMAN NEED TO APPROVE MID-RUN?
─────────────────────────────────────────
Pausing indefinitely, then resuming, requires
persisted state ──► LangGraph, or build it
yourself. Module 8, Chapter 2.
3. HOW MANY INTEGRATIONS DO YOU NEED?
─────────────────────────────────────────
Many ──► the LangChain ecosystem, whatever you use
for control flow. The loaders and vector store
adapters are worth borrowing on their own.
4. IS THIS EXPLORATION OR PRODUCTION?
─────────────────────────────────────────
Exploration ──► whatever is fastest. You will
rewrite it, and that is fine.
Production ──► whatever you can DEBUG at 3am.
5. WHO MAINTAINS IT IN A YEAR?
─────────────────────────────────────────
A team that knows the framework ──► use it.
One engineer who wrote something bespoke and has
since left ──► the framework's shared vocabulary
was worth more than the control you gained.
─────────────────────────────────────────
3. Lock-In and How to Limit It
Where Lock-In Actually Bites
─────────────────────────────────────────
LOW COST TO SWITCH
Tool definitions a function plus a schema.
Trivially portable.
Prompts plain strings.
Model calls one API behind an adapter.
HIGH COST TO SWITCH
State schema and the shape of your agent's
reducers state is framework-specific
Checkpointer format persisted runs may not
migrate at all
Control flow graph topology has no
equivalent elsewhere
Framework-specific every callback and hook
tracing you wired in
─────────────────────────────────────────
The Implication
─────────────────────────────────────────
Keep the portable things portable, and accept
lock-in only where the framework earns it.
Your tools, prompts and business logic should not
import the framework at all. Only the orchestration
layer should.
─────────────────────────────────────────
4. A Portable Architecture
# ---- core/tools.py — PLAIN functions. No framework import. ----
def list_orders(customer_id: str, since: str | None = None) -> dict:
"""List a customer's orders, most recent first.
USE FOR: order history, refund eligibility.
DO NOT USE FOR: contact details — use get_customer.
Returns: up to 20 orders. Read-only, ~80ms.
"""
...
TOOLS = {"list_orders": list_orders, "get_customer": get_customer}
SCHEMAS = [schema_from(fn) for fn in TOOLS.values()] # one generator, any framework# ---- core/policy.py — prompts as data. No framework import. ----
AGENT_SYSTEM = """You are a support operations agent.
...""" # Module 2, Chapter 2# ---- adapters/langgraph_agent.py — the ONLY framework-aware file. ----
from langgraph.graph import StateGraph, START, END
from core.tools import TOOLS, SCHEMAS
from core.policy import AGENT_SYSTEM
def build():
... # topology lives here, alone
# ---- adapters/plain_agent.py — the same tools, no framework. ----
def run(client, goal, bounds):
... # your own loop, same TOOLSWhat This Buys
─────────────────────────────────────────
Switching frameworks means rewriting ONE file.
It also means you can run the same agent through
your own loop for debugging and through LangGraph
in production — which is genuinely useful, because
a bare loop is far easier to reason about when
something is wrong.
─────────────────────────────────────────
5. The Recommendation
By Stage
─────────────────────────────────────────
WEEK 1, does this work at all?
──► your own loop, 150 lines. You will learn
more about the problem this way than
through any abstraction.
WEEKS 2-6, building it properly
──► LangGraph if you need durability or human
approval; your own loop if you do not.
Borrow LangChain components either way.
MULTI-AGENT, once you have proven you need it
──► LangGraph for production control; AutoGen
if the value really is in agents debating.
Read Module 6, Chapter 5 first.
Never adopt a framework because a tutorial used
it. Adopt one because you hit a specific problem
it solves.
─────────────────────────────────────────
The Uncomfortable Truth
─────────────────────────────────────────
Framework choice matters far less than most teams
assume.
Agent quality is determined by TOOL DESIGN
(Module 2, Chapter 3), CONTEXT MANAGEMENT
(Module 3), and EVALUATION (Module 7). All three
are framework-independent.
A well-designed agent in a bare loop beats a badly
designed one in the best framework, every time.
Spend your attention accordingly.
─────────────────────────────────────────
6. Summary & Next Steps
Key Takeaways
- Time-to-prototype and production maturity are close to inverted across these frameworks, which argues for using different tools at different stages.
- The requirement for runs to survive a restart decides more framework choices than every feature-list comparison combined.
- Lock-in is cheap for tools and prompts and expensive for state schemas, checkpoint formats and graph topology — so keep business logic free of framework imports.
- Framework choice matters far less than tool design, context management and evaluation, all of which are framework-independent.
Concept Check
- Which single requirement most often forces the choice of LangGraph, and why is it hard to build yourself?
- Which parts of an agent are cheap to port between frameworks, and which are expensive?
- Why does a well-designed agent in a bare loop typically beat a poorly designed one in a mature framework?
Module 5 Complete — What's Next
You now know what the frameworks provide and how to avoid depending on them more than necessary. Module 6 uses that machinery for the harder orchestration problems: durable state, parallel and conditional workflows, and coordinating several agents — starting with when not to.
Next Module
→ Module 6: Workflows & Multi-Agent Systems
Jr Codex — 1-on-1 Personalized Coaching | Back to Module Index | Back to Agentic AI Index