Skip to content

coder/agentapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentAPI

Control Claude Code, Goose, and Aider with an HTTP API.

Quickstart

Install agentapi by downloading the latest release binary from the releases page and putting it in your PATH.

Run a Claude Code server (assumes claude is installed on your system):

agentapi server -- claude

Send a message to the agent:

curl -X POST localhost:3284/message \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello, agent!", "type": "user"}'

Get the conversation history:

curl localhost:3284/messages

CLI Commands

agentapi server

Run an HTTP server that lets you control an agent. If you'd like to start an agent with additional arguments, pass the full agent command after the -- flag.

agentapi server -- claude --allowedTools "Bash(git*) Edit Replace"

You may also use agentapi to run the Aider and Goose agents:

agentapi server -- aider --model sonnet --api-key anthropic=sk-ant-apio3-XXX 
agentapi server -- goose

By default, the server runs on port 3284. The server exposes an OpenAPI schema at http://localhost:3284/openapi.json. You may also inspect the available endpoints at http://localhost:3284/docs.

There are 4 endpoints:

  • GET /messages - returns a list of all messages in the conversation with the agent
  • POST /message - sends a message to the agent. When a 200 response is returned, AgentAPI has detected that the agent started processing the message
  • GET /status - returns the current status of the agent, either "stable" or "running"
  • GET /events - an SSE stream of events from the agent: message and status updates

agentapi attach

Attach to a running agent's terminal session.

agentapi attach --url localhost:3284

Press ctrl+c to detach from the session.

How it works

AgentAPI runs an in-memory terminal emulator. It translates API calls into appropriate terminal keystrokes, and parses the agent's outputs into individual messages. At the time of writing, none of the agents expose a native HTTP API. Once they do, AgentAPI will be updated to support them.

About

HTTP API for Claude Code, Goose, Aider, Gemini, and Codex

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •