Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 39 ยท Frameworks and Deployment

The Agent Framework Landscape

Compare the kinds of AI agent frameworks, what they give you, what they cost, and how to decide between building your own loop and adopting a library.

You can write a working agent in about forty lines of plain code: a loop that calls a model, runs the tools it asks for and feeds the results back. So why do agent frameworks exist? Because real products also need retries, streaming, memory, tracing, human approvals, multi-agent coordination and persistence, and writing all of that yourself takes time. Frameworks package those pieces.

This lesson maps the landscape by type rather than by brand, because products change quickly and the categories stay stable. You will learn what a framework really provides, how to compare them, and when building your own loop is the better choice. The lesson ends with a runnable mini-framework so you see exactly what the abstractions hide.

No real agent framework runs on this site, and this lesson avoids pinning down any library's exact API, since APIs change between versions. Check the current documentation of whichever library you pick. The mini-framework at the end is a plain-Python stand-in.

What a framework actually gives you

Strip away the marketing and most frameworks offer some mix of these building blocks:

What frameworks provide

The loop Call model, run tools, repeat
Tool wiring Schemas from functions
1 / 2
  • The agent loop with a stop condition and step limit.
  • Tool definitions: turn a typed function into a JSON schema the model understands, validate arguments, run the call.
  • State and persistence: save a run so it can pause, survive a crash and resume.
  • Model abstraction: swap providers behind one interface.
  • Orchestration: handoffs, parallel workers, graphs of steps.
  • Observability: built-in traces and cost tracking.
  • Integrations: vector stores, document loaders, ready-made tools.

Categories of framework

1. Provider SDKs

The model company's own library. It wraps the HTTP API, handles tool-calling formats and often includes a lightweight agent loop. Thin, stable, closest to the model's newest features. Best when you use one provider and want minimal abstraction.

2. Lightweight agent libraries

Small libraries that add an agent loop, tools, handoffs and tracing on top of model APIs, with few concepts to learn. Good for simple and medium agents and for teams that want control.

3. Graph and workflow engines

You describe the agent as a graph: nodes (steps) and edges (transitions), with shared state and checkpoints. This makes long, branching, pausable workflows explicit and debuggable. See structured agent workflows.

4. Multi-agent frameworks

Focused on teams of agents: roles, conversations between agents, delegation. Useful when your design really is multi-agent (see multi-agent patterns); overkill otherwise.

5. Low-code and no-code builders

Visual canvases for connecting prompts, tools and data. Fast for prototypes and for non-programmers, but harder to test, version and customize.

6. Protocols and standards

Not frameworks, but shared interfaces: for example the Model Context Protocol for connecting tools (see MCP) and OpenTelemetry for traces. They reduce lock-in.

How to choose

Ask these questions in order:

  1. Do I need a framework at all? If the agent has a few tools and a simple loop, a provider SDK is often enough.
  2. How long-running is the work? Hours or days, pauses for humans and crash recovery point to a graph engine with persistence.
  3. How many agents? One agent with tools beats three agents that talk. Only add multi-agent structure if you need it.
  4. How much do I need to see? Insist on tracing and the ability to inspect and edit prompts. Be wary of frameworks that hide the actual messages sent to the model.
  5. What is the team's skill? A tool nobody on the team understands is a liability.
  6. How stable is it? Check release history, breaking changes and community. Agent libraries change fast, so pin versions.

Costs of frameworks

  • Abstraction leaks. When something misbehaves you must understand what the framework did under the hood anyway.
  • Hidden prompts. Some frameworks add their own instructions; you pay for those tokens and they affect behaviour.
  • Churn. Rapid versions mean migrations.
  • Lock-in. State formats and agent definitions may not port to another library.

A sensible approach: understand the plain loop first (you built it in the earlier lessons), then pick the thinnest framework that removes real pain.

A mini-framework you can read

The code below is a tiny agent "framework": a decorator that registers tools and builds their schema, and a loop with a step limit. A scripted stand-in plays the model. Reading it shows that frameworks are mostly bookkeeping around the same loop.

Python A 30-line agent framework

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real frameworks add the parts this sketch leaves out: they send the tool list and messages to a real model, parse its reply, validate argument types, catch tool errors, retry, stream tokens and record traces. But the skeleton is the same.

Prototype before you commit

Build the smallest version of your use case in two candidate tools, run your eval set (see evaluating agents) on both, and compare the quality, the code you had to write and how easy debugging felt. A day of prototyping saves months of migration.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What do most agent frameworks provide?

    They package the bookkeeping around the model-call loop; the model itself comes from a provider.
  2. 2. Which category suits long, branching workflows that must pause and resume?

    Graphs with checkpoints make long-running, resumable flows explicit.
  3. 3. A key risk of heavy frameworks is...

    When you cannot see the messages sent to the model, bugs are hard to find.
  4. 4. What is the best way to compare two frameworks?

    Hands-on evals on your own task beat opinions.

Summary

  • A framework packages the agent loop, tools, state, tracing and integrations; it does not add intelligence.
  • Categories: provider SDKs, lightweight libraries, graph engines, multi-agent frameworks, low-code builders and protocols.
  • Choose by need: complexity, run length, number of agents, visibility, team skill and stability.
  • Costs include leaky abstractions, hidden prompts, churn and lock-in.
  • Learn the plain loop first, then prototype candidates against your evals.

Next: Model Context Protocol (MCP)