Skip to content

feat(server): OpenAI-compatible serve path for forged agents#22

Merged
writeameer merged 1 commit into
mainfrom
feat/forge-agent-serve
May 30, 2026
Merged

feat(server): OpenAI-compatible serve path for forged agents#22
writeameer merged 1 commit into
mainfrom
feat/forge-agent-serve

Conversation

@writeameer
Copy link
Copy Markdown
Contributor

Add forge-agent: an executable that serves forge Agents behind a local OpenAI-compatible endpoint, so an existing host CLI (Codex, Grok Build) can point at it via OPENAI_BASE_URL and run "warm from prompt 1" — the Engine owns the loop and the agent's scaffold is the system prompt.

  • server/: http.Handler implementing GET /v1/models, POST /v1/chat/completions, and POST /v1/responses (Codex speaks the Responses API, not Chat Completions), both with SSE streaming. Translates OpenAI <-> forge messages.
  • Request-body decompression (zstd/gzip) via Content-Encoding + magic-byte sniffing — Codex ships the body zstd-compressed, which was the real failure.
  • Default-agent fallback: host GUIs send their own model ids (e.g. "gpt-5.5") that aren't agent names; unknown models resolve to a configured default agent instead of 404.
  • Request logging for live debuggability of host-CLI integration.
  • cmd/forge-agent: wires the north-star demo agents (vanilla_reviewer vs forged_reviewer) and serves them.
  • scripts/: serve.ps1 (launch) + demo.sh (curl driver).
  • Tests cover models/chat/responses, streaming, content-array + string inputs, zstd-encoded bodies, and the default-agent fallback.

Validated live end-to-end through the real Codex CLI and GUI.

Add `forge-agent`: an executable that serves forge Agents behind a local
OpenAI-compatible endpoint, so an existing host CLI (Codex, Grok Build) can
point at it via OPENAI_BASE_URL and run "warm from prompt 1" — the Engine owns
the loop and the agent's scaffold is the system prompt.

- server/: http.Handler implementing GET /v1/models, POST /v1/chat/completions,
  and POST /v1/responses (Codex speaks the Responses API, not Chat Completions),
  both with SSE streaming. Translates OpenAI <-> forge messages.
- Request-body decompression (zstd/gzip) via Content-Encoding + magic-byte
  sniffing — Codex ships the body zstd-compressed, which was the real failure.
- Default-agent fallback: host GUIs send their own model ids (e.g. "gpt-5.5")
  that aren't agent names; unknown models resolve to a configured default agent
  instead of 404.
- Request logging for live debuggability of host-CLI integration.
- cmd/forge-agent: wires the north-star demo agents (vanilla_reviewer vs
  forged_reviewer) and serves them.
- scripts/: serve.ps1 (launch) + demo.sh (curl driver).
- Tests cover models/chat/responses, streaming, content-array + string inputs,
  zstd-encoded bodies, and the default-agent fallback.

Validated live end-to-end through the real Codex CLI and GUI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@writeameer writeameer merged commit 14a3601 into main May 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant