Conversational AI Agents
Multi-tenant conversational AI agents in a TypeScript monorepo — Hono gateway, LangGraph.js with Postgres checkpointing, MCP, tracing and evals.
One of the four lines of my Independent AI & Full-Stack Engineer (Freelance) work: multi-tenant conversational AI agents built in a TypeScript monorepo. The architecture is designed so that many tenants share one agent platform while their data, configuration and conversations stay isolated, and so that every run can be traced, replayed and evaluated.
Architecture
- Gateway — Hono. A thin, fast HTTP gateway is the single entry point. It authenticates the caller, resolves the tenant, and passes the request to the agent runtime with tenant context attached. Keeping this layer small means channels and clients can change without touching agent logic.
- Agent runtime — LangGraph (LangGraph.js). Conversations are modelled as explicit graphs: nodes for reasoning, Tool Calling and routing, with edges that make control flow visible and testable. This is Agent Orchestration as code rather than prompt glue, and it scales naturally to Multi-Agent Systems setups.
- State — Postgres checkpointing. Graph state is checkpointed to PostgreSQL after each step. A conversation can resume after a restart, and any thread can be inspected after the fact — the core of Durable Execution.
- Tools — an MCP (Model Context Protocol) server. Business capabilities are exposed through a Model Context Protocol server instead of being hard-coded into the agent, so the same tools can be reused by other agents and clients and versioned independently.
- Observability — Langfuse and OpenTelemetry. Every model call, tool call and graph step is traced, giving latency, token usage and failure points per tenant and per conversation (Observability).
- Quality — automated Evals. Evaluation suites run against representative conversations so prompt, model or graph changes are measured before they ship, instead of judged by feel.
Why these choices
The monorepo keeps the gateway, agent graphs, MCP tools and eval suites typed against shared contracts. Explicit graphs plus checkpointing contain the non-deterministic parts of LLMs inside a deterministic, inspectable structure — the same principles behind my open-source Akashi framework and my langgraph-ts-agents lab.
Related
- Independent AI & Full-Stack Engineer (Freelance) · Ale Zanello
- LangGraph, MCP (Model Context Protocol), Multi-Agent Systems, Evals, Langfuse
- mcp-deep-dive — protocol-level study of MCP