Best Embeddable Coding Agent Harnesses 2026

Seven embeddable coding agent harnesses compared on runtime control, isolation, portability, and the monthly cost of a production workload.

Wednesday, August 26, 2026Omid Saffari
Tools
  • Vercel AI SDK
  • CClaude Agent SDK
  • OOpenAI Codex SDK
  • OOpenHands Software Agent SDK
  • OOpenCode SDK
  • PPi
  • Ffx
  • Vercel
  • Lllama.cpp
  • OOpenCode
Best Embeddable Coding Agent Harnesses 2026

Vercel AI SDK is the best overall pick because AI SDK 7 puts five established coding runtimes behind one product-facing surface. That can turn a future runtime change from a UI rewrite into an adapter decision, but only if you are willing to own the sandbox and accept an experimental package boundary.

The short answer

An embeddable coding agent harness is the control layer your application calls. It owns some combination of the agent loop, tools, permissions, sessions, context compression, model access, and execution environment. That is a different buying decision from choosing a coding agent you use in a terminal or editor. If that is the product you need, start with the broader best AI coding agents comparison.

For a new TypeScript product, Vercel AI SDK HarnessAgent is the best overall choice. It gives the host application one interface across Claude Code, Codex, Deep Agents, OpenCode, and Pi. The value is not that every runtime becomes identical. The value is that streaming, session lifecycle, structured output, UI integration, and sandbox acquisition stop leaking into every product feature.

The rest of the ranking follows the part of the stack you want to own:

  1. Vercel AI SDK HarnessAgent: best overall portability layer
  2. Claude Agent SDK: best complete vendor runtime
  3. OpenAI Codex SDK: best for Codex-native automation
  4. OpenHands Software Agent SDK: best open-source remote stack
  5. OpenCode SDK: best typed client/server surface
  6. Pi: best minimal agent core
  7. fx and libfx: best experimental native and browser embed

The decision rule is blunt. If switching the coding runtime later is strategically valuable, pick Vercel. If one vendor's built-in loop is the product advantage, use Claude or Codex directly. If you need an open remote service, choose OpenHands or OpenCode. If you want to assemble the smallest possible loop, choose Pi. Use fx when native size or browser WebAssembly is the experiment itself, not when a production deadline requires a settled security boundary.

At a glance

Prices and capabilities were verified on August 26, 2026. "Starting price" describes the SDK or open-source package first. Model tokens, compute, storage, and network charges are separate because those costs follow the architecture you deploy.

ToolBest forStarting priceFree trial
Vercel AI SDK HarnessAgentOne TypeScript surface across runtimesOpen source; usage extraPro trial available
Claude Agent SDKComplete Claude Code loop in an appHaiku 4.5 API: $1/$5 per MTok in/outNo SDK trial listed
OpenAI Codex SDKCodex threads and structured automationApache-2.0 SDK; GPT-5.6 Sol $4/$20 per MTok in/outNot applicable to SDK
OpenHands Software Agent SDKOpen Python and remote executionFree, MIT; model and compute extraNot applicable
OpenCode SDKTyped control of an OpenCode serverFree, MIT; model and host extraNot applicable
PiA small, composable agent loopFree, MIT; model and host extraNot applicable
fx and libfxNative, ACP, Node, or browser WASM experimentsFree, Apache-2.0; model and host extraNot applicable
Decision flow matching runtime portability, vendor depth, remote servers, minimal cores, and WebAssembly to seven coding agent harnesses
Pick by the layer your product must own, not by a generic model leaderboard.

What the bill looks like

The SDK license is rarely the budget line that matters. Model output, long context, sandbox lifetime, retries, and human review are. A free package can run an expensive agent, while a paid hosting plan can be the cheaper choice if it removes enough operational work.

Use one common workload to see the order of magnitude. Assume each run consumes 20,000 input tokens and 5,000 output tokens, runs 100 times per working day, and operates for 22 working days. That is 2,200 runs per month. It is an analysis envelope, not a benchmark, and it deliberately excludes caching so the assumptions stay visible.

