Skip to content

josephsenior/ai-agent-integration-hub

Repository files navigation

🔌 AI Agent Integration Hub

Python FastAPI License LangChain

Production-ready platform that connects AI agents to external services and communication channels. Provides a unified API gateway, real-time WebSocket communication, and seamless integration with Slack, Discord, Email, Webhooks, and custom APIs. Built with FastAPI, LangChain, and Redis for scalable, event-driven agent orchestration.

Features

Core Capabilities

  • Unified API Gateway: Single endpoint for all agent interactions
  • Multi-Channel Integration: Slack, Discord, Email, SMS, Webhooks
  • Real-Time Communication: WebSocket support for live updates
  • Event-Driven Architecture: Webhook handling and event streaming
  • Message Queue: Redis-based queuing for reliable message delivery
  • Agent Orchestration: LangChain-based agent integration
  • Rate Limiting & Security: Production-ready API security
  • Integration Marketplace: Pre-built connectors and templates

Supported Integrations

  • Slack: Bot integration, slash commands, interactive components
  • Discord: Bot commands, message handling, reactions
  • Email: SMTP integration, email parsing, automated responses
  • Webhooks: Incoming/outgoing webhooks, event subscriptions
  • Custom APIs: REST API integration, custom connectors
  • WebSocket: Real-time bidirectional communication

Architecture

┌─────────────────┐
│   Frontend UI   │
│   (Streamlit)   │
└────────┬────────┘
         │
┌────────▼─────────────────────────────────────┐
│         API Gateway (FastAPI)                │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  │
│  │   REST   │  │ WebSocket│  │ Webhooks │  │
│  └──────────┘  └──────────┘  └──────────┘  │
└────────┬─────────────────────────────────────┘
         │
┌────────▼─────────────────────────────────────┐
│      Integration Adapters Layer              │
│  ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐       │
│  │Slack │ │Discord│ │Email │ │Custom│       │
│  └──────┘ └──────┘ └──────┘ └──────┘       │
└────────┬─────────────────────────────────────┘
         │
┌────────▼─────────────────────────────────────┐
│      Agent Integration Layer                 │
│  ┌──────────────────────────────────────┐   │
│  │     LangChain Agent Orchestrator     │   │
│  └──────────────────────────────────────┘   │
└────────┬─────────────────────────────────────┘
         │
┌────────▼─────────────────────────────────────┐
│      Infrastructure Layer                    │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  │
│  │  Redis   │  │PostgreSQL│  │  Queue   │  │
│  └──────────┘  └──────────┘  └──────────┘  │
└──────────────────────────────────────────────┘

Quick Start

Prerequisites

  • Python 3.10+
  • Redis (for message queuing)
  • PostgreSQL (optional, SQLite by default)

Installation

  1. Clone and navigate to the project:
cd agent_integration_hub
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp env.example .env
# Edit .env with your API keys and configuration
  1. Initialize database:
python -m backend.core.database init
  1. Start Redis (if not running):
# macOS/Linux
redis-server

# Windows (using Docker)
docker run -d -p 6379:6379 redis:alpine
  1. Run the API server:
uvicorn backend.api.main:app --reload --port 8000
  1. Run the frontend (in another terminal):
streamlit run frontend/app.py

Usage

API Gateway

The API gateway provides a unified interface for all agent interactions:

import requests

# Send message to agent via API
response = requests.post(
    "http://localhost:8000/api/v1/agents/chat",
    json={
        "message": "What's the weather today?",
        "channel": "slack",
        "user_id": "user123"
    },
    headers={"Authorization": "Bearer your-api-key"}
)

WebSocket Connection

Connect for real-time updates:

const ws = new WebSocket('ws://localhost:8001/ws');
ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log('Received:', data);
};

Integration Setup

Slack Integration

  1. Create a Slack app at https://api.slack.com/apps
  2. Add bot token and signing secret to .env
  3. Configure event subscriptions and slash commands
  4. Install app to your workspace

Discord Integration

  1. Create a Discord application at https://discord.com/developers/applications
  2. Add bot token to .env
  3. Invite bot to your server with appropriate permissions

Email Integration

  1. Configure SMTP settings in .env
  2. For Gmail, use an App Password
  3. Test connection via the admin dashboard

Project Structure

agent_integration_hub/
├── backend/
│   ├── api/              # FastAPI routes and endpoints
│   ├── core/             # Core functionality (database, config)
│   ├── integrations/     # Integration adapters
│   ├── agents/           # Agent integration layer
│   ├── services/         # Business logic services
│   ├── models/           # Data models
│   └── utils/            # Utility functions
├── frontend/             # Streamlit dashboard
├── tests/                # Test suite
├── data/                 # Database and data files
├── docs/                 # Documentation
└── requirements.txt      # Python dependencies

API Documentation

Once the server is running, visit:

Features in Detail

1. Unified API Gateway

  • Single endpoint for all agent interactions
  • Request routing and load balancing
  • Authentication and authorization
  • Rate limiting and throttling
  • Request/response logging

2. Multi-Channel Integration

  • Slack: Full bot integration with events, commands, and interactions
  • Discord: Bot commands, message handling, and reactions
  • Email: SMTP integration with parsing and automated responses
  • Webhooks: Bidirectional webhook support
  • Custom APIs: Extensible connector framework

3. Real-Time Communication

  • WebSocket server for live updates
  • Event streaming
  • Real-time notifications
  • Bidirectional communication

4. Message Queue

  • Redis-based queuing
  • Reliable message delivery
  • Retry logic
  • Dead letter queue

5. Agent Orchestration

  • LangChain agent integration
  • Multi-agent coordination
  • Context management
  • Tool integration

Configuration

See env.example for all configuration options. Key settings:

  • DATABASE_URL: Database connection string
  • REDIS_URL: Redis connection string
  • API_SECRET_KEY: Secret key for API authentication
  • Integration-specific credentials (Slack, Discord, Email)

Development

Running Tests

pytest tests/ -v

Code Formatting

black backend/ frontend/
isort backend/ frontend/

🛠️ Tech Stack

  • Framework: FastAPI (async Python web framework)
  • Agent Framework: LangChain (agent orchestration)
  • Message Queue: Redis (reliable message delivery)
  • Database: PostgreSQL/SQLite (persistence)
  • Real-time: WebSockets (bidirectional communication)
  • Integrations: Slack SDK, Discord.py, SMTP
  • Frontend: Streamlit (admin dashboard)

📈 Use Cases

  • Multi-Channel Customer Support: Deploy AI agents across Slack, Discord, Email
  • Internal Team Bots: Productivity bots for Slack/Discord workspaces
  • Email Automation: Automated email responses and processing
  • Webhook Processing: Connect AI agents to any webhook-based service
  • Integration Platform: Build custom connectors for any API
  • Real-Time Chat: Live chat applications with WebSocket support

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • FastAPI for the web framework
  • LangChain for agent orchestration
  • Redis for message queuing
  • Integration SDKs: Slack, Discord, and the open-source community

About

Production-ready AI Agent Integration Hub. Connect AI agents (LangChain, OpenAI, Gemini) to Slack, Discord, Email, and Webhooks with a unified FastAPI gateway, Redis queuing, and WebSocket support.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages