Skip to content

A dynamic AI platform enabling users to interact with agents individually or in groups, create workflows, and integrate MCP tools for seamless task automation.

License

Notifications You must be signed in to change notification settings

DataRohit/AgentSphere

Repository files navigation

AgentSphere

Project Status: Active License: MIT Version

Python 3.12 Django 5.0 DRF PostgreSQL

Next.js 15.3 React 19 TypeScript Tailwind CSS 4

Docker Redis Celery Vault MinIO

Built with Cookiecutter Django Ruff OpenAPI

A dynamic AI platform enabling users to interact with agents individually or in groups, create workflows, and integrate MCP tools for seamless task automation.

🌟 Features

Backend Features

  • πŸ€– AI Agents: Create and manage AI agents with customizable system prompts
  • πŸ”„ LLM Integration: Connect to various LLM providers (Only Gemini for Now!)
  • 🏒 Organizations: Create and manage organizations with multiple members
  • πŸ”§ MCP Tools: Integrate external tools via MCP servers
  • πŸ‘₯ Multi-User: Collaborative environment with user management
  • πŸ”’ Secure: API keys stored securely in HashiCorp Vault
  • πŸ“Š API Documentation: Comprehensive API documentation with Swagger/ReDoc
  • πŸš€ Scalable: Built with Docker for easy deployment and scaling

Frontend Features

  • 🎨 Modern UI: Clean, responsive interface built with Next.js and Tailwind CSS
  • πŸŒ“ Dark Mode: Full support for light and dark themes
  • πŸ’¬ Real-time Chat: WebSocket-powered conversations with AI agents
  • πŸ“± Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
  • πŸ” Secure Authentication: JWT-based authentication with secure cookie storage
  • ⚑ Fast Performance: Optimized for speed with Next.js App Router
  • 🧩 Component Library: Built with shadcn/ui and Radix UI primitives
  • πŸ”„ State Management: Centralized state management with Redux Toolkit

πŸ› οΈ Tech Stack

Backend

  • Framework: Django 5.0, Django REST Framework
  • Database: PostgreSQL
  • Cache & Message Broker: Redis
  • Task Queue: Celery
  • Secret Management: HashiCorp Vault
  • Storage: MinIO (S3-compatible)
  • Documentation: drf-spectacular (OpenAPI)
  • Monitoring: Sentry, Django Silk
  • Email: Mailpit (development)

Frontend

  • Framework: Next.js 15.3, React 19, TypeScript 5
  • UI Components: Tailwind CSS 4, shadcn/ui, Radix UI
  • State Management: Redux Toolkit
  • Form Handling: React Hook Form, Zod
  • Animations: Framer Motion
  • HTTP Client: Native fetch API
  • WebSockets: Native WebSocket API

Infrastructure

  • Containerization: Docker, Docker Compose
  • Package Manager: pnpm (frontend), pip (backend)

πŸ“‹ Prerequisites

  • Docker and Docker Compose
  • Git

πŸš€ Getting Started

Clone the repository

git clone https://github.com/DataRohit/AgentSphere.git
cd AgentSphere

Environment Setup

  • Copy the example environment files:
cp .envs/.django.env.example .envs/.django.env
cp .envs/.postgres.env.example .envs/.postgres.env
cp .envs/.minio.env.example .envs/.minio.env
cp .envs/.vault.env.example .envs/.vault.env
cp .envs/.pgadmin.env.example .envs/.pgadmin.env
  • Update the environment files with your settings

Start the Application

make up

This will start all services defined in the docker-compose.yml file.

Access the Application

Frontend Development Setup

For frontend development, you can run the Next.js development server separately:

# Navigate to the frontend directory
cd frontend

# Install dependencies with pnpm
pnpm install

# Start the development server
pnpm dev

The frontend development server will be available at http://localhost:3000.

You can also use the Makefile command:

make nextjs-dev

🧰 Development Commands

AgentSphere comes with a colorful Makefile that provides convenient commands for development:

# Docker Commands
make help              # πŸ” Show help message
make up                # πŸš€ Start all containers
make down              # πŸ›‘ Stop all containers
make infra-up          # πŸ—οΈ Start infrastructure services only
make app-up            # πŸ“± Start application services only
make ps                # πŸ“‹ List running containers
make logs              # πŸ“œ View logs from all containers
make logs-app          # πŸ“œ View logs from application containers
make logs-infra        # πŸ“œ View logs from infrastructure containers
make build             # πŸ”¨ Build all containers
make clean             # 🧹 Remove all containers, networks, and volumes
make restart           # πŸ”„ Restart all containers
make restart-app       # πŸ”„ Restart application containers
make restart-infra     # πŸ”„ Restart infrastructure containers

# Python Code Quality Commands
make lint              # πŸ”Ž Run ruff linter on Python code
make format            # πŸ’… Format Python code with ruff
make fix               # πŸ”§ Fix auto-fixable issues with ruff

# Frontend Development Commands
make nextjs-dev        # πŸš€ Start NextJS development server
make nextjs-build      # πŸ”¨ Build NextJS application

πŸ—οΈ Project Structure

AgentSphere/
β”œβ”€β”€ .envs/                 # Environment variable files
β”œβ”€β”€ backend/               # Django backend code
β”‚   β”œβ”€β”€ apps/              # Django applications
β”‚   β”‚   β”œβ”€β”€ agents/        # AI agents functionality
β”‚   β”‚   β”œβ”€β”€ chats/         # Chat management (single & group)
β”‚   β”‚   β”œβ”€β”€ common/        # Shared utilities and models
β”‚   β”‚   β”œβ”€β”€ contrib/       # Contributed Django extensions
β”‚   β”‚   β”œβ”€β”€ conversation/  # Conversation sessions & websockets
β”‚   β”‚   β”œβ”€β”€ llms/          # LLM configurations & integrations
β”‚   β”‚   β”œβ”€β”€ organization/  # Organization management
β”‚   β”‚   β”œβ”€β”€ templates/     # Email and HTML templates
β”‚   β”‚   β”œβ”€β”€ tools/         # MCP tools integration
β”‚   β”‚   └── users/         # User management & authentication
β”‚   β”œβ”€β”€ config/            # Django settings and configuration
β”‚   └── requirements.txt   # Python dependencies
β”œβ”€β”€ frontend/              # Next.js frontend code
β”‚   β”œβ”€β”€ app/               # App router pages and layouts
β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication pages
β”‚   β”‚   β”œβ”€β”€ dashboard/     # Dashboard pages
β”‚   β”‚   β”œβ”€β”€ organizations/ # Organization management
β”‚   β”‚   β”œβ”€β”€ agents/        # Agent management
β”‚   β”‚   β”œβ”€β”€ chats/         # Chat interfaces
β”‚   β”‚   β”œβ”€β”€ group-chats/   # Group chat interfaces
β”‚   β”‚   β”œβ”€β”€ store/         # Redux store configuration
β”‚   β”‚   └── globals.css    # Global CSS styles
β”‚   β”œβ”€β”€ components/        # Reusable React components
β”‚   β”‚   β”œβ”€β”€ ui/            # UI components (shadcn/ui)
β”‚   β”‚   └── ...            # Feature-specific components
β”‚   β”œβ”€β”€ lib/               # Utility functions and helpers
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   └── package.json       # Frontend dependencies
β”œβ”€β”€ compose/               # Docker compose configuration
β”‚   β”œβ”€β”€ django/            # Django service configuration
β”‚   β”œβ”€β”€ nginx/             # Nginx service configuration
β”‚   β”œβ”€β”€ postgres/          # PostgreSQL service configuration
β”‚   └── nextjs/            # Next.js service configuration
β”œβ”€β”€ docker-compose.yml     # Docker compose services definition
└── makefile               # Development commands

πŸ”‘ Key Concepts

Agents