At current Claude Sonnet 5 API prices of $2 per million input tokens and $10 per million output tokens, the model cost is:

  • Input: 20,000 / 1,000,000 x $2 = $0.04 per run
  • Output: 5,000 / 1,000,000 x $10 = $0.05 per run
  • Total: $0.09 per run, or $198 per month at 2,200 runs

At the current promotional GPT-5.6 Sol price of $4 per million input tokens and $20 per million output tokens, the same envelope is $0.18 per run, or $396 per month. This is not a claim that the two models produce equal work. It shows why the selected model and the agent's tendency to retry can matter more than the library license.

Now add a Vercel Sandbox example. A 1 GB sandbox provisioned for 10 minutes with 2 minutes of active CPU costs about $0.0078 per run at the current $0.128 per active CPU hour and $0.0212 per provisioned GB-hour rates. Across 2,200 runs, that is about $17.16 of gross CPU and memory usage, before data transfer and storage. Vercel Pro costs $20 per month and includes $20 of usage credit, so this particular compute profile fits inside that credit; 2,200 creations add about $0.00132 at the listed $0.60 per million rate. Hobby includes 5,000 creations but is for personal, non-commercial use and cannot buy extra usage.

Three proportional cost meters showing $198 for Sonnet 5, $396 for GPT-5.6 Sol, and $17.16 for Vercel Sandbox under 2,200 monthly runs
Under one stated workload, model choice outweighs gross sandbox CPU and memory usage.

How these were picked

The inclusion bar was programmatic control from a host application through a documented SDK, library, protocol, or server API. A terminal command alone did not qualify. An editor plug-in did not qualify. A benchmark framework or prompt pack did not qualify unless it also exposed a supported product integration surface.

That cut a broad field down to seven options. The largest current inventory names 17 configurations and SDKs, but it combines official runtime SDKs with skill collections, research frameworks, and user-facing products. Seven deeper evaluations are more useful than 17 shallow descriptions because the operational boundary is where these choices diverge.

Each ranked option was checked against five criteria:

  • Embedding contract: what the host can call, stream, resume, and stop
  • Execution boundary: whether code runs in-process, as a subprocess, behind a server, or in a sandbox
  • State ownership: who stores transcripts, working files, credentials, and resume data
  • Policy control: where permissions, tool admission, tenant isolation, and network rules live
  • Exit cost: how much product code survives a runtime or model change

No hands-on product test is claimed. The rankings come from current vendor documentation, current prices, documented security boundaries, and the cost model above. That method favors a boring contract over a spectacular demo because an embedding decision lasts longer than a launch video.

1. Vercel AI SDK HarnessAgent: best overall portability layer

Vercel AI SDK HarnessAgent is the best overall choice for a TypeScript product that wants one application surface across several coding runtimes. AI SDK 7 names Codex, Claude Code, Deep Agents, OpenCode, and Pi, while the lower-level package normalizes sessions, streaming, permissions, skills, compaction, and sandbox access. A concrete fit is a code-review product that starts with Claude Code but wants to evaluate Codex later without rebuilding its chat UI and job lifecycle. The wall is maturity: @ai-sdk/harness is still explicitly experimental, and most bridge-backed adapters require a network sandbox with exposed ports.

Vercel AI SDK HarnessAgent launch page showing a unified API for coding agent runtimes
Vercel AI SDK HarnessAgent

Best for: TypeScript teams that treat runtime portability as product insurance
Standout: AI SDK-compatible generate and stream results across multiple coding runtimes
Pricing: The Apache-2.0 package is open source. Vercel Hobby is $0 per month for personal, non-commercial use; Pro is $20 per month with $20 usage credit and a free trial; Enterprise is custom. Vercel Sandbox usage starts at $0.128 per active CPU hour and $0.0212 per provisioned GB-hour.
Free trial: Vercel offers a free Pro trial; the library itself is open source

