Platform Architecture
Cosmos platform services, consumer applications, SDKs, data flow, inter-service authentication, and infrastructure layout
Updated 2026-11-03
Verified 2026-11-03
Cosmos is a multi-service AI agent platform. It provides shared AI infrastructure, such as agent execution, tool management, authentication, and storage, and a family of applications is built on top of it. Each service is developed and deployed independently. Services communicate through REST APIs, WebSockets, and Kafka events, and the web frontend calls each service directly.
High-Level Architecture
Cosmos runtime architecture
SourceLoading diagram...
The frontend is the browser entry point. It calls each backend service at its own address: a published port locally, or a per-service public URL in deployed environments. There is no shared gateway in front of the services.
Platform Services
Core services
| Service | What it does |
|---|---|
| Configurator | Central configuration: tools, agents, apps, skills, collections, graphs, guardrails, and organization settings |
| User Service | Sign-in, organizations, projects, roles, permissions, and access tokens |
| Storage | File and document management with multi-cloud storage |
| Chat | Chat sessions, message history, and real-time streaming |
| Bridge | Secure tunnels to on-premises systems behind corporate firewalls, without opening inbound ports |
| Frontend | The Cosmos web application, which also serves the in-app documentation |
AI services
| Service | What it does |
|---|---|
| ADK (Agent Development Kit) | Agent execution: reasoning, planning, tool calls, and multi-turn conversations |
| Tools Server (MCP) | Tool runtime that exposes API, database, custom, and connector tools to agents over the Model Context Protocol |
| Knowledge Base (RAGFlow) | Document parsing, indexing, and retrieval for grounded answers |
| PII Redactor | Detection and masking of personal information in text and images |
| Model Garden | Hosting of self-managed models on GPU infrastructure |
Optional services
| Service | What it does |
|---|---|
| Observer | Observability and analytics: performance, cost, and usage data |
| Voice | Real-time spoken conversations through the browser or phone |
| Media Gateway | Real-time audio and video stream ingestion over WebSocket |
Infrastructure
| Component | Role |
|---|---|
| PostgreSQL | Each service stores its data in its own database |
| Redis | Caches tool definitions, agent configuration, and session data |
| Kafka | Carries configuration and observability events between services |
Local Service Groups
Locally, services run with Docker Compose through ./manage.sh. Default groups start with ./manage.sh dev start; optional services start only when you name them.
| Group | Services (dev) | Started by default |
|---|---|---|
| infra | postgres, redis, kafka | Yes |
| core | configurator-web, configurator-consumer, user-web, storage, bridge, frontend | Yes |
| ai | tools-server, tools-consumer, adk, adk-consumer, adk-background-job, adk-celery-worker, chat, chat-consumer | Yes |
| knowledge | ragflow-web, ragflow-worker, ragflow-interactive-worker, ragflow-search-worker | No |
| optional | the knowledge services, plus observer-db, observer-webserver, observer-worker, voice, pii-redactor | No |
./manage.sh dev start voice # one optional service
./manage.sh dev start knowledge # the RAGFlow services
./manage.sh dev start observer-webserver observer-worker
./manage.sh dev start all starts the default groups (infra, core, and ai). Media Gateway and Model Garden are not part of the local compose groups. See Deploying Locally.
Data Flow
1. User request path
A user's message reaches the Chat or ADK service. ADK loads the agent configuration from Configurator, builds the agent tree, connects to MCP for tools, and runs the agent loop. MCP executes tool calls against external APIs, databases, or custom integrations.
2. Tool lifecycle
Configurator to MCP tool sync
SourceLoading diagram...
When a tool is created or deployed through Configurator, a Kafka event is emitted on the configurator topic. The MCP tools-consumer writes the tool definition to Redis (DB 11). On the next tool listing, MCP loads the tools from Redis into its in-memory registry, and later calls are served from memory.
3. Observability
Observer event flow
SourceLoading diagram...
MCP and ADK publish observability events on the observer Kafka topic. The Observer worker consumes them and writes them to the analytics backend for the environment: Azure Data Explorer or Google BigQuery, selected by HYPERSCALER.
The web frontend reports browser telemetry (page views, navigation, API dependencies, and exceptions) to Azure Monitor Application Insights in Azure deployments. See Frontend.
4. Caching
| Layer | Technology | Scope | TTL |
|---|---|---|---|
| L1 | MCP in-memory registry | Per pod | Until restart or Kafka update |
| L2 | Redis | Shared across pods | 24 hours |
| Source of truth | Configurator database (PostgreSQL) | Permanent | Not applicable |
The cache is kept current in two ways:
- Proactive — Kafka events update Redis in near real time.
- Reactive (auto-sync) — when MCP gets a request for a tool that is not cached, it fetches the tool from Configurator, updates Redis, and registers it in memory.
Inter-Service Authentication
Services authenticate to each other with OAuth2 client_credentials tokens issued by the User Service at /oauth/token/. Each service has a stable client ID and a secret stored in its environment file or the cloud secret store. Runtime calls send Authorization: Bearer <token> and, for organization-scoped APIs, X-Org-Id: <uuid>.
Service tokens carry actor_type=service and service_id=<client id>. When a service acts for a user, it also sends X-On-Behalf-Of-User-Id.
Service clients are provisioned by ./manage.sh <env> setup-tokens and checked by ./manage.sh <env> verify-tokens. See Service Tokens for client IDs, secret names, and management.
Database Allocation
PostgreSQL
Each service has its own database, created on first start:
| Service | Database (dev) | ORM |
|---|---|---|
| Configurator | configurator_dev | Django ORM |
| User | user_dev | Django ORM |
| ADK | adk_dev | SQLAlchemy |
| Storage | cosmos_storage_dev | SQLAlchemy + Alembic |
| RAGflow | ragflow_dev | SQLAlchemy + pgvector |
| Model Garden | Set by its database configuration | GORM |
ℹ️ Database names use the
_devsuffix in the dev environment. Azure and GCP environments usecosmos.
Redis
| DB | Purpose | Used by |
|---|---|---|
| 0 | ADK cache (tools, agents, apps) | ADK |
| 11 | MCP tools cache | MCP tools-server, tools-consumer |
| 15 | ADK Kafka event cache | ADK consumer |
See Redis Databases.
Kafka Topics
| Topic | Producer | Consumers | Events |
|---|---|---|---|
configurator | Configurator | MCP tools-consumer, ADK consumer, Chat consumer | Tool, agent, and app changes and deployments |
observer | MCP, ADK | Observer worker | Observability and analytics events |
See Kafka Topics.
Port Reference
Local ports are the same in every environment:
| Port | Service | Port | Service |
|---|---|---|---|
| 3000 | Frontend (Next.js) | 8104 | Observer |
| 8100 | Configurator | 8106 | Voice |
| 8101 | User Service | 8107 | Storage |
| 8102 | MCP Tools Server | 8108 | Chat |
| 8103 | ADK | 8109 | Bridge |
| 15432 | PostgreSQL | 8200 | RAGflow |
| 19092 | Kafka (external) | 16379 | Redis |
API Conventions
- API routes are versioned:
/api/v1/. - Requests need
Authorization: Bearer <token>andX-Org-Id: <uuid>. - Optional services return
503with{"error": "Service name is currently unavailable"}when they are down. - Health checks are unauthenticated:
GET /health/.
Multi-Cloud (Hyperscaler) Pattern
Several services change behavior based on HYPERSCALER (local, azure, gcp):
| Concern | local | azure | gcp |
|---|---|---|---|
| Blob storage | Local filesystem | Azure Blob Storage | GCP Cloud Storage |
| Analytics | Not applicable | Azure Data Explorer | BigQuery |
| Kafka | Plain Kafka | Azure Event Hubs | Plain Kafka |
| SSL verification | Off | On | On |
Consumer Applications
Consumer applications are products built on Cosmos. They use the platform for agent execution, authentication, storage, and tools, and add their own domain logic and interfaces.
- JumpStart SAP Intelligence — a consulting workbench for SAP, Oracle, and BTP assessment and migration. Teams use it to analyze codebases, generate migration blueprints, and speed up development with AI-assisted code generation, with a canvas-based UI and connectors to SAP and Oracle systems. Learn more
- JumpStart AMS — an application management support portal for project-based ticket intake, triage and routing, and SLA tracking. Learn more
- JumpStart Workbench — an agent workbench that brings Cosmos agents and tools into the developer's environment, as a VS Code extension or a desktop application. Learn more
When the platform gains a capability, such as a new model provider, tool type, or better observability, every consumer application can use it.
SDKs
Two SDKs are available for building on Cosmos:
- TypeScript SDK — for Node.js applications. Covers authentication, agent communication, tool management, storage, and real-time streaming. See TypeScript SDK.
- Python SDK — for Python backends and data pipelines, with the same capabilities and an async-first design. See Python SDK.
Both handle service authentication, WebSocket streaming, and multi-service coordination, so application developers can focus on their domain.
Deployment
| Target | Method |
|---|---|
| Local | Docker Compose through ./manage.sh |
| Cloud | Kubernetes with a shared, parameterized Helm chart |
| Images | One Dockerfile per service under deployment/docker/ |
| Kubernetes config | Per service under deployment/k8s/ |
| Secrets | Azure Key Vault or GCP Secret Manager, mounted through SecretProviderClass |