spawn-agent: An adapter that treats local coding agents like Vercel AI SDK models
Key point
It's an ACP adapter that treats local coding agents like Vercel AI SDK models.
Details
This is an adapter that spawns several local coding agents (Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Factory Droid, Pi) as child processes and hides them behind the Vercel AI SDK's LanguageModelV3 interface.
Communication uses ACP (Agent Client Protocol) as-is, exchanging NDJSON JSON-RPC messages over stdin/stdout. It's structured as a pnpm monorepo, with the library core separated from the demo/test workspaces.
- Compatibility scope: CLIs that speak ACP directly, like Cursor, Copilot, Gemini, OpenCode, Droid, and Pi, connect as-is. Claude Code and Codex are each absorbed into the same interface via their own conversion packages.
- Session modes: It offers both a one-shot mode that spawns a new process on every call, and a session mode that maintains an ACP session with the child process to preserve conversation memory. The session object implements
AsyncDisposable. - Process management: Only the last segment of stderr is kept, and non-NDJSON lines mixed into stdout are moved to stderr. Termination follows SIGTERM with a 2-second grace period, then SIGKILL, and includes a 3-minute inactivity watchdog and pattern recognition for auth failures and usage limits.
- Permission/capability negotiation: It supports
auto-allow,auto-allow-once,auto-reject,streampresets, and custom permission handlers. Filesystem, terminal, and additional working directories are only advertised as capabilities when the host provides them. - Errors/testing: 16 error types are classified by tag under parent classes, and abnormal exits carry the exit code, signal, and a portion of stderr together. Testing is divided into 27 areas including initialization, permissions, cancellation, concurrent sessions, wire fuzzing, and watchdog.
- Current status: Both the root and package versions are
0.0.1, and it requiresai@^6.0.0, Node 22+, and pnpm 8+.
In short, it's a practical adapter that ties existing coding CLIs together with ACP and exposes them through the model interface familiar to AI SDK users.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.