The thirty lines from the last chapter work. Run them, and the broker's email comes back as a decision: quote, high premium band, flood zone AE. So the team takes the script to a design review, and three proposals arrive in the same hour.
The first: do not hand-write HTTP, use the vendor's SDK. The second: use an agent framework, because it has retries and limits built in. The third: do not run any of this, there is a managed service for it. Each proposal comes with a dozen lines of code that do the same quote step. All three are reasonable, and nobody in the room can compare them. They look like three ways to spell the same program.
Meanwhile one line of the script is on the screen, and no proposal mentions it:
while True: # no turn limit, no budget, no checkpoint: that is the harness's job
That comment names work nobody has done yet. The real question in the review is not which syntax is shortest. It is who will own that work under each proposal. This chapter gives the team a way to answer it.
Every SDK, framework and platform is a rung on one ladder. Each rung hides some work of the rung below it. No rung changes what happens at the bottom: one call to a model, repeated. So a problem that exists at the bottom still exists at the top. It only has a new owner.
1. The bottom rung: one request, sent again and again#
Start with what the team already has. In the miniature, the whole agent is about thirty lines of agent_minimal.py: the call, one tool, and the loop. Two of its functions matter here. call_model is the HTTP request from One call. agent, twelve lines, is the loop from The loop. They are shown here once more because every later rung is a different way of not writing them.
The code below is quoted from examples/quote-email/agent_minimal.py (functions call_model and agent). It shows the two things any rung must do in the end: post the full history to the model, and answer each tool request with a tool result. A successful run proves that the loop closes. It proves nothing about what happens when a call fails or the model never stops asking.
def call_model(messages: list[dict]) -> dict:
"""One HTTPS POST. The model keeps nothing, so every call carries the full history."""
body = {"model": "claude-opus-5-5", "max_tokens": 16000, "tools": TOOLS, "messages": messages}
request = urllib.request.Request("https://api.anthropic.com/v1/messages", json.dumps(body).encode(), {
"x-api-key": os.environ["ANTHROPIC_API_KEY"],
"anthropic-version": "2026-10-21",
"content-type": "application/json"})
with urllib.request.urlopen(request, timeout=120) as reply:
return json.load(reply)
def agent(email: str, call=call_model) -> str:
"""The loop: call, run the tools the model asked for, send the results back, repeat."""
messages = [{"role": "user", "content": email}]
while True: # no turn limit, no budget, no checkpoint: that is the harness's job
response = call(messages)
messages.append({"role": "assistant", "content": response["content"]})
if response["stop_reason"] != "tool_use":
return "".join(block["text"] for block in response["content"] if block["type"] == "text")
results = [{"type": "tool_result", "tool_use_id": block["id"],
"content": run_tool(block["name"], block["input"])}
for block in response["content"] if block["type"] == "tool_use"]
messages.append({"role": "user", "content": results})
Run against the scripted model (no network, no key), it prints the decision:
/opt/homebrew/bin/python3 agent_minimal.py --fake
{"decision": "quote", "missing_fields": [], "reasons": ["eligible; flood zone AE"], "premium_band": "high"}
This is rung 1, raw HTTP. Nothing is hidden. The team wrote the JSON body, the three headers and the loop, and can read every byte that leaves the process. The model asks for a tool, the harness (here, the agent function) decides and calls it, and the tool does the work.
2. What breaks when you stay at the bottom#
Two different kinds of trouble are waiting in those lines, and the rest of the chapter depends on keeping them apart.
The first kind is plumbing. Suppose the API answers one request with status 429, which means "too many requests, try again shortly". urllib.request.urlopen raises an exception for that status, nothing in call_model catches it, and the whole run ends. A retry with a pause would have saved it. The same holds for a dropped connection. There are no types either: response["stop_reason"] is a string key, so a typing mistake fails only when that line runs. None of this has anything to do with insurance. Every team that calls a model writes the same retry, header and parsing code, and that repetition is the reason higher rungs exist.
The second kind is ownership. The comment on the loop names three questions that the script leaves open. This chapter carries exactly these three up the ladder.
| Question | In the thirty lines today | What goes wrong |
|---|---|---|
| State: where does the history live? | In messages, a local variable | The process stops, and the run is gone. Nobody can resume it tomorrow. |
| Permissions: who decides that a tool may run? | Nobody. run_tool runs whatever the model asks for. | Harmless with one read-only tool. Not harmless once a tool sends an email. |
| Cost: what stops the loop? | Only the model, when it stops asking | A model that keeps asking keeps spending. Each turn resends the whole history. |
The miniature's second file, harness.py, answers all three in plain code: a checkpoint after every step, an authorize function, a turn limit and a token budget. Those answers are the subject of the next ten chapters. The point for now is smaller. People climb the ladder to get rid of the plumbing, and they often assume the three questions disappear with it. The plumbing does disappear. The questions do not.
3. Six rungs, bottom to top#
The names below are the ones this site uses everywhere. An abstraction ladder is the ordered list of layers you can stand on to run the same model call: each layer wraps the one under it and takes over a named piece of work.
Diagram: Six rungs over one call · what each hides, and what stays with you
Read left to right: that is the climb, from the bottom rung to the top. The top box in each column is what that rung hides from you, in addition to everything to its left. The box under it is what you still own there. The top row grows. The bottom row never becomes empty. Click any box.
- 1 · Raw HTTP
- Hides nothing: You write the request body, the headers, the retry and the loop. Every byte that leaves the process is yours to read.
- Still yours: everything: The request, the loop, the history, and every rule about tools, limits and saving.
- 2 · Provider SDK
- Hides the request: The vendor's client library builds the HTTP request, adds the auth header, retries failures that are safe to retry, and returns typed objects.
- Still yours: the loop: The loop, the history, and every job around the loop. The three open questions have the same answers as at rung 1.
- 3 · Agent SDK
- Hides the loop: A library in your process calls the model, runs the tools the model asked for, sends the results back, and repeats until the model stops asking.
- Still yours: limits, state: State across runs, permissions, deployment, and the limits. A turn limit is a parameter, and it applies only if you set it.
- 4 · Agent framework
- Hides some jobs: The loop, plus packaged versions of several jobs around it: retry with backoff, a fallback model, call limits, approval pauses, and one interface for many model providers.
- Still yours: rules, database: Business rules, evals, operating it, and the database behind any saved state. The request is now built by code you did not write.
- 5 · Graph runtime
- Hides save and resume: You describe the work as nodes and edges. The runtime saves the state as the run proceeds, so a run can pause at a node for a person and resume later in another process.
- Still yours: safe side effects: What each node does, the database, and making side effects safe to repeat, because a resumed node runs again from its beginning.
- 6 · Managed harness
- Hides the servers: A vendor runs the loop on its own infrastructure, and often the sandbox where tools run and the session state too. Your code sends a definition and a message, and reads events.
- Still yours: rules, tools, budget: Instructions, tool definitions, the execution of your own tools, the permission policy, the budget and the evals. The part that is specific to your business.
Read the top row from left to right and the hidden work grows: first the HTTP request, then the loop, then some of the jobs around the loop, then saving and resuming, then the servers themselves. Read the bottom row and notice that it never becomes empty. The next five sections climb one rung at a time. Each fragment shows the same quote step. Only the rung 1 code above was run for this page. Every other fragment follows the vendor's documentation as read on 2026-11-16 and is labelled as documented shape.
4. Rung 2: the provider SDK shortens the request, and leaves the loop to you#
The cause this rung removes is the plumbing from section 2. A provider SDK is the model vendor's own client library for one API. It builds the HTTP request, adds the headers, retries failures that are safe to retry, and returns typed objects.
The fragment shows the request from call_model written with Anthropic's Python SDK. The model id, the tool schemas and the messages list stay the same.
# Rung 2: the provider SDK. Documented shape; not run here.
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY, adds the headers,
# retries connection errors, 408, 409, 429 and 5xx twice
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
tools=TOOLS, # the same JSON Schemas as at rung 1
messages=messages, # the history is still yours to keep and to re-send
)
if response.stop_reason == "tool_use": # the loop is still yours to write
...
The 429 that ended the run in section 2 is now retried by the library, and response.stop_reason is an attribute that an editor can check. Now ask the three questions. State: messages is still a list in your process. Permissions: the SDK never runs a tool, so the decision is still in your loop. Cost: the SDK limits retries of one request, not the number of turns. All three answers are the same as at rung 1.
This is a respectable place to stop. The full build of the running example calls the model at this rung and writes its loops by hand, because its loops carry rules that the team wants to read in its own code.
What the SDK retries, in the vendor's wordsTwo retries by default, for a named list of failures
Anthropic's Python SDK page says: "By default, the SDK retries certain errors twice, with a short exponential backoff. It retries connection errors (for example, a network problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors." The number is the max_retries option, default 2.
The API errors page describes the same behaviour more loosely ("connection errors, rate limits, and 5xx server errors") and does not list 408 and 409. This page follows the SDK page. A retry repeats one HTTP request. It is not a second attempt at the task, and it does not make a tool call safe to repeat. That problem has its own chapter: Reliability and cost.
5. Rung 3: the agent SDK takes the loop#
At rung 2 the team still writes the while True block, and it is the same block in every project: call, check the stop reason, run the tools, append the results, call again. The cause this rung removes is that repetition. An agent SDK is a library that runs the loop inside your process. You hand it tools and a first message, and it returns when the model stops asking.
The smallest form is a helper inside the provider SDK itself. Anthropic calls it the tool runner, and it is in beta. The fragment shows the quote step with it: the tool is an ordinary Python function, and there is no loop in the caller's code.
# Rung 3: the tool runner inside the provider SDK (beta). Documented shape; not run here.
import json
from anthropic import Anthropic, beta_tool
client = Anthropic()
@beta_tool
def check_underwriting_rules(address: str, year_built: int, sqft: int) -> str:
"""Apply the underwriting rules to a property.
Args:
address: Street, city and state
year_built: Year the house was built
sqft: Living area in square feet
"""
return json.dumps(apply_rules(address, year_built, sqft)) # your code; the runner calls it
runner = client.beta.messages.tool_runner(
model="claude-opus-5-5",
max_tokens=1024,
max_iterations=8, # a turn limit, because you set one
tools=[check_underwriting_rules],
messages=[{"role": "user", "content": email_text}],
)
final = runner.until_done() # call, run the tools, send the results, repeat
The vendor's description of the runner is the loop from section 1 in one sentence: "On every iteration, the runner sends an API request. If the response includes a call to one of the given tools, the runner calls the tool and returns the result to the model in the next iteration." The model still only asks. The runner decides and calls, and your function does the work.
A full agent SDK goes further on the same rung. The Claude Agent SDK describes itself as "the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript". It brings built-in tools, permission settings and saved sessions with it. The fragment shows only its options for the quote step, because the options are where the three questions get their answers at this rung. It is the same shape as the complete example on SDKs, which was compiled against the package there. It was not run.
# Rung 3: the options of a full agent SDK (Claude Agent SDK). Documented shape; not run here.
from claude_agent_sdk import ClaudeAgentOptions
options = ClaudeAgentOptions(
mcp_servers={"rules": rules}, # your tool, as an in-process tool server
allowed_tools=["mcp__rules__check_underwriting_rules"], # may run without asking
permission_mode="dontAsk", # a request that would need approval is denied instead
setting_sources=[], # load no settings or instruction files from disk
max_turns=6,
max_budget_usd=0.50,
)
Every line is a decision someone made for this agent. The coding tools this library comes from are on Coding harnesses.
Now the three questions. Cost has a named place for the first time: max_iterations on the runner, max_turns on the Agent SDK. Notice the wording in the documentation, though: the runner stops at max_iterations "if you set it". The parameter exists. The number is still your decision. Permissions: the runner calls a tool when the model asks for it, and the pages read describe no approval step, so a tool that must not run freely needs your own check inside the function. The Agent SDK has permission modes and allow and deny rules, which you configure. State: the library runs in a process you operate, and for the tool runner the documentation says it keeps its own message history without saying where. In a local check for the SDK chapter, the runner's requests carried a thread field, which keeps the history on the vendor's server for a short time. That is an observation of one package version on one day, not something the tool runner page documents: see the note on SDKs. A helper that removes code can also move data. The Agent SDK writes session transcripts to the local disk of that machine, so "resume tomorrow" now depends on what happens to that disk.
6. Rung 4: the agent framework turns jobs into configuration#
After rung 3 the loop is gone from the team's code, and the work around the loop is what remains: retry the model call with backoff, fall back to a second model, stop after a number of calls, pause for a person. Each team writes these again. An agent framework is a library that runs the loop and also ships packaged versions of several of those jobs, usually behind one interface for many model providers.
The fragment shows the quote step in LangChain, whose create_agent its documentation calls "a minimal, highly configurable harness". It demonstrates the trade this rung offers: three jobs become three lines of configuration.
# Rung 4: an agent framework. Documented shape; not run here.
from langchain.agents import create_agent
from langchain.agents.middleware import (
ModelCallLimitMiddleware,
ModelFallbackMiddleware,
ModelRetryMiddleware,
)
agent = create_agent(
model="anthropic:claude-opus-5-5",
tools=[verify_address, lookup_property, check_underwriting_rules],
system_prompt=TRIAGE_INSTRUCTIONS,
middleware=[
ModelRetryMiddleware(max_retries=3), # retry with backoff
ModelFallbackMiddleware("anthropic:claude-sonnet-5-5"), # a second model
ModelCallLimitMiddleware(run_limit=8), # a turn limit
],
)
result = agent.invoke({"messages": [{"role": "user", "content": email_text}]})
Each line in the middleware list replaces code the team would otherwise write and test. The cost is that the request is now assembled by code the team did not write. When a quote comes back wrong, the first question is still "what exactly was sent to the model?", and the answer is no longer on the screen.
The three questions again. Cost: the limit is a line of configuration, and the line is there because someone added it. Remove the last middleware and this agent has no limit that the team chose. Permissions: the framework offers a human-approval middleware, and its documentation says it "requires a checkpointer to maintain state across interruptions". A pause is only useful if the run can be continued, which brings the state question straight back. State: by default the history lives for one invoke. To keep it, the agent must be configured with a checkpointer, and a checkpointer needs a database that somebody runs. The other frameworks on this rung, and what each packages, are on Frameworks.
7. Rung 5: the graph runtime makes the run survive the process#
The approval gate exposes a problem that no rung so far has removed. In the running example a person must approve the reply before it is sent, and that person may answer in two days. A loop inside one process cannot wait two days. The process will be deployed, restarted or scaled away long before.
A graph runtime removes that cause. You describe the work as nodes (steps) and edges (what follows what). The runtime saves the state as the run proceeds, so a run can pause at a node and resume later from the saved state in a different process. LangGraph's documentation describes its checkpointer this way: it "saves a snapshot of graph state at each super-step, organized into threads".
The fragment shows the quote step with its approval gate as a three-node graph. It demonstrates the pause: the first invoke returns at the gate, and the second one, sent later with the same thread id, continues from there.
# Rung 5: a graph runtime. Documented shape; not run here.
from langgraph.checkpoint.postgres import PostgresSaver
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command, interrupt
def approval_gate(state: QuoteState) -> dict:
# The run stops here and its state is saved. Nothing has been sent yet.
answer = interrupt({"draft": state["draft_reply"]})
return {"approved": answer == "approve"}
def send_or_stop(state: QuoteState) -> str:
return "send" if state["approved"] else "stop"
builder = StateGraph(QuoteState)
builder.add_node("triage", triage) # the agent loop from rung 3 or 4
builder.add_node("approval_gate", approval_gate)
builder.add_node("send_reply", send_reply) # the side effect
builder.add_edge(START, "triage")
builder.add_edge("triage", "approval_gate")
builder.add_conditional_edges("approval_gate", send_or_stop, {"send": "send_reply", "stop": END})
builder.add_edge("send_reply", END)
with PostgresSaver.from_conn_string(DB_URL) as checkpointer:
checkpointer.setup() # creates its tables; first use only
graph = builder.compile(checkpointer=checkpointer)
config = {"configurable": {"thread_id": run_id}} # one thread per quote
graph.invoke({"email": email_text}, config) # runs until the gate
graph.invoke(Command(resume="approve"), config) # later: same thread id
Both invoke calls sit in one block only to keep the fragment short. In a real service the second call is made by a different request, days later, after a person has answered.
State now has a real answer: the checkpointer saves a snapshot as the graph runs, under a thread id, in PostgreSQL. Look at what the answer consists of, though. The team chooses the thread id, runs the database, and decides how long the saved state is kept. The runtime wrote the saving code. It did not take over the data.
The runtime also adds a rule that did not exist on the lower rungs. When a paused run continues, the documentation says "the runtime restarts the entire node from the beginning", and it states the consequence as a heading: "Side effects called before interrupt must be idempotent". Idempotent means safe to do twice with the effect of doing it once. If approval_gate had sent a notification before calling interrupt, that notification would go out again on resume. The miniature solves the same problem at rung 1 with an outbox table and send_once. The graph runtime does not solve it for you. It tells you that you must.
Cost and permissions do not move at this rung. The LangGraph pages read for this site list retry and timeout policies for nodes and no token budget, so a spending limit is the rung 4 middleware or code in a node. The gate is a mechanism for pausing. Which actions need the gate is a rule the team writes. Checkpoints and resuming are explained in full on Control and state.
The same job for code that is not an agentDurable execution is older and wider than agents
Saving progress as the work proceeds, and continuing after a crash, is called durable execution. It is not specific to agents. Temporal describes itself as "the open source Durable Execution platform for crash-proof applications and AI agents" and does this job for ordinary workflow code in several languages. A team that already runs such a platform can put an agent loop inside it and stand on rung 2 or 3 for the model call.
8. Rung 6: the managed harness runs the loop on someone else's servers#
At rung 5 the team operates a good deal: the processes that run the loop, the database behind the checkpointer, and a safe place for tools to execute. A managed harness removes that cause. A vendor runs the loop, usually the sandbox where tools execute, and the session state, on its own infrastructure. Your code sends a definition and a message, and reads events.
The fragment shows the quote step on Claude Managed Agents, which its documentation describes as a "pre-built, configurable agent harness that runs in managed infrastructure" and which is in beta. It demonstrates what crosses the boundary: instructions, tool definitions and one user message go in.
# Rung 6: a managed harness (Claude Managed Agents, beta). Documented shape; not run here.
from anthropic import Anthropic
client = Anthropic()
agent = client.beta.agents.create( # the definition is yours
name="Quote triage",
model="claude-opus-5-5",
system=TRIAGE_INSTRUCTIONS,
tools=[{
"type": "custom", # a custom tool runs in your application
"name": "check_underwriting_rules",
"description": "Apply the underwriting rules to a property.",
"input_schema": RULES_SCHEMA,
}],
)
environment = client.beta.environments.create( # where sessions run
name="quote-env",
config={"type": "cloud", "networking": {"type": "limited", "allow_package_managers": True}},
)
session = client.beta.sessions.create(
agent=agent.id, environment_id=environment.id, title="Quote: 18 Gulf Shore Blvd",
)
client.beta.sessions.events.send(session.id, events=[
{"type": "user.message", "content": [{"type": "text", "text": email_text}]},
])
There is no loop, no checkpointer and no server in this code. The quickstart lists what the service does after the last line: it provisions a sandbox, runs the agent loop, runs tools inside the sandbox, and streams events. The overview adds that conversation history, sandbox state and outputs are stored on the vendor's side.
Now follow the tool. The insurer's underwriting rules are not in the vendor's sandbox. They are a custom tool, and the documentation is direct about who runs one: "Claude does not run a custom tool itself. It emits a structured request, your code runs the operation, and you return the result to the session." The session goes idle with the stop reason requires_action, your application receives an agent.custom_tool_use event, runs the rules, and answers with a user.custom_tool_result event. Compare that with section 1. The model asks, something decides and calls, your tool does the work, and the result goes back. It is the same exchange, carried by events.
The three questions, one last time. State has a new owner: the vendor stores the session, so the team's questions become how long it is kept, who can read it, and how to delete it. Permissions: the service has permission policies for the tools it runs, such as always_ask, but the same page says they "don't apply to custom tools", because those run in your application under your control. The decision whether the rules tool may run for this caller is in your code, where it was at rung 1. Cost: the service offers a session budget with a hard cap. Somebody still chooses the amount. What each managed platform runs, and what it leaves, is on Managed platforms.
9. One limit, six spellings#
The claim of this chapter can now be checked against a single control. Take the cost question from section 2, the limit that stops a loop, and find it on every rung.
| Rung | Where the limit is written | Who chooses the number |
|---|---|---|
| 1 Raw HTTP | Nowhere in agent_minimal.py. In harness.py: MAX_TURNS = 8 and a token budget, checked in run | You |
| 2 Provider SDK | The same code as rung 1. The SDK's max_retries limits retries of one request, not turns. | You |
| 3 Agent SDK | max_iterations on the tool runner. max_turns and max_budget_usd on the Claude Agent SDK. | You |
| 4 Agent framework | ModelCallLimitMiddleware(run_limit=8) | You |
| 5 Graph runtime | No token budget in the pages read. The rung 4 middleware, or code in a node. | You |
| 6 Managed harness | A session budget on Claude Managed Agents. maxIterations, timeoutSeconds and maxTokens on Amazon Bedrock AgentCore. | You |
The middle column changes on every row. The right column does not. A higher rung gives the limit a name, a tested implementation and a place in the configuration. It cannot know that eight turns is right for a quote email and wrong for a claims investigation. And at several rungs the limit applies only if you set it.
This is what the limit looks like at the bottom, where it is a comparison in the team's own code. The command is from the miniature's README. A successful run proves that the budget check stops the loop before the reply is sent. It was run against the scripted model, so the token counts are the fake model's, not a measurement.
/opt/homebrew/bin/python3 harness.py --fake --approve --token-budget 1500
{
"run_id": "run-3fb2ef34",
"status": "stopped:token_budget",
"decision": null,
"reply": "none",
"turn": 3,
"tokens": 2115
}
The other two questions follow the same pattern, with one difference worth noticing.
| Question | Rungs 1 and 2 | Rungs 3 and 4 | Rung 5 | Rung 6 |
|---|---|---|---|---|
| State | A list in your process | A list in a library in your process. Saved only if you configure sessions or a checkpointer. | Saved as the run proceeds, in a database you run | Saved by the vendor. Retention and deletion become your questions. |
| Permissions | An if in your loop | Modes, rules and approval middleware that you configure | A pause mechanism. You decide which steps pause. | Policies for the vendor's tools. Your own tools stay under your own checks. |
| Cost | A counter in your loop | A parameter, if you set it | Middleware or node code | A budget, if you set it |
For state, ownership really does move as you climb: at rung 6 another company holds the history. That is the largest thing a rung can take from you, and it is why the move from rung 5 to rung 6 is a bigger decision than any below it. For permissions and cost, the mechanism moves and the decision stays. No rung knows which broker may see which property, or what a quote is worth spending.
10. Three abstractions that go sideways#
Three more kinds of product come up in the same design reviews. They are not rungs, because none of them hides the loop. Each hides one neighbour of the loop, and each can be combined with any rung.
| Abstraction | What it hides | Examples | Its home on this site |
|---|---|---|---|
| A model gateway | The provider. One interface in front of many models, often with routing and spend tracking. | LiteLLM | Reliability and cost |
| MCP | The tool integration. A tool server is written once and used by any compatible client. | The Model Context Protocol | MCP |
| A tracing platform | Storage for traces, and the screens to read them | LangSmith, Langfuse | Observability and evals |
A coding tool such as Claude Code does not fit on a rung either. It is a finished harness for one kind of work, built on a loop like the others. Its library form, the Claude Agent SDK, is the rung 3 product from section 5.
11. The ladder in one table, and three questions for any product#
Products in this summary are examples, not a ranking. Each one is described on its own page under "Harnesses you can adopt".
| Rung | Hides from you | You still own | Example products |
|---|---|---|---|
| 1 Raw HTTP | Nothing. You write the JSON, the headers and the retry. | Everything | curl. The miniature uses the Python standard library. |
| 2 Provider SDK | HTTP, the auth header, retries of rate limits and server errors, streaming, typed objects | The loop, the history and every harness job | The Anthropic SDK |
| 3 Agent SDK | The loop: call the model, run the tools, send the results back | State across runs, permissions, limits you must set, deployment | The tool runner in the Anthropic SDK, Claude Agent SDK, OpenAI Agents SDK |
| 4 Agent framework | The loop, plus packaged retry, fallback, limits and approval pauses, behind one interface for many providers | Business rules, evals, the database behind any saved state, operating it | LangChain create_agent, Pydantic AI, CrewAI |
| 5 Graph runtime | Saving the state as the run proceeds, so a run can pause for a person and resume, also after a crash | What each node does, making side effects safe to repeat, the database | LangGraph. Temporal for any code, not only agents. |
| 6 Managed harness | The servers that run the loop. Often the tool sandbox and the session state too. | Instructions, tools, your own tools' execution, the permission policy, budgets, evals | Claude Managed Agents (beta), Amazon Bedrock AgentCore, OpenAI Agents API (beta) |
The second column grows by adding. The third column shrinks, and what remains in it at rung 6 is the part that is specific to the insurer: its instructions, its tools, its rules about who may do what, its spending limits and its tests.
Back in the design review, the three proposals can now be compared. For each product, ask three questions.
- Which rung is it on? That says what it hides.
- Which of the jobs around the loop does it package, and which of those work only if you configure them?
- What does it leave to you, and where will that code or that decision live?
The proposals were never three spellings of one program. They were three different answers to question 3.
12. What a higher rung costs#
A higher rung is not free, and the price is the same at every step: distance from the request. At rung 1 the body that goes to the model is a variable the team can print. At rung 4 it is built by middleware. At rung 6 it is built on another company's servers, and the team sees it through a trace viewer or an event stream. When a quote goes wrong, the investigation still ends at the bottom: what did the model receive, and what did it answer? An abstraction saves you from writing the code. It does not save you from understanding it.
Two practical consequences follow. First, a team does not have to stand on one rung. The full build of the running example has four model steps, and it runs all of them at rung 2 with hand-written loops, because the limits and checks in those loops are the product. Second, the right moment to climb is when you can say which cause the next rung removes for you. "We keep rewriting the retry code" is a reason for rung 2. "A person must approve, and may take days" is a reason for rung 5.
How each fragment on this page was checkedOne was run. Five follow documentation read on 2026-11-16.
| Fragment | Status | Source |
|---|---|---|
Rung 1, agent_minimal.py | Run for this page with --fake. The output shown is the real output. | examples/quote-email/ |
Rung 2, client.messages.create | Documented shape, not run | Anthropic Python SDK page |
Rung 3, tool_runner, beta_tool, until_done, max_iterations | Documented shape, not run. The feature is in beta. | Anthropic tool runner page and Python SDK page |
Rung 4, create_agent and three middleware classes | Documented shape, not run | LangChain agents and built-in middleware pages |
Rung 5, StateGraph, interrupt, Command, PostgresSaver | Documented shape, not run | LangGraph persistence, interrupts, graph API and memory pages |
| Rung 6, agents, environments, sessions, events | Documented shape, not run. The product is in beta. | Claude Managed Agents overview, quickstart and tools pages |
Budget run, harness.py | Run for this page with --fake. Token counts come from the scripted model. | examples/quote-email/ |
Names such as TOOLS, TRIAGE_INSTRUCTIONS, QuoteState, apply_rules and RULES_SCHEMA stand for code the reader supplies. The fragments compile as Python. They leave out error handling, streaming and the reading of results, which a real program needs.
What comes next#
The team can now place any product on a rung and say what it hides. It can also say what no rung decided for it: where the history lives, who lets a tool run, and what stops the spending. Those were three questions picked from one comment in a thirty-line script, and they are not the whole list. A production agent needs eight such jobs done by someone. The eight jobs names them, so that "what does this product leave to me?" has a complete checklist behind it.