The upside
What it does well
5 points

  • One application-facing surface across five named coding runtimes
  • AI SDK-compatible generate and stream outputs can preserve an existing useChat interface
  • Typed schema-backed output and partial structured streams
  • Session detach, stop, destroy, resume preparation, and per-harness MCP support
  • Apache-2.0 license
The downside
Where it falls short
4 points

  • HarnessAgent remains experimental and can introduce breaking changes
  • Claude Code, Codex, OpenCode, and DeepAgents adapters currently need a network sandbox with exposed ports
  • AI SDK 7 requires Node.js 22 and ESM, with no CommonJS require support
  • A common interface does not erase runtime-specific behavior or eval work

The strongest reason to choose Vercel is not convenience. It is negotiation power. If your prompts, UI state, output schema, job records, and evaluation events sit above the adapter, a runtime change is still work, but it stops being a product rewrite. That matters when a provider changes auth policy, a model becomes expensive, or a different loop performs better on your repositories.

The abstraction also has a useful limit. Bridge-backed adapters such as Claude Code, Codex, OpenCode, and DeepAgents need a network sandbox session today, with Vercel Sandbox as the supported choice. Pi can use a host runtime or the just-bash path. This means "portable" does not mean "deploy anywhere with zero changes." It means the application contract is steadier while the runtime recipe stays adapter-specific.

The current @ai-sdk/harness changelog reaches 1.0.67, and 1.0.65 added per-harness MCP servers. Version numbers moving quickly inside an experimental boundary should affect the Monday plan: pin the package, run contract tests before every upgrade, and store raw runtime events for replay.

  1. Write the product contract first

    Define the input, allowed repository scope, required JSON output, cancellation behavior, and maximum budget without naming a runtime. A good first task is a bounded failing-test repair that must return changed files, test status, and a concise risk note.

  2. Start with one adapter

    Install AI SDK 7 in a Node.js 22 ESM service, choose one runtime adapter, and give each session an isolated working directory. Do not build a runtime selector in the UI yet.

  3. Make isolation explicit

    For a bridge-backed adapter, acquire a network sandbox, set the working directory, bootstrap only repeatable dependencies, and destroy or stop the session through the documented lifecycle. Keep credentials outside the agent workspace.

  4. Record the four decision metrics

    For every run, store task completion, permission denials, token usage, and wall-clock time. These are the values that expose whether an adapter swap saves money or only moves failure around.

  5. Replay with a second runtime

    Add one second adapter behind the same product contract and replay the same repository tasks. Keep the first runtime until the second wins on your workload, not on a general benchmark.

2. Claude Agent SDK: best complete vendor runtime

Claude Agent SDK is the strongest direct choice when the full Claude Code loop is the feature, not an implementation detail. It exposes the same agent loop, context management, file tools, command execution, web search, MCP, and permission controls in Python and TypeScript. A security-review service that needs tight permission policy and long, steerable repository sessions gets more finished behavior here than from a minimal loop. The price of that completeness is vendor coupling plus a subprocess and tenant-isolation model the host must operate carefully.

Claude Agent SDK overview documenting the Claude Code agent loop and built-in tools
Claude Agent SDK

Best for: Products whose differentiation depends on Claude Code's built-in loop and tools
Standout: The same agent loop and context management as Claude Code, programmable in Python and TypeScript
Pricing: Usage based. Current Claude API tiers are Fable 5 at $10/$50, Opus 5 at $5/$25, Sonnet 5 at $2/$10, and Haiku 4.5 at $1/$5 per million input/output tokens.
Free trial: No separate Agent SDK trial is listed

The upside
What it does well
4 points

  • Built-in file read, write, edit, command, web, MCP, and permission capabilities
  • Python and TypeScript libraries
  • Session patterns for ephemeral, persistent, and hybrid workloads
  • SessionStore adapters can move transcript state to durable storage
The downside
Where it falls short
4 points

  • Use is governed by Anthropic's Commercial Terms rather than a simple project-wide open-source promise
  • Third-party products generally cannot pass through claude.ai login or rate limits without prior approval
  • Every active session runs in its own subprocess, which shapes concurrency and memory planning
  • SessionStore mirrors transcripts, not working files or CLAUDE.md memory artifacts

