SmartMemory
Guides

Lite Mode

Lite mode runs the full SmartMemory pipeline without Docker, FalkorDB, or Redis. It uses local SQLite for the graph, an embedded vector index, and an in-memory cache. The same 11-stage pipeline runs — only the storage providers and a few network-bound stages change.

Use it for:

  • Local development without spinning up Docker
  • CI / unit tests that need a real backend but no infrastructure
  • No-LLM environments where neither OPENAI_API_KEY nor GROQ_API_KEY is set
  • Notebook prototyping and quickstarts

What Lite Mode Changes

PipelineConfig.lite() (in smartmemory/pipeline/config.py) flips a small set of stage flags. Everything else — classification, simplification, EntityRuler NER, sentiment, temporal, topic enrichment, store, link, evolution — runs at full quality.

StageDefaultLite
coreference (fastcoref)enableddisabled (avoids first-run model download)
llm_extractenabledauto-detected from env (see below)
enrich.wikidata.sparql_enabledTrue (HTTP to Wikidata)False (local SQLite alias lookup only)
enrich.enricher_namesall enrichers["basic_enricher", "sentiment_enricher", "temporal_enricher", "topic_enricher"]
evolve.run_clusteringTrueFalse (requires full graph scan)
evolve.run_evolutionTrueTrue (still runs — incremental via daemon thread)

Storage providers (set by create_lite_memory() in smartmemory/tools/factory.py):

  • Graph: SQLiteBackend(db_path=<data_dir>/memory.db)
  • Vector: UsearchVectorBackend(persist_directory=<data_dir>)
  • Cache: NoOpCache
  • Ontology: SQLiteOntologyStore on the same memory.db
  • Observability: disabled

Default data_dir is ~/.smartmemory.

LLM Auto-Detection (DEGRADE-1d)

PipelineConfig.lite() accepts llm_enabled: bool | None:

@classmethod
def lite(cls, workspace_id=None, llm_enabled: Optional[bool] = None):
    if llm_enabled is None:
        llm_enabled = bool(os.getenv("OPENAI_API_KEY") or os.getenv("GROQ_API_KEY"))
    ...
  • None (default) — auto-enables LLM extraction if either OPENAI_API_KEY or GROQ_API_KEY is set; otherwise disables it.
  • True — force on (will fail at extraction time without a key).
  • False — force off; rely on EntityRuler + spaCy NER only.

When LLM extraction is off, the pipeline still extracts entities through EntityRuler (pattern-matched, ~4 ms) and spaCy NER, just without LLM-driven relation extraction.

Three Usage Patterns

Context manager that builds a SmartMemory and tears down deterministically. Closes the SQLite connection and stops the evolution worker on exit.

from smartmemory.tools.factory import lite_context

with lite_context() as memory:
    item_id = memory.ingest("Paris is the capital of France.")
    results = memory.search("capital of France", top_k=3)
    for r in results:
        print(r.content)

2. Constructor injection

For long-lived processes (servers, agents) where you manage the lifecycle directly:

from smartmemory.tools.factory import create_lite_memory
from smartmemory.pipeline.config import PipelineConfig

memory = create_lite_memory(
    data_dir="/var/lib/myapp/memory",
    pipeline_profile=PipelineConfig.lite(llm_enabled=False),  # force no-LLM
)

memory.ingest("Some content")
# ... later ...
memory.close()

You can also inject the lite profile into a regular SmartMemory() constructor if you want lite stages but server-mode storage:

from smartmemory import SmartMemory
from smartmemory.pipeline.config import PipelineConfig

memory = SmartMemory(pipeline_profile=PipelineConfig.lite())

3. Auto-fallback (zero config)

If you never set pipeline_profile, default SmartMemory() will still degrade gracefully when LLM keys aren't present — the LLM extractor checks GROQ_API_KEY / OPENAI_API_KEY at call time and skips when neither is set. For predictable behaviour in CI, prefer pattern 1 or 2 with llm_enabled=False.

Hermetic Variant

PipelineConfig.lite_hermetic() is identical to lite() but refuses to auto-download the spaCy en_core_web_sm model. If the model isn't installed, it raises RuntimeError immediately instead of fetching it mid-test.

Use this in CI parity tests where you need:

  • No network access during the test
  • No mid-test downloads that mask flaky network issues
  • Deterministic ordering between SQLite and FalkorDB branches of a parity matrix
from smartmemory.pipeline.config import PipelineConfig
from smartmemory.tools.factory import lite_context

# Install the model in your CI step BEFORE running tests:
#   python -m spacy download en_core_web_sm

with lite_context(pipeline_profile=PipelineConfig.lite_hermetic()) as memory:
    memory.ingest("test content")

Limitations

CapabilityLiteNotes
Entity extraction qualityReduced when no LLMEntityRuler + spaCy NER only
Relation extractionOff when no LLMRequires LLM stage
Coreference resolutionOfffastcoref disabled to avoid model download
Wikidata SPARQL groundingOffLocal SQLite alias lookup only; no HTTP
Wikipedia / link enrichersOffNetwork-dependent
Graph clustering evolverOffFull graph scan, expensive
Concurrent writesLimitedSQLite is single-writer
Multi-tenant scopingSame as serverScopeProvider works identically

End-to-End Example

"""Quick lite-mode demo: ingest → search → cleanup."""
import os
from smartmemory.tools.factory import lite_context
from smartmemory.pipeline.config import PipelineConfig

# Force no-LLM for a fully offline run
profile = PipelineConfig.lite(llm_enabled=False)

with lite_context(data_dir="./demo-memory", pipeline_profile=profile) as memory:
    # Ingest
    facts = [
        "Ada Lovelace wrote the first algorithm intended for a machine.",
        "She collaborated with Charles Babbage on the Analytical Engine.",
        "The first algorithm computed Bernoulli numbers.",
    ]
    for f in facts:
        item_id = memory.ingest(f)
        print(f"stored {item_id}")

    # Search
    print("\nSearch: 'Ada Lovelace'")
    for hit in memory.search("Ada Lovelace", top_k=3):
        print(f"  - {hit.content[:80]}")

    # Stats
    print(f"\nLast trajectory stages: "
          f"{len(memory.last_trajectory.stages) if memory.last_trajectory else 0}")

Output (on a machine without OPENAI_API_KEY):

stored 1a2b...
stored 3c4d...
stored 5e6f...

Search: 'Ada Lovelace'
  - Ada Lovelace wrote the first algorithm intended for a machine.
  - She collaborated with Charles Babbage on the Analytical Engine.
  - The first algorithm computed Bernoulli numbers.

Last trajectory stages: 11

On this page