# meterless/genai-agentos architecture

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

- Interactive diagram: https://gitdiagram.com/meterless/genai-agentos
- Repository: https://github.com/meterless/genai-agentos

## Overview

GenAI Agents Infrastructure provides a UI and CLI for managing agents, models, files, chats, and workflows, with a backend coordinating persistence and agent execution. A typical interaction enters through the frontend or CLI, reaches backend APIs, and may invoke a master agent through the WebSocket router; the master agent can orchestrate connected agents and return a response with traces. The README documents GenAI, MCP, and A2A agent types. Several runtime links are documented or visible in sampled files; unsampled modules are represented cautiously, without asserting their internal calls.

Main entry points: [`backend/main.py`](https://github.com/meterless/genai-agentos/blob/main/backend/main.py) (Backend API), [`master-agent/connectors/managers.py`](https://github.com/meterless/genai-agentos/blob/main/master-agent/connectors/managers.py) (Connector Managers), [`backend/src/routes/agents/routes.py`](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/agents/routes.py) (Agent API), [`router/connectors/ws_connector_manager.py`](https://github.com/meterless/genai-agentos/blob/main/router/connectors/ws_connector_manager.py) (WebSocket Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interfaces"]
  node_frontend["Web UI<br/>[App.tsx]"]
  node_cli["CLI<br/>[cli.py]"]
end

subgraph group_backend["Backend Services"]
  node_api["Backend API<br/>[main.py]"]
  node_agent_routes["Agent API<br/>[routes.py]"]
  node_chat_routes["Chat API<br/>[routes.py]"]
  node_flow_routes["Flow API<br/>[routes.py]"]
  node_file_routes["File API<br/>[routes.py]"]
  node_model_routes["Model API<br/>[routes.py]"]
  node_auth["Token Auth<br/>[dependencies.py]"]
  node_redis_celery["Redis and Celery<br/>[celery_app.py]"]
end

subgraph group_orchestration["Agent Orchestration"]
  node_router["WebSocket Router"]
  node_master["Master Agent<br/>[main.py]"]
  node_connectors["Connector Managers<br/>[managers.py]"]
end

subgraph group_data["Persistence"]
  node_agent_repo["Agent Repository<br/>[agent.py]"]
  node_chat_repo["Chat Repository<br/>[chat.py]"]
  node_flow_repo["Flow Repository<br/>[flow.py]"]
  node_file_repo["File Repository<br/>[files.py]"]
  node_model_repo["Model Repository<br/>[model_config.py]"]
  node_database[("PostgreSQL")]
end

subgraph group_integrations["Agent Integrations"]
  node_genai{{"GenAI Agents"}}
  node_mcp{{"MCP Servers"}}
  node_a2a{{"A2A Servers"}}
end

node_user(("User"))

node_user -->|"uses"| node_frontend
node_user -->|"registers agents"| node_cli
node_frontend -.->|"calls APIs"| node_api
node_cli -.->|"calls APIs"| node_api
node_api -.->|"mounts API"| node_agent_routes
node_api -->|"mounts files"| node_file_routes
node_api -.->|"connects WebSocket"| node_router
node_api -.->|"configures jobs"| node_redis_celery
node_agent_routes -->|"queries agents"| node_agent_repo
node_agent_routes -->|"authenticates"| node_auth
node_chat_routes -->|"uses repository"| node_chat_repo
node_flow_routes -->|"uses repository"| node_flow_repo
node_file_routes -->|"reads and writes"| node_file_repo
node_model_routes -->|"manages configs"| node_model_repo
node_agent_repo -.->|"persists agents"| node_database
node_chat_repo -.->|"persists chats"| node_database
node_flow_repo -.->|"persists flows"| node_database
node_file_repo -.->|"stores metadata"| node_database
node_model_repo -.->|"persists configs"| node_database
node_router -.->|"routes messages"| node_master
node_router -->|"forwards registrations"| node_api
node_master -.->|"invokes connectors"| node_connectors
node_connectors -->|"calls tools"| node_mcp
node_connectors -->|"sends messages"| node_a2a
node_connectors -->|"sends requests"| node_genai

click node_frontend "https://github.com/meterless/genai-agentos/blob/main/frontend/src/App.tsx"
click node_cli "https://github.com/meterless/genai-agentos/blob/main/cli/cli.py"
click node_api "https://github.com/meterless/genai-agentos/blob/main/backend/main.py"
click node_agent_routes "https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/agents/routes.py"
click node_chat_routes "https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/chat/routes.py"
click node_flow_routes "https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/flows/routes.py"
click node_file_routes "https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/files/routes.py"
click node_model_routes "https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/llms/routes.py"
click node_auth "https://github.com/meterless/genai-agentos/blob/main/backend/src/auth/dependencies.py"
click node_agent_repo "https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/agent.py"
click node_chat_repo "https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/chat.py"
click node_flow_repo "https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/flow.py"
click node_file_repo "https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/files.py"
click node_model_repo "https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/model_config.py"
click node_router "https://github.com/meterless/genai-agentos/blob/main/router/connectors/ws_connector_manager.py"
click node_master "https://github.com/meterless/genai-agentos/blob/main/master-agent/main.py"
click node_connectors "https://github.com/meterless/genai-agentos/blob/main/master-agent/connectors/managers.py"
click node_redis_celery "https://github.com/meterless/genai-agentos/blob/main/backend/src/celery/celery_app.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_frontend,node_cli,node_user toneBlue
class node_api,node_agent_routes,node_chat_routes,node_flow_routes,node_file_routes,node_model_routes,node_auth,node_redis_celery toneAmber
class node_router,node_master,node_connectors toneMint
class node_agent_repo,node_chat_repo,node_flow_repo,node_file_repo,node_model_repo,node_database toneRose
class node_genai,node_mcp,node_a2a toneIndigo
```

## Components

### User Interfaces

- [Web UI](https://github.com/meterless/genai-agentos/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [CLI](https://github.com/meterless/genai-agentos/blob/main/cli/cli.py): `cli/cli.py`

### Backend Services

- [Backend API](https://github.com/meterless/genai-agentos/blob/main/backend/main.py): `backend/main.py`
- [Agent API](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/agents/routes.py): `backend/src/routes/agents/routes.py`
- [Chat API](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/chat/routes.py): `backend/src/routes/chat/routes.py`
- [Flow API](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/flows/routes.py): `backend/src/routes/flows/routes.py`
- [File API](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/files/routes.py): `backend/src/routes/files/routes.py`
- [Model API](https://github.com/meterless/genai-agentos/blob/main/backend/src/routes/llms/routes.py): `backend/src/routes/llms/routes.py`
- [Token Auth](https://github.com/meterless/genai-agentos/blob/main/backend/src/auth/dependencies.py): `backend/src/auth/dependencies.py`
- [Redis and Celery](https://github.com/meterless/genai-agentos/blob/main/backend/src/celery/celery_app.py): `backend/src/celery/celery_app.py`

### Agent Orchestration

- [WebSocket Router](https://github.com/meterless/genai-agentos/blob/main/router/connectors/ws_connector_manager.py): `router/connectors/ws_connector_manager.py`
- [Master Agent](https://github.com/meterless/genai-agentos/blob/main/master-agent/main.py): `master-agent/main.py`
- [Connector Managers](https://github.com/meterless/genai-agentos/blob/main/master-agent/connectors/managers.py): `master-agent/connectors/managers.py`

### Persistence

- [Agent Repository](https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/agent.py): `backend/src/repositories/agent.py`
- [Chat Repository](https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/chat.py): `backend/src/repositories/chat.py`
- [Flow Repository](https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/flow.py): `backend/src/repositories/flow.py`
- [File Repository](https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/files.py): `backend/src/repositories/files.py`
- [Model Repository](https://github.com/meterless/genai-agentos/blob/main/backend/src/repositories/model_config.py): `backend/src/repositories/model_config.py`
- **PostgreSQL**

### Agent Integrations

- **GenAI Agents**
- **MCP Servers**
- **A2A Servers**

### Other components

- **User**

## Connections

- User → Web UI: uses (evidence: `README.md`)
- User → CLI: registers agents (evidence: `README.md`)
- Web UI → Backend API: calls APIs
- CLI → Backend API: calls APIs
- Backend API → Agent API: mounts API
- Backend API → File API: mounts files (evidence: `backend/main.py`)
- Backend API → WebSocket Router: connects WebSocket
- Backend API → Redis and Celery: configures jobs
- Agent API → Agent Repository: queries agents (evidence: `backend/src/routes/agents/routes.py`)
- Agent API → Token Auth: authenticates (evidence: `backend/src/routes/agents/routes.py`)
- Chat API → Chat Repository: uses repository (evidence: `backend/src/routes/chat/routes.py`)
- Flow API → Flow Repository: uses repository (evidence: `backend/src/routes/flows/routes.py`)
- File API → File Repository: reads and writes (evidence: `backend/src/routes/files/routes.py`)
- Model API → Model Repository: manages configs (evidence: `backend/src/routes/llms/routes.py`)
- Agent Repository → PostgreSQL: persists agents
- Chat Repository → PostgreSQL: persists chats
- Flow Repository → PostgreSQL: persists flows
- File Repository → PostgreSQL: stores metadata
- Model Repository → PostgreSQL: persists configs
- WebSocket Router → Master Agent: routes messages
- WebSocket Router → Backend API: forwards registrations (evidence: `router/connectors/ws_connector_manager.py`)
- Master Agent → Connector Managers: invokes connectors
- Connector Managers → MCP Servers: calls tools (evidence: `master-agent/connectors/managers.py`)
- Connector Managers → A2A Servers: sends messages (evidence: `master-agent/connectors/managers.py`)
- Connector Managers → GenAI Agents: sends requests (evidence: `master-agent/connectors/managers.py`)