Claude is the best choice here when a buyer wants fewer pieces to assemble. The host gets a mature coding loop instead of building tool sequencing, context pressure handling, and permission prompts from primitives. That reduces application code, but it also puts more behavior behind one provider's release train.

Production work begins with process accounting. Anthropic recommends 1 GiB RAM, 5 GiB disk, and 1 CPU per agent as a starting point, not a ceiling. Each session has its own subprocess. A container serving many simultaneous sessions therefore needs a measured per-session memory ceiling and admission control, not a hopeful autoscaling rule.

Durability is another hidden boundary. SessionStore mirrors transcripts to S3, Redis, Postgres, or a custom adapter, but it does not persist CLAUDE.md memory files or the rest of the working directory. Mirror failures emit mirror_error and let the query continue. If a customer expects resumable work, alerting on that event and separately syncing workspace artifacts are product requirements.

Tenant isolation also needs explicit settings. A shared process can otherwise read filesystem settings and memory from the wrong location. The documented production pattern uses a per-tenant configuration directory and working directory, disables automatic memory, clears filesystem setting sources, and enforces egress rules outside the agent. That is the difference between embedding an agent and embedding a data leak.

3. OpenAI Codex SDK: best for Codex-native automation

OpenAI Codex SDK is the cleanest direct route to Codex threads, streamed progress, and schema-constrained repository work. The TypeScript package wraps the Codex CLI and exchanges JSONL over standard input and output, while the Python package starts threads, runs turns, streams progress, and controls workspace access. A release bot that must return a fixed JSON object containing changed files, test status, and a release note is a strong fit. The wall is architectural coupling: the TypeScript SDK spawns a CLI process, and the default workspace policy expects a Git repository.

OpenAI Codex TypeScript SDK README showing embedded threads, streaming, and structured output
OpenAI Codex SDK

Best for: Products already committed to Codex and OpenAI authentication
Standout: Persistent threads with streamed structured events and JSON Schema output
Pricing: The SDK is Apache-2.0. GPT-5.6 Sol API pricing is currently promotional at $4 per million input tokens and $20 per million output tokens.
Free trial: Not applicable to the open-source SDK; model or subscription access is separate

The upside
What it does well
5 points

  • Official TypeScript and Python paths
  • Repeated turns and persisted thread resume
  • Structured JSON Schema output for machine-consumable results
  • Streaming includes tool calls, responses, file changes, and token usage
  • Reuses existing Codex authentication, including ChatGPT or API-key login in Python
The downside
Where it falls short
4 points

  • TypeScript is a CLI subprocess wrapper rather than an in-process agent core
  • Node.js 18+ is required for the TypeScript package
  • Working directories must be Git repositories by default unless the check is explicitly skipped
  • Product behavior stays coupled to Codex rather than a runtime-neutral contract

Codex ranks below Claude only because this comparison rewards a broader built-in hosting story. For a product that already dispatches Codex jobs, it may be the better choice. The API offers the right product primitives: a thread persists conversation state, runStreamed() exposes progress, and output schemas let downstream code reject malformed results instead of parsing prose.

The subprocess architecture is not automatically a flaw. JSONL over stdin and stdout is debuggable, language-neutral at the boundary, and isolates the SDK from much of the CLI's internal churn. It does mean process startup, CLI availability, stdout discipline, and shutdown behavior belong in the production runbook. A web request should not casually become an unbounded child process.

Thread state persists under ~/.codex/sessions in TypeScript. That local default is useful for a developer and dangerous as the only durability plan in an ephemeral container. Map thread IDs to customer jobs, control the Codex home path, and copy the required state into durable storage before an instance disappears.

If the actual decision is how developers use Codex versus Claude Code or Cursor, the Codex vs Claude Code vs Cursor comparison covers that human workflow. This SDK decision is narrower: whether your own application should create and supervise Codex threads.

