Choosing a Framework Basics
9 examples to get you started with Choosing a Framework - 6 basic and 3 intermediate.
Search across all documentation pages
9 examples to get you started with Choosing a Framework - 6 basic and 3 intermediate.
These sketches are conceptual and deliberately small. They show control-flow differences, not full production installs. API names can shift; treat snippets as teaching models and verify against current docs at build time.
Compare frameworks only on the same goal, tools, and stop rules.
TASK = {
"goal": "Answer with the current weather for a city, then stop",
"tools": ["get_weather"],
"max_turns": 4,
"success": "returns temp_c and summary",
}Related: What Actually Differs Between Agent Frameworks - comparison axes
Define the business tool once so both frameworks call the same capability.
def get_weather(city: str) -> dict:
# stand-in for a real API client
return {"city": city, "temp_c": 18, "summary": "cloudy"}
TOOLS = {"get_weather": get_weather}Related: Framework Lock-In Risks and How to Avoid Them - portability patterns
Model the loop as nodes over shared state.
# Conceptual LangGraph-style control (not a full app)
state = {"city": "Berlin", "messages": [], "result": None}
def call_model(state):
# model decides: tool call or final answer
return {**state, "next": "tool", "tool_args": {"city": state["city"]}}
def call_tool(state):
out = TOOLS["get_weather"](**state["tool_args"])
return {**state, "result": out, "next": "end"}
# edges: model -> tool -> end (or model -> end)result, next) are easier to log than a pure chat blob.Related: The LangGraph Mental Model: Agents as State Graphs - graph model
Model the loop as a specialist role assigned a task.
# Conceptual CrewAI-style control (not a full app)
agent = {
"role": "Weather Reporter",
"goal": "Fetch weather and summarize clearly",
"tools": ["get_weather"],
}
task = {
"description": "Get weather for {city} and return temp_c + summary",
"agent": agent,
"expected_output": "JSON with temp_c and summary",
}
# crew.kickoff(inputs={"city": "Berlin"})Related: The CrewAI Mental Model: Roles, Tasks, and Crews - role model
Score both solutions on the same rubric after running the identical task.
scorecard = {
"correct_result": False, # structured weather fields present
"turns_used": 0, # lower is better for this task
"lines_of_glue": 0, # setup cost
"easy_to_add_approval": None, # yes/no gut check
"easy_to_unit_test_tool": None,
"clear_stop_reason": None,
}Related: Framework Comparison Matrix: LangGraph, CrewAI, Microsoft Agent Framework & More - full matrix
See a third style: agent + tools without graph or crew abstractions.
# Conceptual native-SDK style
agent = {
"name": "weather",
"instructions": "Use get_weather for city questions. Stop when answered.",
"tools": [get_weather],
}
# result = Runner.run(agent, "Weather in Berlin?")Related: What Native Provider Agent Primitives Give You Over a Framework - native trade-offs
Extend the same task so control-flow differences show up.
def next_step(state):
if not state.get("city"):
return "ask_city"
if state.get("result"):
return "end"
return "fetch_weather"Related: Branching and Conditional Edges for Multi-Path Agents - graph branching
Run a 90-minute bake-off, not a two-week rewrite contest.
spike = {
"minutes": 90,
"task": TASK,
"frameworks": ["graph_style", "crew_style"], # or native vs pydantic-ai
"must_capture": [
"install friction",
"lines of glue",
"trace readability",
"how stop works",
"how to add a second tool",
],
}Related: POC-to-Production Migration Paths Between Frameworks - after the spike
Write the choice so a future teammate can challenge it.
decision = {
"task_class": "short tool-using Q&A",
"chosen": "graph_style", # example only
"why": "we expect approval nodes and resume within a quarter",
"not_chosen": "crew_style",
"why_not": "role overhead for single-tool flows; weaker fit for strict edges",
"revisit_when": "multi-role research pipeline becomes the main workload",
}Related: Choosing a Framework Best Practices - evaluation practices | An ADR Template for Agent Framework Selection - write it down
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Reviewed by Chris St. John·Last updated Jul 16, 2026