|
| 1 | +# HelixAgent: AI-Powered Ensemble LLM Service |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +HelixAgent is a production-ready, AI-powered ensemble LLM service that intelligently combines responses from multiple language models to provide the most accurate and reliable outputs. The project is built in Go and provides a comprehensive platform for managing multiple LLM providers with advanced features like Cognee knowledge graph integration, multi-modal processing, and auto-containerization. |
| 6 | + |
| 7 | +### Key Technologies |
| 8 | +- **Backend**: Go 1.24.0+ with Gin web framework |
| 9 | +- **Database**: PostgreSQL with pgx driver |
| 10 | +- **Cache**: Redis for high-performance caching |
| 11 | +- **Containerization**: Docker and Docker Compose |
| 12 | +- **Monitoring**: Prometheus and Grafana |
| 13 | +- **Knowledge Graph**: Cognee for advanced AI memory |
| 14 | +- **API Gateway**: OpenAI-compatible API interface |
| 15 | + |
| 16 | +### Architecture |
| 17 | +The system follows a microservices architecture with: |
| 18 | +- Main HelixAgent service handling API requests |
| 19 | +- PostgreSQL database for persistent storage |
| 20 | +- Redis for caching and session management |
| 21 | +- Cognee knowledge graph for advanced AI memory |
| 22 | +- Multiple LLM providers (Claude, DeepSeek, Gemini, Qwen, ZAI, Ollama) |
| 23 | +- Monitoring stack with Prometheus and Grafana |
| 24 | + |
| 25 | +## Building and Running |
| 26 | + |
| 27 | +### Prerequisites |
| 28 | +- Docker & Docker Compose |
| 29 | +- Go 1.21+ (for local development) |
| 30 | +- Git |
| 31 | + |
| 32 | +### Using Docker (Recommended) |
| 33 | +```bash |
| 34 | +# Clone the repository |
| 35 | +git clone https://dev.helix.agent.git |
| 36 | +cd helixagent |
| 37 | + |
| 38 | +# Copy environment configuration |
| 39 | +cp .env.example .env |
| 40 | + |
| 41 | +# Start all services |
| 42 | +make docker-full |
| 43 | + |
| 44 | +# Or start specific profiles |
| 45 | +make docker-ai # AI services only |
| 46 | +make docker-monitoring # Monitoring stack only |
| 47 | +``` |
| 48 | + |
| 49 | +### Local Development |
| 50 | +```bash |
| 51 | +# Install dependencies |
| 52 | +make install-deps |
| 53 | + |
| 54 | +# Setup development environment |
| 55 | +make setup-dev |
| 56 | + |
| 57 | +# Run locally |
| 58 | +make run-dev |
| 59 | +``` |
| 60 | + |
| 61 | +### Build Commands |
| 62 | +- `make build` - Build HelixAgent binary |
| 63 | +- `make build-debug` - Build HelixAgent binary (debug mode) |
| 64 | +- `make build-all` - Build for all architectures |
| 65 | +- `make run` - Run HelixAgent locally |
| 66 | +- `make run-dev` - Run HelixAgent in development mode |
| 67 | + |
| 68 | +## Development Conventions |
| 69 | + |
| 70 | +### Code Quality |
| 71 | +- Code formatting: `make fmt` (uses go fmt) |
| 72 | +- Static analysis: `make vet` and `make lint` |
| 73 | +- Security scanning: `make security-scan` |
| 74 | + |
| 75 | +### Testing |
| 76 | +- Unit tests: `make test-unit` |
| 77 | +- Integration tests: `make test-integration` |
| 78 | +- Full test suite: `make test-with-infra` |
| 79 | +- Test coverage: `make test-coverage` |
| 80 | +- Benchmark tests: `make test-bench` |
| 81 | +- Race condition tests: `make test-race` |
| 82 | + |
| 83 | +### Configuration |
| 84 | +The application uses comprehensive environment-based configuration with the following key variables: |
| 85 | +- Server configuration (PORT, HELIXAGENT_API_KEY, GIN_MODE) |
| 86 | +- Database configuration (DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME) |
| 87 | +- Redis configuration (REDIS_HOST, REDIS_PORT, REDIS_PASSWORD) |
| 88 | +- LLM provider API keys (CLAUDE_API_KEY, DEEPSEEK_API_KEY, GEMINI_API_KEY, etc.) |
| 89 | + |
| 90 | +### API Endpoints |
| 91 | +The service provides an OpenAI-compatible API with the following key endpoints: |
| 92 | +- `/health` - Service health status |
| 93 | +- `/v1/health` - Detailed health with provider status |
| 94 | +- `/v1/models` - Available LLM models |
| 95 | +- `/v1/providers` - Configured providers |
| 96 | +- `/v1/completions` - Single completion request |
| 97 | +- `/v1/chat/completions` - Chat-style completions |
| 98 | +- `/v1/ensemble/completions` - Ensemble completions |
| 99 | +- `/v1/cognee` - Cognee knowledge graph integration |
| 100 | +- `/v1/protocols` - Protocol management |
| 101 | +- `/v1/mcp` - Model Context Protocol endpoints |
| 102 | + |
| 103 | +### Security Features |
| 104 | +- JWT token authentication |
| 105 | +- API key authentication |
| 106 | +- Rate limiting with configurable limits |
| 107 | +- CORS support with configurable origins |
| 108 | +- Input sanitization and request validation |
| 109 | +- Secure error handling without information leakage |
| 110 | + |
| 111 | +### Monitoring and Observability |
| 112 | +- Prometheus metrics at `/metrics` endpoint |
| 113 | +- Comprehensive health checks |
| 114 | +- Structured logging with log levels |
| 115 | +- Performance monitoring with response time tracking |
| 116 | + |
| 117 | +### Plugin System |
| 118 | +The application supports a hot-reloading plugin system with standardized interfaces for extending functionality. |
| 119 | + |
| 120 | +## Project Structure |
| 121 | +- `cmd/` - Application entry points |
| 122 | +- `internal/` - Internal packages with core functionality |
| 123 | + - `config/` - Configuration management |
| 124 | + - `router/` - HTTP routing and middleware |
| 125 | + - `handlers/` - API request handlers |
| 126 | + - `services/` - Business logic implementations |
| 127 | + - `models/` - Data models and structures |
| 128 | + - `database/` - Database operations |
| 129 | + - `cache/` - Caching mechanisms |
| 130 | + - `llm/` - LLM provider integrations |
| 131 | + - `cognee/` - Cognee knowledge graph integration |
| 132 | + - `optimization/` - LLM optimization features |
| 133 | +- `pkg/` - Public packages |
| 134 | +- `tests/` - Test suites |
| 135 | +- `docker-compose.yml` - Multi-service Docker configuration |
| 136 | +- `Dockerfile` - Production Docker image |
| 137 | +- `Makefile` - Build and development automation |
0 commit comments