4. OpenHands Software Agent SDK: best open-source remote stack

OpenHands Software Agent SDK is the best open-source choice when you need both an agent API and a deployable remote execution service. Its Python and REST APIs cover local work, Docker, Kubernetes, virtual machines, on-premises infrastructure, and public cloud, while the Agent Server streams events over WebSocket. A regulated engineering platform can keep workspaces inside its own environment and still expose an OpenAI-compatible endpoint to internal clients. The wall is footprint: client, agent server, workspace isolation, model routing, and persistent storage all become systems you operate.

OpenHands Software Agent SDK documentation showing Python, REST, tools, and remote Agent Server features
OpenHands Software Agent SDK

Best for: Python teams that need an open, self-hosted coding-agent service
Standout: The same conversation API across local, Docker, and remote workspaces
Pricing: Free and MIT-licensed; model, container, network, and storage costs are separate
Free trial: Not applicable; the SDK is free and open source

The upside
What it does well
5 points

  • Purpose-built Python and REST APIs for agents that work with code
  • Bash, file editing, web, and MCP tools are included
  • Agent Server runs in Docker, Kubernetes, virtual machines, on-premises, or public cloud
  • WebSocket event streaming and an OpenAI-compatible endpoint
  • MIT license and support for proprietary or open-source LLMs
The downside
Where it falls short
4 points

  • Larger operating surface than an in-process loop
  • Remote use requires client, server, workspace, and network policy to work together
  • Model and compute bills remain even though the software is free
  • Python is the primary SDK language, which adds a service boundary for TypeScript-only products

OpenHands wins when "self-hosted" must mean more than installing a package on a laptop. The remote architecture has three explicit parts: a Python client, an Agent Server over HTTP and WebSocket, and an isolated workspace. Switching from local execution to Docker or a remote API changes the workspace object while leaving conversation code intact.

That shape is useful for multiple consumers. A browser, IDE, voice system, or another OpenAI-style client can call the compatible endpoint instead of importing Python. The team can put identity, quotas, audit logs, and regional routing at the service boundary. It is the most complete open foundation in this ranking for an internal platform.

Completeness creates a bill in engineer-hours. Someone must patch container images, set workspace limits, rotate runtime keys, monitor WebSocket sessions, and decide how long repositories persist. "MIT" answers the software-license question. It does not answer total cost of ownership.

The choice against Vercel turns on ownership. Vercel gives a TypeScript control plane and a supported managed sandbox path. OpenHands gives source access and deployment freedom, plus more infrastructure to carry. If regulated code placement or model portability is a signed requirement, that extra work can be worth it. If the goal is a small commercial feature next month, it can be a distraction.

5. OpenCode SDK: best typed client/server surface

OpenCode SDK is the best standalone option for a JavaScript or TypeScript host that wants a typed client controlling an explicit OpenCode server. createOpencode() starts both pieces, while createOpencodeClient() connects to a server that already exists. A desktop product or internal developer portal can create sessions, stream events, answer permission requests, run commands, inspect files, and request structured output through generated types. The wall is the same feature that makes it clear: this is a client/server contract, so server lifecycle, port exposure, tenancy, and auth remain host responsibilities.

OpenCode SDK documentation showing the type-safe JavaScript client and local server options
OpenCode SDK

Best for: JavaScript and TypeScript products that want a typed, explicit agent server
Standout: OpenAPI-generated types across session, file, command, permission, and event APIs
Pricing: Free and MIT-licensed; model and server infrastructure are separate
Free trial: Not applicable; the SDK is free and open source

The upside
What it does well
5 points

  • Starts a bundled server and client or connects to an existing server
  • Type-safe API generated from the server's OpenAPI specification
  • Broad control surface for sessions, permissions, shell, files, search, config, and events
  • Validated JSON Schema output with two retries by default
  • MIT license
The downside
Where it falls short
4 points

  • The SDK controls a server rather than embedding a small in-process loop
  • Default localhost configuration is a development convenience, not a multi-tenant security model
  • The host must own server startup, health, upgrades, authentication, and network exposure
  • JavaScript and TypeScript are the documented client path

