Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e4c2197
docs: add changelog system process and make check target
KooshaPari Feb 23, 2026
9dee3f7
fix(agentapi): address audit gaps - bounds check, msgfmt whitespace, …
KooshaPari Feb 23, 2026
a4ac478
fix(agentapi++-chat): fix TypeScript errors in message-input and drag…
KooshaPari Feb 23, 2026
29b04d4
fix: apply formatting and modernize test structure
KooshaPari Feb 23, 2026
8820eff
chore: add docs and fix tests
KooshaPari Feb 23, 2026
af3c1a6
docs: add canonical files (CHANGELOG, WORKLOG, PRD, SPEC)
KooshaPari Feb 23, 2026
f9cfe5d
feat: initial agentapi with Bifrost extension
KooshaPari Feb 23, 2026
632c967
fix: resolve build errors in agentapi
KooshaPari Feb 23, 2026
885beb0
test: add comprehensive unit tests for routing and server packages
KooshaPari Feb 23, 2026
df331eb
chore: add vitepress theme
KooshaPari Feb 23, 2026
3df10d5
chore: add github workflows
KooshaPari Feb 23, 2026
462a925
docs: update README with comprehensive agentapi description
KooshaPari Feb 23, 2026
53d4e72
docs: update README with fork details
KooshaPari Feb 23, 2026
f1b4b78
docs: update README with trace structure
KooshaPari Feb 23, 2026
6927667
docs: update README with trace structure
KooshaPari Feb 23, 2026
f22eb09
feat: merge sdk from agentapi repo
KooshaPari Feb 23, 2026
f0b75f3
Merge: reconcile agentapi changes into agentapi++
KooshaPari Feb 23, 2026
02dddc1
docs: update AGENTS.md with deprecation note for agentapi
KooshaPari Feb 23, 2026
249f8a7
Add comprehensive Python SDK with native classes (not just HTTP wrapp…
KooshaPari Feb 23, 2026
7848d9d
docs: vitepress updates
KooshaPari Feb 23, 2026
1247de8
docs: add AGENTS.md with trace format
KooshaPari Feb 23, 2026
d9539be
docs: add comprehensive README with all agents, SDKs, architecture
KooshaPari Feb 23, 2026
acdaaf5
docs: rewrite README with trace format
KooshaPari Feb 23, 2026
a1af972
feat: add agent lifecycle endpoints
KooshaPari Feb 23, 2026
f414cb6
feat: add pagination to GET /messages endpoint
KooshaPari Feb 24, 2026
85cf377
feat: add /config endpoint
KooshaPari Feb 24, 2026
3372374
feat: add DELETE /messages to clear conversation history
KooshaPari Feb 24, 2026
d6b99b8
feat: add rate limiting endpoint
KooshaPari Feb 24, 2026
fe9ad00
feat: add logging endpoint
KooshaPari Feb 24, 2026
3ce9069
feat(e2e: add asciinema recording parser for testing (#2)
KooshaPari Feb 24, 2026
7eecd0a
fix: screenDiff wrong content for AgentTypeOpencode (#3)
KooshaPari Feb 24, 2026
c4ab52a
feat: pagination for messages endpoint (#4)
KooshaPari Feb 24, 2026
b81d637
feat: auto-skip status check for AskUserQuestion prompts (#5)
KooshaPari Feb 24, 2026
153693c
fix: use fs.WalkDir instead of afero.Walk for embed.FS (#6)
KooshaPari Feb 24, 2026
3019806
test: add initial prompt tests and fix whitespace handling (#7)
KooshaPari Feb 24, 2026
f0a87a7
feat: add slash command support (#8)
KooshaPari Feb 24, 2026
1ec1463
feat: add /info endpoint for agent info (#9)
KooshaPari Feb 24, 2026
fbb603f
test: add tests for first line preservation (#10)
KooshaPari Feb 24, 2026
62b6944
feat: add API key generation endpoint (#17)
KooshaPari Feb 24, 2026
ae54b27
feat: test coverage placeholder (#18)
KooshaPari Feb 24, 2026
9843f48
feat: add /health endpoint for load balancer probes (#11)
KooshaPari Feb 24, 2026
9314867
Merge
KooshaPari Feb 24, 2026
296d411
feat: add /config endpoint (#12)
KooshaPari Feb 24, 2026
f1f43ee
feat: add /version endpoint (#13)
KooshaPari Feb 24, 2026
c104df8
feat: add /messages/count endpoint (#14)
KooshaPari Feb 24, 2026
672f6c4
feat: add /ready endpoint for Kubernetes (#16)
KooshaPari Feb 24, 2026
859bfbc
Merge
KooshaPari Feb 24, 2026
b81e023
feat: add rate limiting endpoint (#19)
KooshaPari Feb 24, 2026
4fb776a
Merge
KooshaPari Feb 24, 2026
cacd4d3
feat: add logging endpoint (#20)
KooshaPari Feb 24, 2026
7d94f62
Merge
KooshaPari Feb 24, 2026
1bc5ee9
feat: add DELETE /messages to clear history (#15)
KooshaPari Feb 24, 2026
d03c783
Add ADR for compliance
KooshaPari Feb 24, 2026
c11b3ff
Add GitHub Pages deploy to docs workflow
KooshaPari Feb 24, 2026
81c13ac
chore: update gitignore and docs
KooshaPari Feb 25, 2026
c10fcb5
fix: update vitepress config to use shared base config
KooshaPari Feb 25, 2026
3ba2d87
Merge fix/feature19 into fix/feature20 - combine Logs and RateLimit e…
KooshaPari Feb 25, 2026
c148241
Resolve: keep fix/feature20 version (has Logs + RateLimit)
KooshaPari Feb 25, 2026
d3953b7
Merge fix/pr15 into fix/feature20 - combine all API endpoints
KooshaPari Feb 25, 2026
fa30db3
Merge fix/config-endpoint - add /config endpoint
KooshaPari Feb 25, 2026
c3865c4
Merge fix/feature20 - combine all API endpoints from multiple branches
KooshaPari Feb 25, 2026
306e579
feat: Add benchmarks module with tokenledger integration
KooshaPari Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
60 changes: 60 additions & 0 deletions .github/workflows/docs-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Docs Site

on:
push:
branches: [main]
paths:
- 'docs/**'
- '.github/workflows/docs-site.yml'
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs-site.yml'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
docs-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: docs/package.json

- name: Install deps
working-directory: docs
run: npm install

- name: Build docs
working-directory: docs
run: npm run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
needs: docs-build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
60 changes: 60 additions & 0 deletions .github/workflows/generate-sdks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generate All SDKs

on:
push:
branches: [main]
paths:
- 'api/openapi.yaml'
- 'internal/**/*.go'
workflow_dispatch:

jobs:
generate-sdks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Install generators
run: |
npm install @openapitools/openapi-generator-cli -g
pip install openapi-python-client

- name: Generate Python SDK
run: |
openapi-generator generate -i api/openapi.yaml -g python -o sdk/python --package-name agentapi

- name: Generate TypeScript SDK
run: |
openapi-generator generate -i api/openapi.yaml -g typescript-fetch -o sdk/typescript

- name: Generate Go SDK
run: |
openapi-generator generate -i api/openapi.yaml -g go -o sdk/go

- name: Generate Rust SDK
run: |
openapi-generator generate -i api/openapi.yaml -g rust -o sdk/rust

- name: Commit and push
run: |
git add sdk/
git commit -m "chore: generate all SDKs" || echo "No changes to commit"
git push
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ out


#IDEs
.idea
.idea__pycache__/
*.pyc

# Python
__pycache__/
*.pyc
*.pyo
.pytest_cache/
13 changes: 13 additions & 0 deletions ADR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Architecture Decision Records

## ADR-001: Agent API Platform

**Status**: Accepted

**Context**: Build unified agent API platform.

**Decision**: Use FastMCP + provider pattern.

**Consequences**:
- Positive: Unified interface
- Positive: Extensible providers
179 changes: 103 additions & 76 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,111 @@

This file provides guidance to AI agents working with code in this repository.

## Build Commands

- `make build` - Build the binary to `out/agentapi` (includes chat UI build)
- `make embed` - Build the chat UI and embed it into Go
- `go build -o out/agentapi main.go` - Direct Go build without chat UI
- `go generate ./...` - Generate OpenAPI schema and version info

## Testing

- `go test ./...` - Run all Go tests
- Tests are located alongside source files (e.g., `lib/httpapi/server_test.go`)

## Development Commands

- `agentapi server -- claude` - Start server with Claude Code agent
- `agentapi server -- aider --model sonnet` - Start server with Aider agent
- `agentapi server -- goose` - Start server with Goose agent
- `agentapi server --type=codex -- codex` - Start server with Codex (requires explicit type)
- `agentapi server --type=gemini -- gemini` - Start server with Gemini (requires explicit type)
- `agentapi attach --url localhost:3284` - Attach to running agent terminal
- Server runs on port 3284 by default
- Chat UI available at http://localhost:3284/chat
- API documentation at http://localhost:3284/docs

## Architecture

This is a Go HTTP API server that controls coding agents (Claude Code, Aider, Goose, etc.) through terminal emulation.

**Core Components:**
- `main.go` - Entry point using cobra CLI framework
- `cmd/` - CLI command definitions (server, attach)
- `lib/httpapi/` - HTTP server, routes, and OpenAPI schema
- `lib/screentracker/` - Terminal output parsing and message splitting
- `lib/termexec/` - Terminal process execution and management
- `lib/msgfmt/` - Message formatting for different agent types (claude, goose, aider, codex, gemini, amp, cursor-agent, cursor, auggie, custom)
- `chat/` - Next.js web UI (embedded into Go binary)

**Key Architecture:**
- Runs agents in an in-memory terminal emulator
- Translates API calls to terminal keystrokes
- Parses terminal output into structured messages
- Supports multiple agent types with different message formats
- Embeds Next.js chat UI as static assets in Go binary

**Message Flow:**
1. User sends message via HTTP API
2. Server takes terminal snapshot
3. Message sent to agent as terminal input
4. Terminal output changes tracked and parsed
5. New content becomes agent response message
6. SSE events stream updates to clients

## API Endpoints

- GET `/messages` - Get all messages in conversation
- POST `/message` - Send message to agent (content, type fields)
- GET `/status` - Get agent status ("stable" or "running")
- GET `/events` - SSE stream of agent events
- GET `/openapi.json` - OpenAPI schema
- GET `/docs` - API documentation UI
- GET `/chat` - Web chat interface
## Quick Start

## Supported Agents
```bash
# Development
go build -o agentapi ./cmd/agentapi

# Testing
go test ./...

# Linting
go fmt ./...
go vet ./...
```

## Environment

```bash
# Required environment variables
export CLIPROXY_URL="http://localhost:8317"
export AGENTAPI_PORT="8318"
```

---

## Development Philosophy

### Extend, Never Duplicate

- NEVER create a v2 file. Refactor the original.
- NEVER create a new class if an existing one can be made generic.
- NEVER create custom implementations when an OSS library exists.
- Before writing ANY new code: search the codebase for existing patterns.

### Primitives First

- Build generic building blocks before application logic.
- A provider interface + registry is better than N isolated classes.
- Template strings > hardcoded messages. Config-driven > code-driven.

Agents with explicit type requirement (use `--type=<agent>`):
- `codex` - OpenAI Codex
- `gemini` - Google Gemini CLI
- `amp` - Sourcegraph Amp CLI
- `cursor` - Cursor CLI
### Research Before Implementing

Agents with auto-detection:
- `claude` - Claude Code (default)
- `goose` - Goose
- `aider` - Aider
- Check pkg.go.dev for existing libraries.
- Search GitHub for 80%+ implementations to fork/adapt.

## Project Structure
---

## Library Preferences (DO NOT REINVENT)

| Need | Use | NOT |
|------|-----|-----|
| HTTP router | chi | custom router |
| Logging | zerolog | fmt.Print |
| CLI | cobra | manual flag parsing |
| Config | viper | manual env parsing |

---

## Code Quality Non-Negotiables

- Zero new lint suppressions without inline justification
- All new code must pass: go fmt, go vet, golint
- Max function: 40 lines
- No placeholder TODOs in committed code

---

## Verifiable Constraints

| Metric | Threshold | Enforcement |
|--------|-----------|-------------|
| Tests | 80% coverage | CI gate |
| Lint | 0 errors | golangci-lint |

---

## Supported Agents

- Go module with standard layout
- Chat UI in `chat/` directory (Next.js + TypeScript)
- OpenAPI schema auto-generated to `openapi.json`
- Version managed via `version.sh` script
| Agent | Type | Status |
|-------|------|--------|
| Claude Code | claude | ✅ |
| Amazon Q | amazon-q | ✅ |
| Opencode | opencode | ✅ |
| Goose | goose | ✅ |
| Aider | aider | ✅ |
| Gemini CLI | gemini | ✅ |
| GitHub Copilot | github-copilot | ✅ |
| Sourcegraph Amp | amp | ✅ |
| Codex | codex | ✅ |
| Auggie | auggie | ✅ |
| Cursor | cursor | ✅ |

---

## Kush Ecosystem

This project is part of the Kush multi-repo system:

```
kush/
├── thegent/ # Agent orchestration
├── agentapi++/ # HTTP API for coding agents (this repo)
├── cliproxy++/ # LLM proxy with multi-provider support
├── tokenledger/ # Token and cost tracking
├── 4sgm/ # Python tooling workspace
├── civ/ # Deterministic simulation
├── parpour/ # Spec-first planning
└── pheno-sdk/ # Python SDK
```
20 changes: 20 additions & 0 deletions ARCHIVED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# AgentAPI++ — ARCHIVED

This project has been superseded by thegent architecture and is no longer maintained.

## Why Archived

- thegent provides unified agent orchestration with MCP protocol
- AgentAPI++ was designed for single-agent, proxy-based execution
- thegent supports multi-agent, decentralized coordination

## Historical Reference

- **Repository:** `/kush/agentapi++/` (read-only)
- **Replacement:** `thegent/` with thegent-cli, thegent-agents, thegent-mcp sub-projects

For current development, use thegent.

---

**Archived:** 2026-02-22
Loading