AI Orchestrator
A production-quality AI Platform for executing multiple AI tasks through a single API. Built with modern Python practices, Clean Architecture principles, and provider-agnostic design.
Clean Architecture with provider-agnostic design for multi-task AI execution
A production-quality AI Platform for executing multiple AI tasks through a single API. Built with modern Python practices, Clean Architecture principles, and provider-agnostic design.
Overview This platform provides a unified API for various AI tasks including SEO generation, documentation generation, text summarization, and more. The architecture is designed to be provider-agnostic, allowing seamless switching between different AI providers (Baseten, OpenAI, Anthropic, etc.) without modifying the core application.
Key Features
- ▸Multi-Task Support: SEO optimization, code documentation, text summarization, and extensible task system
- ▸Provider Agnostic: Easy switching between AI providers (Baseten, OpenAI, Anthropic, etc.)
- ▸Clean Architecture: Separation of concerns with dedicated layers for validation, execution, parsing
- ▸Production Ready: Comprehensive error handling, structured logging, retry logic, and monitoring
- ▸Modern Tech Stack: Python 3.12+, FastAPI, Pydantic v2, Docker, TypeScript frontend
- ▸Type Safety: Full type hints with mypy validation
- ▸Testing: Comprehensive test suite with pytest
- ▸Docker Support: Containerized deployment for easy scaling
Architecture The platform follows Clean Architecture principles with clear separation of concerns:
Request → Validation → Task Registry → Prompt Builder → Provider Layer → Response Parser → Response
Core Components
- ▸API Layer: FastAPI endpoints with request validation
- ▸Task Executor: Orchestrates task execution with error handling and retry logic
- ▸Task Registry: Dynamic task discovery and registration
- ▸Prompt Builders: Flexible prompt generation with template support
- ▸Provider Layer: Abstraction for different AI providers
- ▸Response Parsers: Structured response parsing and validation
Technology Stack Backend:
- ▸Python 3.12+: Modern Python with latest features
- ▸FastAPI: High-performance async API framework
- ▸Pydantic v2: Data validation and settings management
- ▸httpx: Async HTTP client for provider APIs
- ▸uv: Fast Python package manager
- ▸Docker: Containerization for deployment
- ▸Ruff: Fast Python linter
- ▸mypy: Static type checking
- ▸python-dotenv: Environment variable management
- ▸Structured logging: JSON-formatted logs for production monitoring
Frontend:
- ▸Next.js 14: React framework with App Router
- ▸TypeScript: Type-safe frontend development
- ▸Tailwind CSS: Utility-first CSS framework
- ▸React Hooks: Modern state management
Installation Prerequisites: Python 3.12+, uv package manager, Docker (optional), Node.js 18+ (for frontend)
Backend Setup:
git clone https://github.com/Othmane-aoubid/ai_orchestrator.git
cd ai_orchestrator
uv sync
cp .env.example .env
Running the Application Development Mode:
uv run uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000
Production Mode:
uvicorn src.api.main:app --host 0.0.0.0 --port 8000
Docker:
docker build -t ai-orchestrator .
docker run -p 8000:8000 --env-file .env ai-orchestrator
Testing
uv run pytest
uv run pytest --cov=src --cov-report=html
API Usage Execute a Task:
curl -X POST http://localhost:8000/api/v1/execute \
-H "Content-Type: application/json" \
-d '{
"task_id": "seo",
"inputs": {
"content": "Your content here",
"target_audience": "general audience"
}
}'
Available Tasks
- ▸seo: SEO content optimization
- ▸documentation: Code documentation generation
- ▸summarization: Text summarization with key points
License MIT License