A pluggable service that connects LLM agents to users across Slack, Email, and Discord channels. Agent Router provides a unified interface for routing messages, maintaining conversation context, and forwarding communication between channels and agent backends.
This repository contains both Python and JavaScript implementations:
The core Agent Router service built with FastAPI and Redis.
- Package:
agent-routeron PyPI - Install:
pip install agent-router - Use Case: Running the Agent Router service, building agent backends
- Documentation: py/README.md
TypeScript client library and React components for integrating with Agent Router.
- Package:
@agent-router/clienton npm - Install:
npm install @agent-router/client - Use Case: Building web UIs, integrating with React apps, API client
- Documentation: js/README.md
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Slack │ │ Email │ │ Discord │
│ Webhook │ │ IMAP/SMTP │ │ Bot │
└─────┬───────┘ └──────┬───────┘ └─────┬───────┘
│ │ │
└───────────────────┼──────────────────┘
│
┌─────▼─────┐
│ Agent │
│ Router │ ← py/ package
│ (FastAPI) │
└─────┬─────┘
│
┌──────────────────────┼──────────────────────┐
│ │ │
│ ┌─────────▼─────────┐ │
│ │ Redis │ │
│ │ Memory Store │ │
│ └───────────────────┘ │
│ │
│ ┌─────────────┐ ┌───────────────┐
│ │ Your │ │ Web App │
│ │ Agent │ │ (js/ client) │ ← js/ package
│ │ Backend │ │ │
│ │ (REST API) │ │ ┌─────────┐ │
│ └─────────────┘ │ │ Chat UI │ │
│ │ └─────────┘ │
└───────────────────────────────┴───────────────┘
# Install the Python package
pip install agent-router
# Start Redis
redis-server
# Set environment variables
export AGENT_ROUTER_AGENT_URL="http://localhost:8001"
export AGENT_ROUTER_REDIS_URL="redis://localhost:6379"
# Start the service
agent-router serve --host 0.0.0.0 --port 8000# Install the JavaScript client
npm install @agent-router/clientimport { createDefaultClient, AgentChat } from '@agent-router/client';
// Create API client
const client = createDefaultClient('http://localhost:8000');
// Use in React app
function App() {
return (
<AgentChat
client={client}
threadId="my-thread"
channelType="slack"
/>
);
}agent-router/
├── LICENSE # MIT License
├── README.md # This file
├── py/ # Python package
│ ├── agent_router/ # Python source code
│ │ ├── core/ # Core routing and schema
│ │ ├── adapters/ # Channel adapters (Slack, Discord, Email)
│ │ ├── api/ # FastAPI server
│ │ ├── cli.py # Command-line interface
│ │ └── main.py # Entry point
│ ├── tests/ # Python tests
│ ├── docs/ # Technical documentation
│ ├── pyproject.toml # Python package config
│ └── README.md # Python package docs
├── js/ # JavaScript package
│ ├── src/ # TypeScript source
│ │ ├── index.ts # Main exports
│ │ ├── apiClient.ts # REST API client
│ │ ├── AgentChat.tsx # React chat component
│ │ └── types.ts # TypeScript definitions
│ ├── dist/ # Compiled JavaScript
│ ├── package.json # npm package config
│ ├── tsconfig.json # TypeScript config
│ └── README.md # JavaScript package docs
└── shared/ # Shared schemas
├── message.schema.json # JSON Schema for messages
└── openapi.yaml # OpenAPI specification
| Channel | Python Support | JavaScript Support | Features |
|---|---|---|---|
| Slack | ✅ Full | ✅ API Client | Webhooks, threads, reactions |
| Discord | ✅ Full | ✅ API Client | Bot commands, embeds, reactions |
| ✅ Full | ✅ API Client | IMAP/SMTP, threading | |
| Web/API | ✅ REST API | ✅ React Components | Real-time chat UI |
cd py/
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
pytestcd js/
npm install
npm run build
npm test- Python Package: Complete setup guide for the Agent Router service
- JavaScript Package: Client library and React component documentation
- API Reference: OpenAPI specification
- Message Schema: JSON schema for normalized messages
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes in the appropriate package (
py/orjs/) - Add tests for new functionality
- Run the test suite
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- FastAPI for the Python web framework
- Redis for reliable message storage
- TypeScript for type-safe JavaScript
- React for the UI components
- 📖 Documentation
- 🐛 Issue Tracker
- 💬 Discussions
- 📧 Email: hello@agent-router.dev
Built with ❤️ for the LLM community