Skip to content

Running Alan — Local

Running without Docker gives lower latency and direct access to logs. You need to manage a few system services yourself, but the TUI handles the rest.


Prerequisites

  • uv — Python package manager
  • Valkey — in-memory session store
  • Ollama — local LLM and embedding server

Step 1 — Install and start system services

brew install valkey ollama
brew services start valkey
brew services start ollama
sudo apt-get install valkey
# Install Ollama via the official installer:
curl -fsSL https://ollama.com/install.sh | sh

sudo systemctl start valkey
sudo systemctl start ollama
# Enable on boot:
sudo systemctl enable valkey ollama

Step 2 — Pull Ollama models

ollama pull qwen2.5:3b   # intent router (fast, small)
ollama pull qwen2.5:7b   # agent (more capable)

The default model names are set in .env.example. If you want to use different models, override OLLAMA_ROUTER_MODEL and OLLAMA_AGENT_MODEL in your .env file.

The embedding model (minishlab/potion-base-32M) is a sentence-transformers model downloaded automatically from Hugging Face the first time you build the vector index — no manual step needed.


Step 3 — Clone the repo

git clone https://github.com/turing-db/askalan.git
cd askalan

No uv sync needed — the TUI and each sub-package manage their own dependencies through the uv workspace.


Step 4 — Provide the knowledge graph

Create the turing-dir directory at the project root — TuringDB will read and write graph files here:

mkdir -p turing-dir

Then import a graph into it. To use the default Reactome graph, follow the import instructions in turing-bench. For a custom graph, import it into TuringDB and save it under turing-dir/.


Step 5 — Start Alan

The TUI starts and monitors all services (TuringDB, FastAPI, Streamlit) from a single terminal window and shows live logs for each:

uv run askalan

No manual uv sync or individual server commands needed — the TUI handles everything. Use the RAG tab to build the vector index the first time.

Option B — Manual startup

Start each service in a separate terminal from the project root.

TuringDB:

uv run turingdb -demon -turing-dir ./turing-dir -load reactome -p 1234

FastAPI server:

uv run --directory server fastapi run

Streamlit app:

uv run streamlit run ./app/main.py

Step 6 — Build the vector index (first time only)

After the servers are running, build the vector index once:

curl -X POST http://localhost:8000/dev/build_vector_index \
  -H "Content-Type: application/json" \
  -d '{"graph_name": "reactome", "model": "minishlab/potion-base-32M"}'

The index persists inside TuringDB — you do not need to rebuild it on subsequent runs. The TUI's RAG tab provides a "Build index" button that does the same thing.


Configuration

All settings have sensible defaults — the stack runs out of the box without a configuration file. To override specific settings, create a .env file at the project root:

cp .env.example .env
# edit as needed

Server settings (prefix TURINGDB_):

Variable Default Description
TURINGDB_URL localhost TuringDB host
TURINGDB_PORT 1234 TuringDB port
TURINGDB_GRAPH reactome Graph to load on startup
TURINGDB_CORS_ORIGINS ["*"] Allowed CORS origins
TURINGDB_DATA_DIR ./turing-dir/data Directory for embeddings CSVs
TURINGDB_VALKEY_URL valkey://localhost:6379/0 Valkey connection URL
TURINGDB_SESSION_TTL_SECONDS 604800 Chat session lifetime (7 days)
TURINGDB_SKELETON_MIN_COUNT 100 Min edge count for graph skeleton entries
TURINGDB_SKELETON_TOP_N 5 Max connections per node type in skeleton
TURINGDB_RATE_LIMIT_REQUESTS 20 Max requests per user per 10 min window
TURINGDB_RATE_LIMIT_TOKENS_PER_WINDOW 500000 Max tokens per user per 10 min window
TURINGDB_STREAMLIT_URL http://localhost:8501 Streamlit URL for anon-bootstrap redirects

Chat-agent settings (no prefix):

Variable Default Description
LLM_PROVIDER ollama Agent LLM provider: ollama or mistral
ROUTER_PROVIDER (inherits LLM_PROVIDER) Override provider for intent router only
OLLAMA_BASE_URL http://localhost:11434/v1 Ollama API base URL
OLLAMA_AGENT_MODEL qwen2.5:7b Ollama model for the agent loop
OLLAMA_ROUTER_MODEL qwen2.5:3b Ollama model for intent classification
MISTRAL_API_KEY (empty) Required if LLM_PROVIDER=mistral
MISTRAL_AGENT_MODEL mistral-large-latest Mistral model for the agent
MISTRAL_ROUTER_MODEL mistral-small-latest Mistral model for the router
RAG_CONFIDENCE_THRESHOLD 0.75 Min confidence for lookup; escalates to agent below
EMBEDDING_MODEL minishlab/potion-base-32M Model used for query embedding

Tip: ROUTER_PROVIDER lets you run a fast local model for intent classification while using Mistral for the agent — useful for reducing cloud costs on routing. Set LLM_PROVIDER=mistral ROUTER_PROVIDER=ollama to split the two.