Lesson 11 · Slide 1
Lesson 11 — Choosing the Right Framework
One scorecard, four sweet-spot agents, real numbers.
Agents
Module 6
Scorecard
Cross-Framework
Lesson 11 · Slide 2
Where we are
- You've now built four agents — one per framework — each at that framework's natural sweet spot.
- L04 (Claude Agent SDK), L06 (LangGraph), L08 (OpenAI Agents SDK), L10 (CrewAI).
- This lesson is the apples-to-apples lens you couldn't have had earlier — you needed all four agents to exist before any comparison was meaningful.
- The output: a scorecard you can re-run on your own machine, with your own questions.
Lesson 11 · Slide 3
The four agents (recap)
| Lesson | Framework | Sweet spot | LoC (approx) |
| L04 | Claude Agent SDK | Tool-heavy research assistant | ~120 |
| L06 | LangGraph | Graph-shaped pipeline | ~150 |
| L08 | OpenAI Agents SDK | Triage + handoff | ~140 |
| L10 | CrewAI | Multi-agent crew | ~170 |
Each agent was built at the shape its framework was designed for — no contortions.
Lesson 11 · Slide 4
The scorecard
Seven dimensions
- Cost per task (USD) — total LLM spend per task, averaged across the harness's question set.
- Median latency (s) — wall-clock per task, median across runs.
- Lines of code (LoC) —
cloc on the agent.py file (excludes mocked data dicts).
- Built-in observability — what you get for free (steps, traces, events) vs. what you wire yourself.
- Eval surface area — how easy is it to hook in eval / replay / regression testing.
- Vendor lock-in — how much of your code couples to one vendor's API/model.
- Failure-recovery primitives — retries, timeouts, fallbacks, prompt-injection defences.
Lesson 11 · Slide 5
Why these seven (not five, not nine)
- Cost + latency + LoC are measured — the harness records them per run.
- Observability + eval + lock-in + failure-recovery are editorial-but-defensible — the eval harness emits a rubric score 0–3 for each.
- Seven is what fits a comparison table without scrolling sideways.
- Adding more dimensions (DX, docs quality, community size) starts to bias toward whoever writes the rubric — we leave those to taste.
Lesson 11 · Slide 6
The eval harness
agents/_eval/
__init__.py
scorecard.py # ScorecardRow dataclass + render helpers
run_all.py # main runner: imports all 4 agents, measures, emits JSON+MD
results.json # generated artefact (gitignored)
results.md # generated artefact (gitignored)
mcp_stub/ # used by L12's sidebar, not L11
The lab walks you through running it — one command, one minute, your own numbers.
Lesson 11 · Slide 7
What the harness measures (live)
- Wraps
run_research_agent / run_pipeline_agent / run_handoff_agent / run_crew_agent with a timer.
- Reads
cost_usd from each agent's returned dict — every sweet-spot agent exposes this field.
- Runs
cloc (or a Python LoC counter fallback) on the underlying agent.py.
- Repeats across 3 questions to compute a median, not a single sample.
Lesson 11 · Slide 8
What the harness scores (rubric)
- Observability (0–3): does the framework emit per-step events? Does it ship with a tracing UI? Is the trace easily exportable?
- Eval surface (0–3): can you intercept tool calls / final outputs? Is there a documented
eval mode?
- Lock-in (0–3, higher = more portable): how many places does the code mention “OpenAI” / “Anthropic” / “LangSmith”?
- Failure-recovery (0–3): built-in retries? Timeouts? Prompt-injection defences? (See the AI Prompting Security course for the last point.)
Lesson 11 · Slide 9
A real scorecard (2026 Q2 snapshot)
| Dimension | Claude SDK | LangGraph | OpenAI SDK | CrewAI |
| Cost/task (USD) | 0.034 | 0.041 | 0.029 | 0.062 |
| Median latency (s) | 18 | 24 | 16 | 31 |
| Lines of code | 120 | 153 | 138 | 168 |
| Observability (0–3) | 2 | 3 | 2 | 1 |
| Eval surface (0–3) | 2 | 3 | 2 | 2 |
| Vendor lock-in (0–3, higher = more portable) | 1 | 2 | 1 | 3 |
| Failure-recovery (0–3) | 2 | 3 | 2 | 1 |
Example numbers — the lab produces the real ones for your machine and model choices.
Lesson 11 · Slide 10
What jumps out
- OpenAI SDK wins on latency + cost for this sweet-spot suite. Why? Handoffs are the cheapest shape — mostly text, fewer tools.
- LangGraph wins on observability + eval — because you can intercept any node.
- CrewAI is highest LoC + cost — three role-played agents talk a lot. That's the price of the role-play frame.
- Claude SDK is the median across all dimensions. Solid default unless one of the others' wins matter for your case.
Lesson 11 · Slide 11
What the numbers DON'T tell you
Three things the scorecard can't see
- How the team feels writing the code. Some engineers love drawn graphs (LangGraph); others love decorators (Claude SDK).
- The cost of changing the agent. A LangGraph DAG is easy to modify if you already think in DAGs; otherwise it's overhead.
- The blast radius of vendor decisions. “Lock-in 1” might be fine if you're already deep in that vendor's ecosystem.
Lesson 11 · Slide 12
Decision matrix
- Tool-heavy + Claude is fine → Claude Agent SDK.
- Pipeline / DAG shape → LangGraph.
- Multi-provider model routing or triage / handoff → OpenAI Agents SDK.
- Role-play / committee shape → CrewAI.
- Unknown → start with Claude SDK; rewrite if a specific need surfaces.
Lesson 11 · Slide 13
What the harness CAN'T be replaced by
- Hand-rolled spreadsheets bias toward the framework the author already likes.
- The harness is deliberately not a vibes-check — it runs the same task set against every agent, in the same loop, with the same timer.
- If you disagree with a number, change the harness — don't lobby for editorial overrides.
- This is the same discipline as benchmarks in any other engineering domain: reproducible > opinionated.
Lesson 11 · Slide 14
Recap & what's next
- Seven dimensions — three measured, four rubric-scored 0–3.
- An eval harness produces the numbers — not editorial taste.
- Decision matrix as a starting point, not as a verdict — your context matters.
Coming up: Lesson 12 — cost / latency / evals across frameworks, plus an MCP-bridge sidebar.