The local default is deliberately simple: 127.0.0.1, port 4096, and a 5,000 ms startup timeout. Those defaults are useful for an Electron app, local automation, or a developer tool. They should not cross into production unchanged. A server reachable by several tenants needs authentication in front, a per-job workspace policy, and a rule for which shell and file operations are allowed.

OpenCode's strongest product advantage is inspectability. Session creation, prompt submission, abort, sharing, summarization, shell commands, permission responses, file operations, configuration, and event subscription are all visible methods. That makes it easier to build an operator console than a package whose only surface is "send prompt, receive answer."

The direct comparison with OpenHands is language and scope. OpenCode offers a crisp JS/TS client around its server. OpenHands offers a Python-first agent SDK plus a more explicit remote-workspace deployment story. Choose OpenCode when your application already speaks TypeScript and the OpenCode server is the runtime you want. Choose OpenHands when the open agent platform and workspace portability matter more than a TypeScript-native client.

6. Pi: best minimal agent core

Pi is the best option when the product needs a small agent loop more than a finished coding platform. @earendil-works/pi-agent-core provides state, tool execution, event streaming, model switching, steering, follow-up queues, and pre- and post-tool hooks; the wider project also offers a Node.js SDK and JSONL RPC. A specialist code-migration service can define only the tools and events it needs instead of adopting a complete terminal agent. The wall is composition: persistence, coding tools, isolation, and much of the application policy stay with you.

Pi documentation showing its minimal coding harness and programmatic SDK and RPC surfaces
Pi

Best for: Teams that want to design the loop and tool policy themselves
Standout: A stateful core with event streaming and tool hooks, without a forced server architecture
Pricing: Free and MIT-licensed; model, storage, and compute are separate
Free trial: Not applicable; Pi is free and open source

The upside
What it does well
5 points

  • Small stateful core with tool execution and streaming events
  • Programmatic Node.js SDK plus stdin/stdout JSONL RPC
  • Custom providers, subscription auth, API keys, and local llama.cpp routes
  • beforeToolCall and afterToolCall hooks can block or transform tool work
  • Parallel tool execution is the default, with sequential control available
The downside
Where it falls short
4 points

  • The core package does not give you a complete coding-agent deployment
  • SQLite persistence is a separate package
  • Container isolation through Gondolin, Docker, or OpenShell is a separate design choice
  • You must define the tool set, context transform, durability, and policy that larger runtimes include

Pi is attractive because it refuses to decide too much. The core can stream model messages, execute tools, interrupt with steering, queue follow-ups, transform context before a model call, and stop after a turn. That is enough to build a distinctive loop without starting at raw model API calls.

The omission is also the product. The SQLite session backend lives in a separate package so the core avoids a native SQLite dependency. Sandbox guidance lives separately. Tools are caller-defined. A team can keep the runtime small and portable, but every omitted default becomes a design review.

That makes Pi a strong component for a narrow agent. Suppose the service only reads a repository manifest, updates dependency constraints, runs one test command, and returns a signed report. Four carefully constrained tools and one persistence adapter can be safer than a broad general-purpose runtime. The same minimalism is less appealing for an IDE-like product that needs sessions, permissions, skills, terminals, remote workspaces, and a polished operator surface immediately.

Pi also sits behind the Vercel adapter. If the team wants Pi's loop now but may compare other runtimes later, Vercel can own the product-facing contract. If the team wants Pi because it rejects extra abstraction, importing the core directly is the point.

7. fx and libfx: best experimental native and browser embed

fx and libfx are the most interesting experimental choice for a product that needs a native binary, ACP integration, Node embedding, or a coding loop inside a modern browser. The project describes fx as a 7.8 MiB, model-agnostic, Apache-2.0 coding agent, while libfx exposes a headless agent and an interactive terminal through native Node add-ons or WebAssembly. A local-first developer tool that wants one compact native core and a browser demo is the clearest fit. The wall is not subtle: fx is experimental, browser support depends on JSPI, the WASM build omits major native capabilities, and v0.0.5 retired host-command sandbox controls.

