projects / agentforge
agentforge
An Express + TypeScript service that exposes an LLM-backed agent with streaming, tool use, prompt caching, and an eval harness. The Node-side companion to tinybus and collab-board: same observability shape, different problem domain. Built to demonstrate that I can ship a production-quality Node API with the patterns most agent backends actually need.
Overview
Highlights
- POST /v1/chat streams typed AgentEvents over SSE: iteration_start, text_delta, tool_call, tool_result, usage, done
- Agent loop implemented as an async generator. The same generator drives both the HTTP route and the eval harness
- Tool registry with per-tool Zod input schemas; invalid output is fed back to the model as a structured error rather than thrown
- Built-in tools: fetch_url (with private-IP / loopback guards) and search_docs (local fixture-backed knowledge base)
- Prompt caching via cache_control: ephemeral on system prompt + tool definitions; cache hits visible at /metrics
- Postgres persistence for sessions and messages with raw SQL migrations and a small migration runner, no ORM
Stack
- TypeScript
- Node.js
- Express
- Backend
- AI
- LLM APIs
- SSE
- Postgres
- Docker
- Railway