Skip to main content

Framework Support

View as Markdown

Every agent framework runs on the same session Flow through its own adapter. Pick your framework to see how its turn maps onto Steps, which session features it has, and its limits.

How your framework runs a turn

Most adapters stop the framework before a tool runs, so each tool call runs in its own Step, in parallel: CallTool for a read or an idempotent write, CallSingleAttemptTool for any other write. A call that needs approval waits in AwaitToolApproval first. The next RunModel gives the framework the recorded results, so no tool runs again. A turn that looks up an order runs RunModel, CallTool, ResumeTurn, and RunModel. The Claude Agent SDK is the exception: it runs reads inside RunModel.

The tabs show how each framework is stopped and resumed, and where a framework differs.

The Claude Agent SDK runs Claude Code as an agent. Its agent loop runs in the Claude Code CLI, a subprocess of the Worker. The Dex adapter runs that loop inside a durable session. It is available for Python and TypeScript.

When to use it

Use it when you want the Claude Code agent loop, its context management, and its tools. Use it when your agent already uses the Claude Agent SDK.

Use the built-in agent loop when you want one model call per Step, parallel tool Steps, or Dex compaction.

How a session runs

Claude Code runs a whole turn, so the adapter splits a turn into segments. One RunModel Step runs the CLI for one segment. Model calls run inside the segment. So do read tools: a deferred read would restart the CLI. A Connector tool call is the exception: it always leaves the segment, even a read. See Connect Connectors.

A write tool call ends the segment. It waits in AwaitToolApproval when it needs approval. Then it runs in its own Step: CallTool for an idempotent write, CallSingleAttemptTool for any other write. ResumeTurn then returns to RunModel, which resumes the same Claude session. The CLI gets the recorded result and does not run the tool again.

A failed segment retries, up to three attempts, and reruns whole. Model calls and reads inside it run again. A write that ran in its own Step does not run again when the segment retries.

A turn that looks up an order runs one RunModel Step. A turn that cancels an order runs RunModel, AwaitToolApproval, CallSingleAttemptTool, ResumeTurn, and RunModel.

Features by harness

Some session features depend on the harness:

FeatureFramework adaptersBuilt-in agent loop
Queued messages, Steer, and cancel_turnYesYes
Dex compaction of old messagesYes, except the Claude Agent SDKYes
Questions to the user (ask_user)NoYes
Plans (plan mode and execute_plan)NoYes

Limits

Each tab lists the limits of one adapter that change how you write an agent, with what to do instead.

  • One write call per segment leaves the turn. A reply with two writes costs one more segment and model call. The writes of one reply never run as parallel Steps.
  • Tools that run inside the CLI, such as Bash or Edit, are at least once. They run again when a segment reruns. Files the CLI changes are not recorded.
  • A segment must finish within the RunModel method timeout, 15 minutes by default. Raise it with run_model_limit in Python or runModelLimit in TypeScript.
  • Claude Code compacts its own transcript, and Dex compaction stays off. A long session ends at the state limit, not the context window: the active state of one session, 64 MiB by default (Session limits).
  • A recorded tool result keeps text only.
  • A write call inside a subagent is denied. The model is asked to call it from the main conversation.

Limits for long sessions has the server limits.

Next