Spawn Agent

An npm package that makes any locally-installed coding agent a Vercel AI SDK providerspawnAgent("claude") drops Claude Code, Codex, Cursor, Copilot CLI, Gemini, OpenCode, Factory Droid, or Pi straight into streamText/generateText, streamed over the Agent Client Protocol (ACP). One package, eight agents, one API surface. Source: millionco/spawn-agent, https://github.com/millionco/spawn-agent, 2026-06-12

By Aiden Bai (@aidenybai, Million.co — also Security and Review Skills and react-scan). The problem it removes: every time you want to drive claude or codex programmatically you otherwise hand-roll subprocess management and per-CLI stream parsing. spawn-agent normalizes all of that behind the current AI SDK provider spec (LanguageModelV3, with both doGenerate and doStream), so a local agent slots into any existing AI SDK workflow. Source: codeline.co repo review, 2026-04

Usage

import { streamText } from "ai";
import { spawnAgent } from "spawn-agent";   // npm install spawn-agent ai

const { textStream } = streamText({
  model: spawnAgent("claude"),
  prompt: "Refactor src/auth.ts to use the new session API",
});

Pass settings inline or pre-build a provider with createSpawnAgent; use createSpawnAgentSession for stateful multi-turn sessions that keep the agent's memory across calls. Options include cwd, permission (e.g. auto-allow), mcpServers, additionalDirectories, systemPrompt, and inactivityTimeoutMs. Source: millionco/spawn-agent README, 2026-06-12

Supported agents

ID Agent ACP
claude Claude Code via @agentclientprotocol/claude-agent-acp shim (peer dep)
codex Codex via @zed-industries/codex-acp
cursor Cursor Agent native
copilot GitHub Copilot CLI native
gemini Gemini CLI native
opencode OpenCode native
droid Factory Droid native
pi Pi native

Custom ACP subprocesses integrate via spawnAgent.fromAdapter(...). Source: GeekNews/AIsle summary, 2026

How it compares

Tool Layer Stance
spawn-agent AI SDK provider over ACP Community (Aiden Bai); 8 agents; LanguageModelV3
AI SDK HarnessAgent First-party Vercel embed API Vercel; session + sandbox + stream; Claude Code/Codex/Pi
Cursor multi-agent IDE-native parallel agents In-editor fan-out

spawn-agent and Vercel's HarnessAgent are the two answers to the same question — embed coding agents in app code without re-implementing each CLI — one via the open Agent Client Protocol, the other as a Vercel-blessed adapter. Both are the application-layer complement to Harness Engineering's "harness portability": write the integration once, swap the harness as the ecosystem moves. spawn-agent shipped v0.0.1 on 2026-04-26 with 26 test files. Source: codeline.co, 2026-04

Source snapshot

Deep review on 2026-07-03 confirmed the local screenshot shows the exact AI SDK surface: spawnAgent("claude") passed into streamText, then async chunks written from textStream. Current public source is still the first npm release:

  • npm spawn-agent@0.0.1, MIT, published 2026-04-26.
  • Repo millionco/spawn-agent, HEAD f0769c6209876059ec524b436ba606710ee9df6f, no tags returned by git ls-remote.
  • GitHub metadata: 167 stars, 9 forks, default branch main.
  • ACP adapters checked: @agentclientprotocol/claude-agent-acp@0.55.0; @zed-industries/codex-acp@0.16.0.

This remains a candidate integration primitive rather than an installed default. Use it when an app needs to call local coding agents through the AI SDK; for ordinary Codex/Claude workflows, use the harness directly.


Timeline