# codemie-ai/codemie architecture

> Architecture diagram of the GitHub repository codemie-ai/codemie, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codemie-ai/codemie
- Repository: https://github.com/codemie-ai/codemie

## Overview

CodeMie is the core backend for an AI-agent platform spanning software delivery, modernization, and business workflows. Its principal interaction is a user request entering the REST API, being resolved into an assistant execution, and using agents, tools, and configured language models to produce a response. A separate indexing path ingests enterprise knowledge for retrieval; management APIs and integrations support configuration, OAuth, and cloud-specific capabilities, while analytics and monitoring provide operational insight. The map combines README-documented capabilities with source-index evidence; unsampled subsystem links are omitted where their callers are not shown.

Main entry points: [`src/codemie/rest_api/main.py`](https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/main.py) (REST API), [`src/codemie/service/assistant/assistant_engine_builder.py`](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/assistant/assistant_engine_builder.py) (Assistant builder), [`src/codemie/agents`](https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents) (Agent orchestration), [`src/codemie/service/llm_service/llm_service.py`](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/llm_service/llm_service.py) (LLM service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and assistants"]
  node_rest["REST API<br/>[main.py]"]
  node_auth["User identity<br/>[user.py]"]
  node_assistant_model["Assistant model<br/>[assistant.py]"]
  node_assistant_builder["Assistant builder"]
end

subgraph group_runtime["Agent runtime"]
  node_agents["Agent orchestration"]
  node_tools["Agent tools"]
  node_llm_service["LLM service<br/>[llm_service.py]"]
  node_llm_config["Model configuration<br/>[llm_config.py]"]
  node_litellm["LiteLLM integration"]
end

subgraph group_knowledge["Knowledge and integrations"]
  node_datasources["Datasource processors"]
  node_loaders["Content loaders"]
  node_kb_tools["Knowledge search"]
  node_elasticsearch[("Elasticsearch<br/>[elasticsearch.py]")]
  node_oauth["Integration OAuth<br/>[flow_engine.py]"]
  node_bedrock["Bedrock orchestration"]
end

subgraph group_operations["Platform operations"]
  node_analytics["Usage analytics<br/>[query_pipeline.py]"]
  node_metrics_repo["Metrics repository"]
  node_monitoring["LLM monitoring"]
  node_postgres[("PostgreSQL<br/>[postgres.py]")]
end

node_user(("User"))
node_external_services{{"Enterprise systems"}}

node_user -->|"sends request"| node_rest
node_rest -.->|"authenticates"| node_auth
node_rest -.->|"runs assistant"| node_assistant_builder
node_assistant_builder -->|"reads configuration"| node_assistant_model
node_assistant_builder -.->|"builds executors"| node_agents
node_agents -->|"invokes tools"| node_tools
node_agents -.->|"requests models"| node_llm_service
node_llm_service -->|"uses settings"| node_llm_config
node_llm_service -->|"resolves providers"| node_litellm
node_datasources -->|"loads content"| node_loaders
node_datasources -->|"indexes knowledge"| node_elasticsearch
node_tools -->|"includes search"| node_kb_tools
node_kb_tools -.->|"searches index"| node_elasticsearch
node_oauth -.->|"authorizes access"| node_external_services
node_bedrock -->|"orchestrates agents"| node_assistant_model
node_analytics -->|"queries metrics"| node_metrics_repo
node_metrics_repo -->|"reads metrics"| node_elasticsearch
node_monitoring -.->|"exports telemetry"| node_external_services
node_assistant_model -.->|"persists state"| node_postgres

click node_rest "https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/main.py"
click node_auth "https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/security/user.py"
click node_assistant_model "https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/models/assistant.py"
click node_assistant_builder "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/assistant/assistant_engine_builder.py"
click node_agents "https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents"
click node_tools "https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents/tools"
click node_llm_service "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/llm_service/llm_service.py"
click node_llm_config "https://github.com/codemie-ai/codemie/blob/main/src/codemie/configs/llm_config.py"
click node_litellm "https://github.com/codemie-ai/codemie/tree/main/src/codemie/enterprise/litellm"
click node_datasources "https://github.com/codemie-ai/codemie/tree/main/src/codemie/datasource"
click node_loaders "https://github.com/codemie-ai/codemie/tree/main/src/codemie/datasource/loader"
click node_kb_tools "https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents/tools/kb"
click node_elasticsearch "https://github.com/codemie-ai/codemie/blob/main/src/codemie/clients/elasticsearch.py"
click node_oauth "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/oauth/flow_engine.py"
click node_bedrock "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/aws_bedrock/bedrock_orchestration_service.py"
click node_analytics "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/analytics/query_pipeline.py"
click node_metrics_repo "https://github.com/codemie-ai/codemie/blob/main/src/codemie/repository/metrics_elastic_repository.py"
click node_monitoring "https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/monitoring/llm_proxy_monitoring_service.py"
click node_postgres "https://github.com/codemie-ai/codemie/blob/main/src/codemie/clients/postgres.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rest,node_auth,node_assistant_model,node_assistant_builder,node_user toneBlue
class node_agents,node_tools,node_llm_service,node_llm_config,node_litellm toneAmber
class node_datasources,node_loaders,node_kb_tools,node_elasticsearch,node_oauth,node_bedrock toneMint
class node_analytics,node_metrics_repo,node_monitoring,node_postgres toneRose
class node_external_services toneIndigo
```

## Components

### API and assistants

- [REST API](https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/main.py): `src/codemie/rest_api/main.py`
- [User identity](https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/security/user.py): `src/codemie/rest_api/security/user.py`
- [Assistant model](https://github.com/codemie-ai/codemie/blob/main/src/codemie/rest_api/models/assistant.py): `src/codemie/rest_api/models/assistant.py`
- [Assistant builder](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/assistant/assistant_engine_builder.py): `src/codemie/service/assistant/assistant_engine_builder.py`

### Agent runtime

- [Agent orchestration](https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents): `src/codemie/agents`
- [Agent tools](https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents/tools): `src/codemie/agents/tools`
- [LLM service](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/llm_service/llm_service.py): `src/codemie/service/llm_service/llm_service.py`
- [Model configuration](https://github.com/codemie-ai/codemie/blob/main/src/codemie/configs/llm_config.py): `src/codemie/configs/llm_config.py`
- [LiteLLM integration](https://github.com/codemie-ai/codemie/tree/main/src/codemie/enterprise/litellm): `src/codemie/enterprise/litellm`

### Knowledge and integrations

- [Datasource processors](https://github.com/codemie-ai/codemie/tree/main/src/codemie/datasource): `src/codemie/datasource`
- [Content loaders](https://github.com/codemie-ai/codemie/tree/main/src/codemie/datasource/loader): `src/codemie/datasource/loader`
- [Knowledge search](https://github.com/codemie-ai/codemie/tree/main/src/codemie/agents/tools/kb): `src/codemie/agents/tools/kb`
- [Elasticsearch](https://github.com/codemie-ai/codemie/blob/main/src/codemie/clients/elasticsearch.py): `src/codemie/clients/elasticsearch.py`
- [Integration OAuth](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/oauth/flow_engine.py): `src/codemie/service/oauth/flow_engine.py`
- [Bedrock orchestration](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/aws_bedrock/bedrock_orchestration_service.py): `src/codemie/service/aws_bedrock/bedrock_orchestration_service.py`

### Platform operations

- [Usage analytics](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/analytics/query_pipeline.py): `src/codemie/service/analytics/query_pipeline.py`
- [Metrics repository](https://github.com/codemie-ai/codemie/blob/main/src/codemie/repository/metrics_elastic_repository.py): `src/codemie/repository/metrics_elastic_repository.py`
- [LLM monitoring](https://github.com/codemie-ai/codemie/blob/main/src/codemie/service/monitoring/llm_proxy_monitoring_service.py): `src/codemie/service/monitoring/llm_proxy_monitoring_service.py`
- [PostgreSQL](https://github.com/codemie-ai/codemie/blob/main/src/codemie/clients/postgres.py): `src/codemie/clients/postgres.py`

### Other components

- **User**
- **Enterprise systems**

## Connections

- User → REST API: sends request (evidence: `README.md`)
- REST API → User identity: authenticates
- REST API → Assistant builder: runs assistant
- Assistant builder → Assistant model: reads configuration (evidence: `src/codemie/service/assistant/assistant_engine_builder.py`)
- Assistant builder → Agent orchestration: builds executors
- Agent orchestration → Agent tools: invokes tools (evidence: `README.md`)
- Agent orchestration → LLM service: requests models
- LLM service → Model configuration: uses settings (evidence: `src/codemie/service/llm_service/llm_service.py`)
- LLM service → LiteLLM integration: resolves providers (evidence: `src/codemie/service/llm_service/llm_service.py`)
- Datasource processors → Content loaders: loads content (evidence: `src/codemie/datasource/base_llm_routing_processor.py`)
- Datasource processors → Elasticsearch: indexes knowledge (evidence: `src/codemie/datasource/base_llm_routing_processor.py`)
- Agent tools → Knowledge search: includes search (evidence: `README.md`)
- Knowledge search → Elasticsearch: searches index
- Integration OAuth → Enterprise systems: authorizes access
- Bedrock orchestration → Assistant model: orchestrates agents (evidence: `src/codemie/service/aws_bedrock/bedrock_orchestration_service.py`)
- Usage analytics → Metrics repository: queries metrics (evidence: `src/codemie/service/analytics/query_pipeline.py`)
- Metrics repository → Elasticsearch: reads metrics (evidence: `src/codemie/repository/metrics_elastic_repository.py`)
- LLM monitoring → Enterprise systems: exports telemetry
- Assistant model → PostgreSQL: persists state (evidence: `src/codemie/rest_api/models/assistant.py`)
