Sign in

Platform Architecture

Cosmos platform services, consumer applications, SDKs, data flow, inter-service authentication, and infrastructure layout

architectureservicesecosystemsdksdata-flowinfrastructurekafkaredispostgres

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

Source

Loading 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

ServiceWhat it does
ConfiguratorCentral configuration: tools, agents, apps, skills, collections, graphs, guardrails, and organization settings
User ServiceSign-in, organizations, projects, roles, permissions, and access tokens
StorageFile and document management with multi-cloud storage
ChatChat sessions, message history, and real-time streaming
BridgeSecure tunnels to on-premises systems behind corporate firewalls, without opening inbound ports
FrontendThe Cosmos web application, which also serves the in-app documentation

AI services

ServiceWhat 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 RedactorDetection and masking of personal information in text and images
Model GardenHosting of self-managed models on GPU infrastructure

Optional services

ServiceWhat it does
ObserverObservability and analytics: performance, cost, and usage data
VoiceReal-time spoken conversations through the browser or phone
Media GatewayReal-time audio and video stream ingestion over WebSocket

Infrastructure

ComponentRole
PostgreSQLEach service stores its data in its own database
RedisCaches tool definitions, agent configuration, and session data
KafkaCarries 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.

GroupServices (dev)Started by default
infrapostgres, redis, kafkaYes
coreconfigurator-web, configurator-consumer, user-web, storage, bridge, frontendYes
aitools-server, tools-consumer, adk, adk-consumer, adk-background-job, adk-celery-worker, chat, chat-consumerYes
knowledgeragflow-web, ragflow-worker, ragflow-interactive-worker, ragflow-search-workerNo
optionalthe knowledge services, plus observer-db, observer-webserver, observer-worker, voice, pii-redactorNo
bash
./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

Source

Loading 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

Source

Loading 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

LayerTechnologyScopeTTL
L1MCP in-memory registryPer podUntil restart or Kafka update
L2RedisShared across pods24 hours
Source of truthConfigurator database (PostgreSQL)PermanentNot 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:

ServiceDatabase (dev)ORM
Configuratorconfigurator_devDjango ORM
Useruser_devDjango ORM
ADKadk_devSQLAlchemy
Storagecosmos_storage_devSQLAlchemy + Alembic
RAGflowragflow_devSQLAlchemy + pgvector
Model GardenSet by its database configurationGORM

ℹ️ Database names use the _dev suffix in the dev environment. Azure and GCP environments use cosmos.

Redis

DBPurposeUsed by
0ADK cache (tools, agents, apps)ADK
11MCP tools cacheMCP tools-server, tools-consumer
15ADK Kafka event cacheADK consumer

See Redis Databases.

Kafka Topics

TopicProducerConsumersEvents
configuratorConfiguratorMCP tools-consumer, ADK consumer, Chat consumerTool, agent, and app changes and deployments
observerMCP, ADKObserver workerObservability and analytics events

See Kafka Topics.

Port Reference

Local ports are the same in every environment:

PortServicePortService
3000Frontend (Next.js)8104Observer
8100Configurator8106Voice
8101User Service8107Storage
8102MCP Tools Server8108Chat
8103ADK8109Bridge
15432PostgreSQL8200RAGflow
19092Kafka (external)16379Redis

API Conventions

  • API routes are versioned: /api/v1/.
  • Requests need Authorization: Bearer <token> and X-Org-Id: <uuid>.
  • Optional services return 503 with {"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):

Concernlocalazuregcp
Blob storageLocal filesystemAzure Blob StorageGCP Cloud Storage
AnalyticsNot applicableAzure Data ExplorerBigQuery
KafkaPlain KafkaAzure Event HubsPlain Kafka
SSL verificationOffOnOn

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

TargetMethod
LocalDocker Compose through ./manage.sh
CloudKubernetes with a shared, parameterized Helm chart
ImagesOne Dockerfile per service under deployment/docker/
Kubernetes configPer service under deployment/k8s/
SecretsAzure Key Vault or GCP Secret Manager, mounted through SecretProviderClass