This page documents startup, runtime settings, and operational checks for MemState deployments.
Boot sequence
- Load settings from environment and optional
.env(MEMSTATE_*prefix, plusGROQ_API_KEYfallback). - Start Uvicorn with import path
memstate.api.main:appand configured host/port. - Lazy-create singleton executor and reasoner when first route call requests dependencies.
- Open and initialize Kuzu schema through
get_store()on first store access.
Local run
pip install -e .
python -m memstate.api.cli
Default bind: 0.0.0.0:8765. UI: http://127.0.0.1:8765/ui/
Core environment variables
| Variable | Default | Purpose |
|---|---|---|
MEMSTATE_KUZU_PATH | memstate.kuzu | Embedded database file path. |
MEMSTATE_API_HOST | 0.0.0.0 | HTTP bind host. |
MEMSTATE_API_PORT | 8765 | HTTP bind port. |
MEMSTATE_API_KEY | unset | Optional API key for protected JSON routes. |
MEMSTATE_OLLAMA_BASE_URL | http://127.0.0.1:11434 | Ollama provider endpoint. |
MEMSTATE_OLLAMA_MODEL | llama3.2:latest | Default Ollama model id. |
MEMSTATE_GROQ_MODEL | openai/gpt-oss-20b | Default Groq model id. |
GROQ_API_KEY | unset | Groq credential (loaded without prefix). |
MEMSTATE_ADMIN_KEY | unset | Stronger key for protected config updates (e.g. system context). Falls back to MEMSTATE_API_KEY. |
MEMSTATE_OLLAMA_ALLOW_REMOTE | false | Allow client-supplied Ollama URLs to non-localhost hosts. Disabled by default (SSRF risk). |
MEMSTATE_GROQ_WHISPER_MODEL | whisper-large-v3-turbo | Groq Whisper model for speech-to-text transcription endpoints. |
Chat/Study operational tuning
| Variable | Default | Operational impact |
|---|---|---|
MEMSTATE_CHAT_INTENT_TURNS | 8 | Intent classifier context depth. |
MEMSTATE_CHAT_MAX_TOOL_ROUNDS | 32 | Max tool-loop rounds for normal chat flow. |
MEMSTATE_CHAT_CHUNK_THRESHOLD_CHARS | 10000 | Threshold for Study two-phase ingest. |
MEMSTATE_CHAT_CHUNK_PER_SEGMENT_TOOL_ROUNDS | 72 | Tool budget used in Study phase A. |
MEMSTATE_STUDY_PHASE_DELAY_SECONDS | 8.0 | Pause between Study phase A and phase B. |
MEMSTATE_GROQ_RATE_LIMIT_MAX_RETRIES | 20 | Max retries on Groq 429 / rate_limit_exceeded (1–100). |
MEMSTATE_GROQ_RATE_LIMIT_BACKOFF_CAP_SECONDS | 120.0 | Cap (seconds) for Groq rate-limit backoff sleep per retry (1–600). |
MEMSTATE_QUERY_FIELD_SALIENCE_BUMP | 0.1 | Per-field salience increase when read tools return field data on query intent (0–2). |
MEMSTATE_FIELD_SALIENCE_MAX | 10.0 | Upper bound for field salience values (0.1–10). |
Health and diagnostics
GET /health: process liveness.GET /health/graph: verifies graph open and read query against configured path.GET /health/falkordb: compatibility alias to graph health endpoint.
If graph health reports lock errors, ensure no duplicate MemState process is using the same DB path and avoid cloud-sync locked folders.
Client integration environment
MemoryClient reads:
MEMSTATE_API_URL(defaulthttp://127.0.0.1:8765)MEMSTATE_API_KEY(optional)