AI agents are the core of AgentSphere. Each agent has:

  • A name and description
  • A system prompt that defines its behavior
  • A connection to an LLM for generating responses
  • An automatically generated avatar using DiceBear
  • Public or private visibility within an organization
  • A limit of 5 agents per user per organization

LLMs

Language Model configurations that can be connected to agents:

  • Support for multiple API providers (Currently Gemini 2.5 Pro/Flash)
  • Secure API key storage in HashiCorp Vault
  • Configurable token limits
  • Organization-based access control

Chats

AgentSphere supports two types of chat interactions:

  • Single Chats: One-to-one conversations between a user and an agent
  • Group Chats: Multi-agent conversations where a user can interact with multiple agents
  • Both chat types support message history, editing, and deletion

Conversation Sessions

Conversation sessions manage the flow of interactions:

  • Link to either single or group chats
  • Track active/inactive status
  • Can use a selector prompt for routing to appropriate agents/tools
  • Associate with specific LLM models for processing

Organizations

Organizations provide a way to group users and resources:

  • Each user can create up to 3 organizations
  • Organizations can have up to 8 members
  • Resources (Agents, LLMs, MCP tools) are associated with organizations
  • Public/private visibility controls for resources

MCP Tools

MCP (Multi-Agent Communication Protocol) tools allow integration with external services:

  • Each user can add up to 5 MCP tools per organization
  • Tools are defined by name, description, URL, and optional tags
  • Secure authentication with external services

πŸ›οΈ Frontend Architecture

The frontend of AgentSphere is built with Next.js 15.3 using the App Router, providing a modern, type-safe, and performant user interface.

Key Components

  • Authentication: JWT-based authentication with secure cookie storage
  • State Management: Redux Toolkit for global state management
  • UI Components: Built with shadcn/ui, a collection of reusable components built on Radix UI
  • Real-time Communication: WebSocket connections for live chat functionality
  • Form Handling: React Hook Form with Zod schema validation
  • Animations: Framer Motion for smooth transitions and interactions

Page Structure

  • Landing Page: Introduction to AgentSphere with feature showcase
  • Authentication: Login, signup, account activation, and password reset
  • Dashboard: Organization management and overview
  • Agent Studio: Create and manage AI agents
  • Chat Interfaces: Single and group chat conversations with agents
  • Organization Management: Member management, settings, and permissions

WebSocket Implementation

The chat functionality uses WebSockets for real-time communication:

  • Secure authentication via JWT tokens
  • Automatic reconnection handling
  • Real-time typing indicators
  • Support for both single-agent and multi-agent conversations

πŸ“š API Documentation

The API is documented using OpenAPI 3.0 (via drf-spectacular). You can explore the API using:

πŸ”’ Security

  • User authentication via JWT tokens
  • API keys stored securely in HashiCorp Vault
  • CSRF protection
  • Secure cookie settings

πŸ“„ License

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

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“ž Contact

Rohit Ingole - rohit.vilas.ingole@gmail.com

Project Link: https://github.com/DataRohit/AgentSphere

πŸ”„ CI/CD Pipeline

AgentSphere uses a robust CI/CD pipeline to ensure code quality and automated deployments:

  • Linting: Automated code quality checks using Ruff
  • Testing: Automated tests run on each pull request
  • Docker: Containerized builds for consistent deployment
  • Deployment: Automated deployment to staging and production environments

πŸ“Š Project Status

AgentSphere is currently in active development. The core functionality is implemented, but we're continuously adding new features and improvements.

🌐 Supported LLM Providers

  • Gemini (Currently supported)
  • OpenAI (Coming soon)
  • Anthropic (Coming soon)

πŸ’¬ Getting Help

If you need help with AgentSphere, you can:

  • Open an Issue: For bugs or feature requests
  • Discussions: For general questions and discussions
  • Email: Contact the maintainer directly at rohit.vilas.ingole@gmail.com

We welcome all feedback and contributions!

About

A dynamic AI platform enabling users to interact with agents individually or in groups, create workflows, and integrate MCP tools for seamless task automation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published