Why Frameworks
~3 min read
Concept & How It Works
- Key points are in the visual diagram above.
Learn these elsewhere (not covered in depth here)
- →LangGraph — Phase 10
- →Claude Agent SDK — Phase 12
- →CrewAI — Phase 13
- →MCP — Phase 8
Why Does It Exist?
Raw while-loops work for a demo and collapse when you need checkpoints, handoffs, or human approval. Frameworks encode those production problems so you are not rewriting orchestration for every product.
Real-World Analogy
Phase 4–7 taught you how an engine works. A framework is the car — you still need to know what a clutch does when it fails on the highway.
Visual Workflows
What is Why Frameworks?
Example
Scenario
A refund agent needs: classify → lookup order → maybe refund → human gate over $200. That is a graph (LangGraph), a typed tool loop (PydanticAI), or a crew with a manager. The framework is the wiring, not the policy.
Solution
In Agent Framework Landscape, apply Why Frameworks to this scenario: A refund agent needs: classify → lookup order → maybe refund → human gate over $200. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Practice Task
Do this before moving to the next module — reading alone is not enough.
Open the Code Walkthrough below and run it locally. Change one parameter related to Why Frameworks (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.
Code Walkthrough
Highlighted lines show where Why Frameworks happens in the code.
1def agent_loop(user, tools, llm, max_steps=8): # define a reusable function2 state = {"messages": [user], "step": 0}3 while state["step"] < max_steps:4 decision = llm.decide(state, tools)5 if decision.type == "final":6 return decision.text # return the result7 state["messages"].append(tools.run(decision.tool, decision.args))8 state["step"] += 19 return "stopped: max steps" # return the result10# Frameworks replace this loop with graphs, crews, or typed runners.Commands to Remember
Commands to Remember
Framework = runtime around the agent loopMCP = tool protocol, not an orchestratorLearn the loop before the libraryPick runtime for control flow, not hype
Common Mistakes
- Starting with LangGraph before writing a raw loop
- Treating MCP as a competitor to CrewAI
- Collecting frameworks instead of shipping one agent
Cheat Sheet
Quick recap — the most important points from this module.
Cheat Sheet
quick ref- •Loop first, framework second
- •MCP is not LangGraph
- •State + tools + stop conditions
- •Match runtime to the workflow