Vercel Labs fx repository describing a tiny open embeddable native coding agent
fx and libfx

Best for: Controlled research into compact native, ACP, Node, or browser-based agent products
Standout: One Zig core delivered as a native binary, native Node add-ons, fx-core.wasm, and fx-term.wasm
Pricing: Free and Apache-2.0; model credentials or local compute are separate
Free trial: Not applicable; fx is free and open source

The upside
What it does well
5 points

  • 7.8 MiB native binary and model-agnostic design
  • Native ACP plus headless and interactive JavaScript embedding surfaces
  • Native Node add-ons for Linux and macOS on x64 and arm64
  • Host hooks for fetch, environment, permissions, session stores, OAuth session stores, terminal I/O, and a constrained browser workspace
  • Eligible Codex and Grok subscription login in v0.0.5 for direct end-user use
The downside
Where it falls short
4 points

  • Project and WebAssembly SDK are explicitly experimental
  • Browser WASM needs Chrome or Edge 137+ with JSPI; Node hosts need Node.js 20+
  • WASM omits native processes, OS sandboxing, native MCP servers, subagents, skills, automatic upgrades, arbitrary WASI filesystem access, and public web access
  • v0.0.5 runs approved host commands as ordinary subprocesses and retired sandbox configuration and commands

The release date is why fx belongs in this comparison now. Version 0.0.5 shipped August 21, 2026, adding eligible Codex and Grok subscription login, native workspace skills, provider switching, and several command-approval and credential-storage changes. It also made a breaking decision: approved captured, background, and monitor commands now run as ordinary host subprocesses, and the older sandbox configuration, status fields, and commands are gone.

That is not a footnote. In a desktop product, an approved command now crosses into the host operating system unless the embedding application supplies its own containment. The budget consequence is a new line item for command admission, process limits, workspace boundaries, audit records, and possibly an external sandbox. Teams should not read "permission callback" as "sandbox."

The browser story has a different boundary. libfx requires Chrome or Edge 137 or later and JSPI for browser WebAssembly. The WASM runtime intentionally excludes native processes, OS sandboxing, native MCP servers, subagents or skills, automatic upgrades, arbitrary WASI filesystem access, and public web or general outbound network access. A host can expose a constrained foreground command contract, but the host must admit commands, enforce limits, and bound returned output.

Credential handling matters even in a demo. The documentation says not to put a long-lived API key in public browser code. Use a short-lived credential or an authenticated server-side proxy. If that proxy, workspace adapter, and command policy do not already exist, the browser binary is not the whole product.

The best immediate use is an internal prototype with non-sensitive repositories and a narrow tool policy. The worst is an end-user browser product that ships a long-lived model key, enables a broad command bridge, and assumes the WASM module provides the missing isolation. fx earns a place for architectural range, but its current maturity earns the last rank.

Who should pick what

Pick Vercel AI SDK HarnessAgent when the product must survive a future runtime change. The switch is not free, but one product-facing contract keeps UI, schemas, session records, and evaluation data above the adapter. The choice flips away from Vercel when experimental packages are disallowed or the adapter hides a vendor-specific capability you need.

Pick Claude Agent SDK when the Claude Code loop is the differentiator and the team can operate one subprocess per active session. It is the strongest batteries-included route. The choice flips to Codex when structured Codex threads and existing OpenAI auth are more important, or to Vercel when provider exit is a requirement.

Pick OpenAI Codex SDK when an OpenAI-native system needs persistent threads, streamed machine events, and schema-constrained output. The choice flips away when CLI subprocess management is unwelcome or a runtime-neutral contract matters more than direct access.

Pick OpenHands when several clients need one open coding-agent service under your infrastructure policy. Its client-server-workspace separation is a feature for a platform team. The choice flips to OpenCode for a TypeScript-centric server surface, or to Pi when a remote platform is more system than you need.

