Agent Frameworks & SDKs

OpenAI Agents SDK, Pydantic-AI, smolagents, Strands, and LangGraph — pick by what your agent needs.

The framework layer is where you actually wire a model to tools and get a working agent loop. Each of the five covered here optimizes for a different shape of the same problem — pick based on what your agent actually needs to do, not by star count.

Quick pick: OpenAI-first production loop → OpenAI Agents SDK; typed outputs and tests → Pydantic-AI; minimal Hugging Face stack → smolagents; AWS-native simplicity → Strands; explicit graphs and branching → LangGraph. See our Python AI SDKs comparison for a longer side-by-side.

OpenAI Agents SDK

Pydantic-AI

smolagents

Strands Agents SDK

LangGraph

What Is It?

The frameworks chapter compares OpenAI Agents SDK, Pydantic AI, smolagents, Strands, and LangGraph.

Each child page goes deep on one toolkit's primitives and tradeoffs.

Frameworks implement the think-act-observe loop with different ergonomics.

Why Should I Care?

Choosing the wrong abstraction (graph vs simple loop) wastes weeks when requirements change.

Interviews ask why you picked a framework, not just that you imported one.

Real World Analogy

Frameworks are different kitchen layouts — same ingredients (model, tools, memory) but different counter space for branching workflows.

Visual Mental Model

text
frameworks hub
    |-- OpenAI Agents SDK
    |-- Pydantic AI
    |-- smolagents / Strands / LangGraph

Beginner Explanation

This hub links five frameworks. Pick by what you need: OpenAI-native loop, typed validation, code-as-agent, AWS integration, or explicit graphs — not by GitHub stars alone.

Smallest Possible Example

python
FRAMEWORKS = ["OpenAI SDK", "Pydantic AI", "smolagents", "Strands", "LangGraph"]
print("options:", len(FRAMEWORKS))

Common Mistakes

❌ Adopting LangGraph for a single-tool chatbot.

Graph complexity should match branching and durability needs.

❌ Switching frameworks weekly.

Learn one loop deeply, then compare with intent.

❌ Ignoring vendor lock-in on hosted runners.

Know what is portable (tool schemas, prompts) vs tied to a SDK host.

Real Project Example

OpenAI customers standardize on Agents SDK for hosted tool loops.

LangGraph appears in multi-agent research prototypes and some enterprise orchestration.

Build This Mini Project

Write five bullets: your agent's needs (branching, AWS, HF models, strict types, minimal deps). Map each need to one framework link from this hub.

Interview Question

How do you choose an agent framework?

Match control flow needs (linear vs graph), hosting (OpenAI vs self-run), typing/testing requirements, cloud vendor, and team familiarity — then prototype the riskiest tool call in that framework for a day.

Key Takeaways

  • Hub compares five serious options.
  • Match framework to workflow shape.
  • Child pages hold implementation depth.
  • Prototype before committing.

YouTube learning

Core concepts from video walkthroughs:

Threads in the same domain as this chapter — go deeper on iHateReading without leaving the roadmap.

Python AI agent SDKs in 2026: OpenAI vs Pydantic-AI vs smolagents vs Strands cover

Python AI agent SDKs in 2026: OpenAI vs Pydantic-AI vs smolagents vs Strands

Same three-tool agent in four frameworks — pick by execution model and testing needs.

Agent harnessing: the part of building AI agents nobody talks about cover

Agent harnessing: the part of building AI agents nobody talks about

Loop, tools, memory, sandbox, and tracing live in your code — not the model weights.

Smallest AI Agent cover

Smallest AI Agent

Minimal file-reading agent to learn LLM tool loops without framework magic.

AI Agent cover

AI Agent

What agents are and how they differ from a single chat completion.