Purpose
agent-express is a backend-oriented AI agent development framework, positioned as a fast, minimal agent framework in the TypeScript ecosystem. It brings the Express.js middleware pattern into AI agent development, allowing developers familiar with Express to build agents using their existing mental model.
Core Concepts
The framework has only three concepts: Agent, Session, and Middleware. It is officially stated that a single (ctx, next) interface can replace the 15-20 concepts commonly found in other solutions.
Main Capabilities
- Middleware architecture: provides 5 onion-style hooks—agent, session, turn, model, tool—all using the unified (ctx, next) pattern. Code before next() runs down the call chain, and code after it runs back up the call chain.
- Built-in guards: budget caps, input/output validation, timeouts, iteration limits, HITL (human-in-the-loop) approval.
- Observability: structured logs, OpenTelemetry metrics and tracing, token statistics, tool call records.
- Model providers: supports more than 12 model providers; any AI SDK provider can be integrated via a "provider/model" string, including Anthropic, OpenAI, Google, Mistral, Groq, and others.
- Model routing: can select models across providers based on task complexity.
- Memory management: provides 5 context window compaction strategies.
- Testing toolkit: TestModel, FunctionModel, capture, record/replay, snapshots.
- MCP integration: can integrate MCP servers as a tool source.
- HTTP adapter: out-of-the-box SSE streaming output.
- CLI: agent-express dev supports hot reload, and agent-express test provides CI output formats.
- Structured output: Zod schema validation for model responses.
Usage
- Writing custom middleware: an ordinary function passed to .use() becomes a turn hook; if multiple hooks are needed, return a Middleware object.5 hooks form an onion model.
- Sessions and streaming: supports multi-turn conversations with session state and can iteratively output typed events; the same Event object flows through both the iterator and session.events, so the streaming view and the persisted log share the same source of truth. Sessions can be persisted to SQLite, Redis, or Postgres via an adapter package; if a run crashes midway, the next session run after restart will recover from the event log.
- Testing: simulate LLM calls via agent-express/test; you can also record and replay real API calls.
- Documentation entry points: the official documentation includes Documentation, Getting Started, and API Reference; the recommended reading order for architecture and design documents is Concept, Middleware Interface, Agent Loop, Event Log.
Use cases
Suitable for developers who need to build, orchestrate, and operate AI agents in a TypeScript backend way, especially teams already familiar with the Express middleware pattern, hoping to complete agent development with fewer concepts, and needing observability and guardrail capabilities.
Limitations
This material does not provide specific pricing models, prices, platform support scope, performance data, installation command details, or version compatibility information; these contents are not yet provided.