Get started

The agent loop

The one call per turn that stores what was said and returns what is relevant.

llms.txt

MenteDB gives your agent long-term memory through one call: process_turn. Each turn it stores what was said, retrieves what is relevant, and hands back the memories to put in your next prompt. That loop is the whole integration.

Text
each turn:
  1. build your prompt with the memories from last turn's context
  2. call your LLM, get a reply
  3. process_turn(user_message, reply)  ->  returns context for next turn

process_turn embeds the user message, runs hybrid recall (vector + keyword + graph) over everything stored so far, saves the new turn, and returns the relevant memories as context. On the first turn context is empty because nothing has been learned yet. By turn two it carries the facts, preferences, and corrections from earlier in the conversation, and across sessions.

Fact extraction and contradiction detection need an LLM. On cloud that is wired up for you. When self-hosting you set MENTEDB_LLM_PROVIDER and MENTEDB_LLM_API_KEY; without them you still get storage and recall, just no automatic extraction. There is no configure_llm() call, it is environment or platform config.

Which example do I want?

Pick the cell that matches where MenteDB runs and your language. Cloud talks to https://api.mentedb.com over REST with an mdb_ API key, no SDK to install and nothing to run. Self-hosting embeds the engine in your process with data on local disk, you own the LLM key and the maintenance schedule.

PythonNode / TypeScriptRust
Cloudmanaged, no infraREST + requestsREST + fetchREST
Self-hostedembedded, your diskpip install mentedbnpm install mentedbcargo add mentedb

What process_turn returns

One call runs the full cognitive pipeline and returns everything it found. The field you use most is context. The rest is signal you can act on or ignore.

FieldWhat it is
contextMemories relevant to this turn, attention-ordered. Prepend to your next prompt.
facts_extractedFacts learned this turn. Zero without an LLM configured.
contradiction_countNew information that conflicts with an existing belief.
pain_warningsThings that went wrong in similar past contexts.
stored_idsMemory IDs written this turn.
predicted_topicsWhere the conversation is likely heading, from trajectory analysis.

Node returns these in camelCase (factsExtracted, contradictionCount); Python and the REST payload use snake_case.