# weaviate/elysia architecture

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

- Interactive diagram: https://gitdiagram.com/weaviate/elysia
- Repository: https://github.com/weaviate/elysia

## Overview

Elysia is an agentic decision-tree platform: a user query enters through the app’s WebSocket API or Python Tree interface, then the tree chooses actions and streams results. Its built-in capabilities include Weaviate retrieval and aggregation, text tools, visualization, postprocessing, custom tools, collection preprocessing, and per-user configuration. The README documents the product workflow; source excerpts and the SOURCE INDEX support the core call links. Several API routes and tool implementations were not sampled, so their internal connections are omitted or shown as documented capabilities.

Main entry points: [`elysia/tree/tree.py`](https://github.com/weaviate/elysia/blob/main/elysia/tree/tree.py) (Decision tree), [`elysia/tools/retrieval/query.py`](https://github.com/weaviate/elysia/blob/main/elysia/tools/retrieval/query.py) (Retrieval and aggregation), [`elysia/api/app.py`](https://github.com/weaviate/elysia/blob/main/elysia/api/app.py) (FastAPI app), [`elysia/api/routes/query.py`](https://github.com/weaviate/elysia/blob/main/elysia/api/routes/query.py) (Query WebSocket)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interfaces and sessions"]
  node_api["FastAPI app<br/>[app.py]"]
  node_query_api["Query WebSocket<br/>[query.py]"]
  node_user_manager["User sessions<br/>[user.py]"]
end

subgraph group_orchestration["Decision orchestration"]
  node_tree["Decision tree<br/>[tree.py]"]
  node_tree_state["Tree context<br/>[objects.py]"]
  node_decision["Decision logic<br/>[util.py]"]
  node_tool_types["Tools and results<br/>[objects.py]"]
end

subgraph group_capabilities["Tools and data preparation"]
  node_retrieval["Retrieval and aggregation<br/>[query.py]"]
  node_chunk["Result chunking<br/>[chunk.py]"]
  node_text["Text tools<br/>[text.py]"]
  node_visualization["Visualization<br/>[visualise.py]"]
  node_postprocess["Result summaries<br/>[summarise_items.py]"]
  node_custom_tools["Custom tools<br/>[objects.py]"]
  node_preprocess["Collection preprocessing<br/>[collection.py]"]
end

subgraph group_platform["Configuration and persistence"]
  node_config["Model settings<br/>[config.py]"]
  node_client["Weaviate client<br/>[client.py]"]
  node_weaviate[("Weaviate cluster")]
  node_serialisation["Parsing and formatting<br/>[parsing.py]"]
end

node_user(("User"))

node_user -->|"uses app"| node_api
node_user -->|"runs Python"| node_tree
node_api -->|"registers routes"| node_query_api
node_query_api -->|"gets session tree"| node_user_manager
node_query_api -->|"streams query"| node_tree
node_user_manager -->|"manages trees"| node_tree
node_tree -->|"uses context"| node_tree_state
node_tree -->|"orchestrates decisions"| node_decision
node_tree -->|"dispatches retrieval"| node_retrieval
node_tree -->|"dispatches text"| node_text
node_tree -->|"dispatches visualization"| node_visualization
node_tree -->|"dispatches summaries"| node_postprocess
node_tree -->|"uses tool results"| node_tool_types
node_user -->|"defines tools"| node_custom_tools
node_retrieval -->|"chunks results"| node_chunk
node_preprocess -->|"connects client"| node_client
node_preprocess -->|"saves metadata"| node_weaviate
node_retrieval -->|"queries cluster"| node_client
node_client -->|"connects"| node_weaviate
node_tree -->|"uses settings"| node_config
node_retrieval -->|"formats results"| node_serialisation
node_api -->|"configures sessions"| node_user_manager

click node_api "https://github.com/weaviate/elysia/blob/main/elysia/api/app.py"
click node_query_api "https://github.com/weaviate/elysia/blob/main/elysia/api/routes/query.py"
click node_user_manager "https://github.com/weaviate/elysia/blob/main/elysia/api/services/user.py"
click node_tree "https://github.com/weaviate/elysia/blob/main/elysia/tree/tree.py"
click node_tree_state "https://github.com/weaviate/elysia/blob/main/elysia/tree/objects.py"
click node_decision "https://github.com/weaviate/elysia/blob/main/elysia/tree/util.py"
click node_tool_types "https://github.com/weaviate/elysia/blob/main/elysia/objects.py"
click node_retrieval "https://github.com/weaviate/elysia/blob/main/elysia/tools/retrieval/query.py"
click node_chunk "https://github.com/weaviate/elysia/blob/main/elysia/tools/retrieval/chunk.py"
click node_text "https://github.com/weaviate/elysia/blob/main/elysia/tools/text/text.py"
click node_visualization "https://github.com/weaviate/elysia/blob/main/elysia/tools/visualisation/visualise.py"
click node_postprocess "https://github.com/weaviate/elysia/blob/main/elysia/tools/postprocessing/summarise_items.py"
click node_custom_tools "https://github.com/weaviate/elysia/blob/main/elysia/objects.py"
click node_preprocess "https://github.com/weaviate/elysia/blob/main/elysia/preprocessing/collection.py"
click node_config "https://github.com/weaviate/elysia/blob/main/elysia/config.py"
click node_client "https://github.com/weaviate/elysia/blob/main/elysia/util/client.py"
click node_serialisation "https://github.com/weaviate/elysia/blob/main/elysia/util/parsing.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_api,node_query_api,node_user_manager,node_user toneBlue
class node_tree,node_tree_state,node_decision,node_tool_types toneAmber
class node_retrieval,node_chunk,node_text,node_visualization,node_postprocess,node_custom_tools,node_preprocess toneMint
class node_config,node_client,node_weaviate,node_serialisation toneRose
```

## Components

### Interfaces and sessions

- [FastAPI app](https://github.com/weaviate/elysia/blob/main/elysia/api/app.py): `elysia/api/app.py`
- [Query WebSocket](https://github.com/weaviate/elysia/blob/main/elysia/api/routes/query.py): `elysia/api/routes/query.py`
- [User sessions](https://github.com/weaviate/elysia/blob/main/elysia/api/services/user.py): `elysia/api/services/user.py`

### Decision orchestration

- [Decision tree](https://github.com/weaviate/elysia/blob/main/elysia/tree/tree.py): `elysia/tree/tree.py`
- [Tree context](https://github.com/weaviate/elysia/blob/main/elysia/tree/objects.py): `elysia/tree/objects.py`
- [Decision logic](https://github.com/weaviate/elysia/blob/main/elysia/tree/util.py): `elysia/tree/util.py`
- [Tools and results](https://github.com/weaviate/elysia/blob/main/elysia/objects.py): `elysia/objects.py`

### Tools and data preparation

- [Retrieval and aggregation](https://github.com/weaviate/elysia/blob/main/elysia/tools/retrieval/query.py): `elysia/tools/retrieval/query.py`
- [Result chunking](https://github.com/weaviate/elysia/blob/main/elysia/tools/retrieval/chunk.py): `elysia/tools/retrieval/chunk.py`
- [Text tools](https://github.com/weaviate/elysia/blob/main/elysia/tools/text/text.py): `elysia/tools/text/text.py`
- [Visualization](https://github.com/weaviate/elysia/blob/main/elysia/tools/visualisation/visualise.py): `elysia/tools/visualisation/visualise.py`
- [Result summaries](https://github.com/weaviate/elysia/blob/main/elysia/tools/postprocessing/summarise_items.py): `elysia/tools/postprocessing/summarise_items.py`
- [Custom tools](https://github.com/weaviate/elysia/blob/main/elysia/objects.py): `elysia/objects.py`
- [Collection preprocessing](https://github.com/weaviate/elysia/blob/main/elysia/preprocessing/collection.py): `elysia/preprocessing/collection.py`

### Configuration and persistence

- [Model settings](https://github.com/weaviate/elysia/blob/main/elysia/config.py): `elysia/config.py`
- [Weaviate client](https://github.com/weaviate/elysia/blob/main/elysia/util/client.py): `elysia/util/client.py`
- **Weaviate cluster**
- [Parsing and formatting](https://github.com/weaviate/elysia/blob/main/elysia/util/parsing.py): `elysia/util/parsing.py`

### Other components

- **User**

## Connections

- User → FastAPI app: uses app (evidence: `README.md`)
- User → Decision tree: runs Python (evidence: `README.md`)
- FastAPI app → Query WebSocket: registers routes (evidence: `elysia/api/app.py`)
- Query WebSocket → User sessions: gets session tree (evidence: `elysia/api/routes/query.py`)
- Query WebSocket → Decision tree: streams query (evidence: `elysia/api/routes/query.py`)
- User sessions → Decision tree: manages trees (evidence: `elysia/api/services/user.py`)
- Decision tree → Tree context: uses context (evidence: `elysia/tree/tree.py`)
- Decision tree → Decision logic: orchestrates decisions (evidence: `elysia/tree/tree.py`)
- Decision tree → Retrieval and aggregation: dispatches retrieval (evidence: `elysia/tree/tree.py`)
- Decision tree → Text tools: dispatches text (evidence: `elysia/tree/tree.py`)
- Decision tree → Visualization: dispatches visualization (evidence: `elysia/tree/tree.py`)
- Decision tree → Result summaries: dispatches summaries (evidence: `elysia/tree/tree.py`)
- Decision tree → Tools and results: uses tool results (evidence: `elysia/tree/tree.py`)
- User → Custom tools: defines tools (evidence: `README.md`)
- Retrieval and aggregation → Result chunking: chunks results (evidence: `elysia/tools/retrieval/query.py`)
- Collection preprocessing → Weaviate client: connects client (evidence: `elysia/preprocessing/collection.py`)
- Collection preprocessing → Weaviate cluster: saves metadata (evidence: `elysia/preprocessing/collection.py`)
- Retrieval and aggregation → Weaviate client: queries cluster (evidence: `elysia/tools/retrieval/query.py`)
- Weaviate client → Weaviate cluster: connects (evidence: `elysia/util/client.py`)
- Decision tree → Model settings: uses settings (evidence: `elysia/tree/tree.py`)
- Retrieval and aggregation → Parsing and formatting: formats results (evidence: `elysia/tools/retrieval/query.py`)
- FastAPI app → User sessions: configures sessions (evidence: `elysia/api/app.py`)
