agent-wrapper
a wrapper framework for agent runtimes
agent-wrapper is a Go library that provides a single unified programming interface for driving multiple AI coding agent command-line tools. The README is written in Chinese. The problem it addresses is that each coding agent CLI, such as Claude Code, Cursor Agent, Kimi Code, Codex, Pi Agent, and OpenCode, has its own protocol, authentication approach, and output format. This library wraps each one so that your own Go code only needs to interact with one consistent interface regardless of which agent is running underneath.
The core abstraction is an Agent interface backed by a subprocess. When you run a prompt, the library launches the relevant CLI tool as a child process, reads its output stream, and delivers events through a Go channel. Events cover text output, tool calls, tool results, turn boundaries, and errors. There is also a synchronous API that collects all events and returns a single result object when the agent finishes.
The orchestrator layer adds multi-turn conversation management, approval workflows (where your code can decide whether to allow a specific tool call), token budget limits, and context compression for long sessions. Sessions can be resumed across separate program runs using a session ID.
The library covers eight providers at the time of the README: Claude Code, Cursor Agent, Kimi Code, Antigravity, Codex, Pi Agent, OpenCode, and an ACP-protocol provider. A command-line tool is also included for running any supported agent from a terminal with options for streaming output, JSON output, and session resumption.
The README includes a section explaining why the library drives CLI subprocesses directly rather than using the ACP protocol standard, noting that the CLI tools expose more functionality than ACP server implementations typically surface. The project is MIT licensed.