# incidentfox/self-learning-ai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/incidentfox/self-learning-ai-agent
- Repository: https://github.com/incidentfox/self-learning-ai-agent

## Overview

This is a multi-service team knowledge assistant. Users ask questions through Slack or the web UI; the agent API routes knowledge queries to the learning engine, whose retrieval layer combines strategies and returns evidence for an answer. The parallel learning loop ingests conversations, documents, and connected sources, analyzes and reconciles knowledge, then stores accepted items or queues uncertain ones for review. The README documents onboarding, daily learning, proactive behaviors, integrations, and administration. Some subsystem links rely on README-level documentation because their implementation was not sampled.

Main entry points: [`agent-service/server.py`](https://github.com/incidentfox/self-learning-ai-agent/blob/main/agent-service/server.py) (Agent API), [`learning-engine/agents/teaching.py`](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/agents/teaching.py) (Knowledge teaching), [`learning-engine/server.py`](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/server.py) (Learning API), [`slack-bot/app.py`](https://github.com/incidentfox/self-learning-ai-agent/blob/main/slack-bot/app.py) (Slack bot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_slack_bot["Slack bot<br/>[app.py]"]
  node_web_ui["Web dashboard"]
end

subgraph group_api["API and control plane"]
  node_agent_api["Agent API<br/>[server.py]"]
  node_runs["Agent runs<br/>[runs.py]"]
  node_config_api["Configuration API<br/>[main.py]"]
  node_config_store[("Config database<br/>[database.py]")]
end

subgraph group_learning["Learning and knowledge"]
  node_learning_api["Learning API<br/>[server.py]"]
  node_retrieval["RAG retrieval<br/>[retriever.py]"]
  node_strategies["Retrieval strategies<br/>[strategies.py]"]
  node_teaching["Knowledge teaching<br/>[teaching.py]"]
  node_llm["LLM services<br/>[llm.py]"]
  node_tree_builder["RAPTOR trees"]
  node_knowledge_store[("Knowledge store<br/>[db.py]")]
end

subgraph group_sources["Ingestion sources"]
  node_doc_ingestion["Document ingestion<br/>[doc_ingestion.py]"]
  node_connector_manager["Integration sync<br/>[manager.py]"]
  node_connectors["Source connectors"]
end

subgraph group_operations["Proactive and meetings"]
  node_proactive["Proactive agents<br/>[proactive.py]"]
  node_meeting_bot["Meeting processing<br/>[server.py]"]
end

node_slack_users(("Slack users"))
node_web_users(("Web users"))
node_external_sources(("Team sources"))

node_slack_users -->|"ask or teach"| node_slack_bot
node_web_users -->|"ask or manage"| node_web_ui
node_slack_bot -->|"chat requests"| node_agent_api
node_web_ui -->|"chat requests"| node_agent_api
node_agent_api -->|"creates runs"| node_runs
node_agent_api -->|"queries knowledge"| node_learning_api
node_learning_api -->|"dispatches search"| node_retrieval
node_retrieval -->|"runs strategies"| node_strategies
node_learning_api -->|"submits teaching"| node_teaching
node_doc_ingestion -->|"teaches chunks"| node_teaching
node_connector_manager -->|"dispatches sync"| node_connectors
node_connectors -->|"supplies documents"| node_teaching
node_teaching -->|"embeds content"| node_llm
node_teaching -->|"persists knowledge"| node_knowledge_store
node_tree_builder -->|"reads and updates"| node_knowledge_store
node_proactive -->|"retrieves context"| node_retrieval
node_proactive -->|"generates summaries"| node_llm
node_meeting_bot -.->|"submits transcripts"| node_learning_api
node_external_sources -->|"provides content"| node_connector_manager
node_config_api -->|"reads and writes"| node_config_store
node_slack_bot -.->|"loads workspace config"| node_config_api
node_agent_api -.->|"shares database"| node_config_store

click node_slack_bot "https://github.com/incidentfox/self-learning-ai-agent/blob/main/slack-bot/app.py"
click node_web_ui "https://github.com/incidentfox/self-learning-ai-agent/tree/main/web-ui/src/app"
click node_agent_api "https://github.com/incidentfox/self-learning-ai-agent/blob/main/agent-service/server.py"
click node_runs "https://github.com/incidentfox/self-learning-ai-agent/blob/main/agent-service/runs.py"
click node_config_api "https://github.com/incidentfox/self-learning-ai-agent/blob/main/config-service/src/api/main.py"
click node_config_store "https://github.com/incidentfox/self-learning-ai-agent/blob/main/config-service/src/db/database.py"
click node_learning_api "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/server.py"
click node_retrieval "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/retrieval/retriever.py"
click node_strategies "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/retrieval/strategies.py"
click node_teaching "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/agents/teaching.py"
click node_llm "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/core/llm.py"
click node_tree_builder "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/pipeline/tree_builder_pipeline.py"
click node_doc_ingestion "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/pipeline/doc_ingestion.py"
click node_connector_manager "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/connectors/manager.py"
click node_connectors "https://github.com/incidentfox/self-learning-ai-agent/tree/main/learning-engine/connectors"
click node_knowledge_store "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/core/db.py"
click node_proactive "https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/agents/proactive.py"
click node_meeting_bot "https://github.com/incidentfox/self-learning-ai-agent/blob/main/meeting-bot/server.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_slack_bot,node_web_ui,node_slack_users,node_web_users toneBlue
class node_agent_api,node_runs,node_config_api,node_config_store toneAmber
class node_learning_api,node_retrieval,node_strategies,node_teaching,node_llm,node_tree_builder,node_knowledge_store toneMint
class node_doc_ingestion,node_connector_manager,node_connectors toneRose
class node_proactive,node_meeting_bot,node_external_sources toneIndigo
```

## Components

### User interfaces

- [Slack bot](https://github.com/incidentfox/self-learning-ai-agent/blob/main/slack-bot/app.py): `slack-bot/app.py`
- [Web dashboard](https://github.com/incidentfox/self-learning-ai-agent/tree/main/web-ui/src/app): `web-ui/src/app`

### API and control plane

- [Agent API](https://github.com/incidentfox/self-learning-ai-agent/blob/main/agent-service/server.py): `agent-service/server.py`
- [Agent runs](https://github.com/incidentfox/self-learning-ai-agent/blob/main/agent-service/runs.py): `agent-service/runs.py`
- [Configuration API](https://github.com/incidentfox/self-learning-ai-agent/blob/main/config-service/src/api/main.py): `config-service/src/api/main.py`
- [Config database](https://github.com/incidentfox/self-learning-ai-agent/blob/main/config-service/src/db/database.py): `config-service/src/db/database.py`

### Learning and knowledge

- [Learning API](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/server.py): `learning-engine/server.py`
- [RAG retrieval](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/retrieval/retriever.py): `learning-engine/retrieval/retriever.py`
- [Retrieval strategies](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/retrieval/strategies.py): `learning-engine/retrieval/strategies.py`
- [Knowledge teaching](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/agents/teaching.py): `learning-engine/agents/teaching.py`
- [LLM services](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/core/llm.py): `learning-engine/core/llm.py`
- [RAPTOR trees](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/pipeline/tree_builder_pipeline.py): `learning-engine/pipeline/tree_builder_pipeline.py`
- [Knowledge store](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/core/db.py): `learning-engine/core/db.py`

### Ingestion sources

- [Document ingestion](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/pipeline/doc_ingestion.py): `learning-engine/pipeline/doc_ingestion.py`
- [Integration sync](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/connectors/manager.py): `learning-engine/connectors/manager.py`
- [Source connectors](https://github.com/incidentfox/self-learning-ai-agent/tree/main/learning-engine/connectors): `learning-engine/connectors`

### Proactive and meetings

- [Proactive agents](https://github.com/incidentfox/self-learning-ai-agent/blob/main/learning-engine/agents/proactive.py): `learning-engine/agents/proactive.py`
- [Meeting processing](https://github.com/incidentfox/self-learning-ai-agent/blob/main/meeting-bot/server.py): `meeting-bot/server.py`

### Other components

- **Slack users**
- **Web users**
- **Team sources**

## Connections

- Slack users → Slack bot: ask or teach (evidence: `README.md`)
- Web users → Web dashboard: ask or manage (evidence: `README.md`)
- Slack bot → Agent API: chat requests (evidence: `README.md`)
- Web dashboard → Agent API: chat requests (evidence: `README.md`)
- Agent API → Agent runs: creates runs (evidence: `agent-service/server.py`)
- Agent API → Learning API: queries knowledge (evidence: `agent-service/server.py`)
- Learning API → RAG retrieval: dispatches search (evidence: `learning-engine/server.py`)
- RAG retrieval → Retrieval strategies: runs strategies (evidence: `learning-engine/retrieval/retriever.py`)
- Learning API → Knowledge teaching: submits teaching (evidence: `learning-engine/server.py`)
- Document ingestion → Knowledge teaching: teaches chunks (evidence: `learning-engine/pipeline/doc_ingestion.py`)
- Integration sync → Source connectors: dispatches sync (evidence: `learning-engine/connectors/manager.py`)
- Source connectors → Knowledge teaching: supplies documents (evidence: `learning-engine/connectors/manager.py`)
- Knowledge teaching → LLM services: embeds content (evidence: `learning-engine/agents/teaching.py`)
- Knowledge teaching → Knowledge store: persists knowledge (evidence: `learning-engine/agents/teaching.py`)
- RAPTOR trees → Knowledge store: reads and updates (evidence: `learning-engine/pipeline/tree_builder_pipeline.py`)
- Proactive agents → RAG retrieval: retrieves context (evidence: `learning-engine/agents/proactive.py`)
- Proactive agents → LLM services: generates summaries (evidence: `learning-engine/agents/proactive.py`)
- Meeting processing → Learning API: submits transcripts (evidence: `README.md`)
- Team sources → Integration sync: provides content (evidence: `README.md`)
- Configuration API → Config database: reads and writes (evidence: `config-service/src/api/main.py`)
- Slack bot → Configuration API: loads workspace config (evidence: `README.md`)
- Agent API → Config database: shares database (evidence: `README.md`)
