C4 Level 2: Container Diagram
This diagram provides a more detailed, yet still high-level, view of the CognicellAI AI Orchestration Hub's architecture. It zooms inside the main "CognicellAI Platform" system we saw in the Context Diagram and identifies the major "containers." In C4, a container is a deployable, runnable unit, which could be an application, a data store, a microservice, or even a serverless function. It shows the technology choices and how these containers communicate with each other.
Key Containers and Their Roles:
OpenWebUI Application: This is the primary web application that users interact with. It's the user interface for all AI orchestration and model interaction. It's built with Python and React and runs as a container.LiteLLM Proxy: This container acts as an intermediary for all interactions with external Large Language Models (LLMs). It standardizes API calls, routing them efficiently to different LLM providers, and fetches necessary credentials. It's built with Python.PostgreSQL Database: This is the central relational database for the CognicellAI platform, storing application data, user configurations, and metadata. It's implemented using AWS Aurora Serverless for scalability and management.Persistent Storage: This container provides durable storage for files, embeddings, and RAG data. It leverages Longhorn within the Kubernetes cluster, backed by AWS S3 for robust data persistence.Secrets Management: Implemented using AWS Secrets Manager, this container securely stores, manages, and distributes all sensitive credentials like API keys and database passwords to ensure secure operations.S3 Object Storage: This provides generic object storage using AWS S3. It's used for various purposes, including storing K3s kubeconfig files, OpenWebUI attachments, and other large unstructured data.Kubernetes Cluster: This is the container orchestration platform, specifically K3s running on AWS EC2 instances. It hosts and manages the lifecycle of theOpenWebUI Application,LiteLLM Proxy, and the underlyingPersistent Storage(Longhorn).Network Gateway / VPN: Powered by Tailscale, this container provides secure network access to and within the Kubernetes cluster, enabling both internal service communication and controlled access for administrators.
Interactions and Flow:
- User Interaction: The
Enterprise AI UserUsestheOpenWebUI Applicationvia HTTPS. - Application Logic:
OpenWebUI ApplicationMakes API calls toLiteLLM Proxyfor all LLM-related tasks.OpenWebUI ApplicationReads/Writesdata to thePostgreSQL DatabaseandStores/Retrieves filesfromPersistent Storage.- Both
OpenWebUI ApplicationandLiteLLM ProxyGet Credentials FromSecrets Management(e.g., database credentials, external LLM API keys). OpenWebUI ApplicationalsoUses for objectsS3 Object Storage.
- LLM Integration: The
LiteLLM ProxyQueriestheExternal LLM Providerto perform AI tasks. - Platform Hosting: The
Kubernetes ClusterHoststheOpenWebUI ApplicationandLiteLLM Proxy, andManages volumes forPersistent Storage. It alsoStores Kubeconfig inS3 Object Storage. - Administrative Access: The
DevOps Engineer / Cloud AdminManages Platformvia theKubernetes Cluster,Connects viatheNetwork Gateway / VPN, andManages SecretsinSecrets Management. - Network Access: The
Network Gateway / VPNProvides Secure Access TotheKubernetes Cluster.
In summary, the Container Diagram details how the CognicellAI AI Orchestration Hub is composed of these distinct, communicating services and data stores, all orchestrated within a Kubernetes environment and leveraging various AWS managed services for core functionalities like databases, secrets, and object storage.