API / OSS · CASE STUDY

Agent2API.

Call local agents from the APIs you already know.

Agent2API draws a clear API boundary between local AI agent CLIs and the applications that call them. It accepts HTTP requests and delegates execution to headless_core.

TypeScriptFastifyOpenAI-compatible APIheadless_core
APP / OPENAI SDK
Agent2API → headless_core
Codex CLI
Claude CLI
Grok CLI
SIMPLIFIED ARCHITECTURE
CONCEPT VISUAL / SCHEMATIC
01 / PROBLEM FRAMING

What problem does it solve?

I wanted to run authenticated local agent CLIs through the same interface existing LLM SDKs already use. The design separates the API from the execution backend.

02 / DESIGN DECISIONS

What I chose, and how I built it.

DESIGN NOTE / 01

Use existing SDKs

Implements OpenAI-compatible endpoints, among others.

DESIGN NOTE / 02

Separate the API from agent execution

Dependencies between the transport layer, core, and backend are deliberately organized.

DESIGN NOTE / 03

Don't reimplement CLI auth

Uses CLIs already installed and authenticated in the local environment.

DESIGN NOTE / 04

Pin the execution environment

Settings like the working directory live on the server and can't be changed directly by API requests.

03 / HOW IT WORKS

The big picture.

LLM-compatible HTTP request→Agent2API HTTP Host→headless_core→Authenticated agent CLI
A simplified concept diagram for clarity. See the source code for exact implementation details.

For technical details, the README and source code in the public repository are the primary source.

Read the README and code on GitHub ↗
04 / STATUS & LIMITATIONS

Status and caveats.

According to the README, the npm package hasn't been published yet. Local CLI setup is required. Make sure you understand how paths, permissions, and logs are handled before using it.

Want to try it?

This page is an introduction. Installation steps, requirements, license, and the latest status are in the public repository.

Check out Agent2API on GitHub ↗