Pick OpenCode SDK when the desired unit is an explicit typed client controlling an OpenCode server. It fits local apps and internal portals well. The choice flips away when the application cannot own server lifecycle and network policy.

Pick Pi when a small, composable loop is valuable and the team wants to define tools, state, and policy itself. The choice flips to a fuller runtime when those missing pieces are not differentiators.

Pick fx only when native size, ACP, or browser WebAssembly is the research question. Its current execution and browser boundaries demand more host work than its tiny binary suggests.

For a company-wide deployment rather than a product embed, use the enterprise coding-agent guide. Procurement, identity, audit, and developer adoption will dominate the SDK interface.

The ones to avoid

Avoiding a tool here does not mean it is bad at coding. It means it is the wrong contract for this job.

Cursor as the embedded runtime. Cursor presents a coding agent through its editor, CLI, and team integrations. Those are excellent user surfaces, but the public product surface is not the supported SDK contract evaluated here. Buy Cursor for developers; do not plan a customer-facing product around an embedding interface that is not the product promise.

Aider as a product dependency. Aider is strong terminal pair-programming software and can connect to cloud or local models. A CLI can be automated, but subprocess automation is not the same as a stable, documented embedding contract with session, permission, lifecycle, and output guarantees. Use Aider directly in the terminal. For a product, choose a supported SDK or server API.

SWE-agent for a new integration. The SWE-agent repository now says that mini-SWE-agent has superseded it and generally recommends the newer project. SWE-agent remains useful for research and benchmark reproduction, but beginning a durable product integration on a superseded project is unnecessary migration debt.

Also avoid any wrapper whose only moat is a model name. Models change faster than the session schema, policy boundary, evaluation corpus, and customer workflow around them. The control layer should make those durable assets visible.

The Monday move

Do not start Monday by integrating seven SDKs. Start by writing one runtime-neutral acceptance contract and replaying it twice.

Choose three repository tasks that represent paid customer work:

  • A failing unit test with a bounded fix
  • A dependency upgrade with a migration note
  • A read-only review that must cite exact files and return no patch

For each task, set a repository scope, allowed commands, maximum wall time, maximum token budget, required output schema, and escalation reason. Record completion, test result, files touched, denied tools, token usage, retries, and time to human approval. Run the set first on the likely winner, then on the strongest alternative.

The output is a small decision memo, not a benchmark trophy. If Vercel preserves the product contract and the underlying runtimes remain close, portability wins. If Claude completes the hard tasks with fewer retries, its vendor coupling may pay for itself. If OpenHands meets isolation requirements without an external managed service, operations may accept the larger footprint. If fx requires a custom command sandbox before the first customer, that work belongs in the launch budget now.

FAQ

What is the best coding agent harness for local LLMs?

OpenHands is the best full open-source stack when local models need a remote server and isolated workspace story. Pi is better when you want a small loop and will supply the tools, persistence, and sandbox. fx is model-agnostic too, but its experimental status makes it a research choice rather than the default.

Which coding agent harness has the best benchmark?

No public benchmark settles embedding fitness. A benchmark measures task outcomes under its own tools, prompts, repository set, and limits. Product teams should replay representative repositories under their own permission rules, then compare completion, retries, token spend, and human review time.

Is OpenCode an embeddable coding agent harness?

Yes. OpenCode's documented SDK starts a server and client or connects a typed client to an existing server. Its embedding boundary is therefore client/server rather than an in-process agent loop.

What is the best free embeddable coding agent harness?

OpenHands is the best free, MIT-licensed full stack; Pi is the best free, MIT-licensed minimal core. OpenCode and fx are also open source. "Free" covers the software license, not model tokens, compute, storage, network, or the engineers operating it.

Last Updated

Aug 26, 2026

CategoryBuild
Newsletter

One letter, every Sunday. Working systems, not hot takes.

Build logs, working systems, and field notes from running a portfolio of AI ventures.

Weekly. No spam. Unsubscribe anytime.