Lesson 9.10core2 h 30 min

Frameworks and SDKs

What LangChain, LlamaIndex, DSPy and plain SDKs buy you, and what they cost

Every RAG tutorial is written in some framework, and every framework hides decisions you need to understand. Knowing what LangChain and LangGraph, LlamaIndex, Haystack, DSPy and the thin provider SDKs actually provide — integrations, graph runtimes, typed outputs, prompt optimization — and what they cost in abstraction, churn and debuggability lets you choose deliberately, keep your evaluation harness independent, and drop a framework when it gets in the way. The same judgment carries into agent frameworks in Phase 10 (10.6 Multi-agent systems, 10.11 Building production agents).

You'll be able to

  • Describe what each major framework is for and where it fits in a RAG system
  • Weigh the benefits of frameworks (integrations, graph runtimes, tracing) against their costs (abstraction leakage, hidden prompts, churn)
  • Assemble a minimal, framework-light stack for learning and a deliberate stack for production
  • Explain DSPy's signature, module and optimizer model and when prompt optimization pays off
  • Use framework source code as a library of worked solutions to learn from

Key ideas

  1. Frameworks provide integrations, pattern implementations, graph runtimes (state, checkpoints, human-in-the-loop) and tracing hooks.
  2. They cost abstraction leakage, hidden prompts, API churn, overhead and a distorted mental model of what the system actually does.
  3. Learn with the thin stack: provider SDK + embeddings + NumPy/FAISS + Pydantic + one tracing tool; graduate deliberately.
Show 4 more key ideas
  1. In production pick one orchestration layer for a reason, version prompts and schemas, and keep the eval harness framework-independent.
  2. DSPy's signatures, modules and optimizers compile prompts against a metric — prompt engineering becomes optimization once a golden set exists.
  3. 12-factor agents: own your prompts, context window and control flow; tools are structured outputs; small composable components.
  4. Read framework source as worked solutions, then reimplement the pattern yourself in thirty lines.

Suggested path through this lesson