Introducing Chat Agent Relay — Open-Source Chat-to-Agent Middleware
The problem
Teams ship chat-to-agent flows as point-to-point integrations: a Slack webhook into custom code, then OpenAI, then the Slack API. For a demo, that is enough. Then the scope grows: Microsoft Teams, audit logs for compliance, a different LLM, retries when delivery fails. Each new requirement tends to mean another bespoke path through the codebase. What started as a thin glue layer becomes a rewrite every time the platform or vendor changes.
Our approach
Make the chat-to-agent layer explicit. Instead of ad hoc calls between transports and models, Chat Agent Relay centers a canonical event model: the same sequence of events for every message, no matter which channel or backend you use. Pluggable adapters sit on both sides — channels normalize into canonical events; backends consume them and return structured outcomes. Governance and audit are part of the pipeline, not an afterthought: policy runs before the agent, and an append-only ledger records what happened.
What Chat Agent Relay provides today
- Channel adapters: Slack (Socket Mode) and WebChat (HTTP)
- Backend adapters: OpenAI Chat Completions and configurable generic HTTP (custom headers, request/response mapping)
- Policy engine: configurable keyword and regex rules
- Event ledger: append-only store with in-memory and SQLite backends
- Streaming: OpenAI SSE mapped to progressive Slack updates
- Delivery: retry with exponential backoff and a dead-letter queue (DLQ)
- REST API for audit-oriented queries
- Conformance test suite for adapter validation
- 12 packages, 222 tests, TypeScript strict mode
Getting started
From zero to a running server in three commands (fill in .env with your keys as described in the docs):
What’s next
We are focused on widening the adapter surface and hardening the core:
- More channel and backend adapters (Teams, Discord, Claude, and others)
- A richer policy engine for routing and safety
- Multi-tenant routing and isolation patterns
- Community contributions: issues, adapters, and specs welcome on GitHub
Try it
Chat Agent Relay is MIT licensed. Star the repo if it is useful, run through Getting Started, and share the project with your team.