Free Intro Class
    Botspot Logo

    agenthub · ai.llm_memory

    LLM with Memory

    A conversational LLM that remembers. It fetches the session's prior turns, answers with them in context, and writes the new turn back — three nodes fused into one.

    category AIin messages · system_prompt · output_schemaout text · message · usage · items · memory_written · leg_costsexecution asyncmodel cost model tokens

    Why the node earns its place

    The chatbot-that-remembers pattern used to be a four-part wiring job: Memory Fetch, then the LLM, then Memory Write triggered off the LLM's flow port. Easy to get subtly wrong, and the trigger edge in particular is the kind of thing people forget until they notice the agent has amnesia.

    This node composes those three handlers verbatim — the same memory calls, the same model call, the same billing event — so its behaviour can never drift from the standalone nodes. The pieces remain available separately for graphs that want them.

    How it works at run time

    1. 1
      Fetch up to limit prior messages for this session from the memory service.
    2. 2
      Inject them: prepend inserts them as real user and assistant turns, so the model reads an actual conversation; system collapses them into one summary system message.
    3. 3
      Generate the response with the enriched messages.
    4. 4
      Persist this user and assistant turn back to memory — unless persist_memory is off.

    What you wire

    Inputs

    • messages *
      array
    • system_prompt
      string
    • output_schema
      object

    Outputs

    • text
      string
    • message
      object
    • usage
      object
    • items
      array
    • memory_written
      boolean
    • leg_costs
      array

    Configuration

    KeyTypeDefault & optionsWhat it does
    provider *stringchoices from model-library:providers
    model *stringchoices from model-library:models
    system_promptstringAgent persona / instructions, injected as the system message.
    temperaturenumberdefault 0.7
    max_tokensnumber
    limitnumberdefault 10Max prior messages to fetch from memory.
    inject_asstringdefault "prepend" prepend · systemprepend (default): insert prior turns as raw user/assistant messages before the incoming ones — the model reads them as a real conversation. system: collapse history into one summary system message (can read as background the model may ignore).
    persist_memorybooleandefault truePersist this user + assistant turn back to memory after the response. Turn off for read-only (recall without remembering).

    What usually goes wrong

    Watch for this

    Prefer prepend over system. History collapsed into a system message reads to the model as background it may ignore; as real turns it reads as the conversation it is continuing.

    Memory here is best-effort by design. A missing session id or a memory service error is logged and swallowed, so the reply still goes out — the agent simply will not remember it. An agent that has quietly stopped remembering is not broken wiring; check that the run carries a session id.

    Behaviour & provenance

    buildersChat & voice agents
    routesno
    side effectsnone — computes only
    replay safetynot applicable
    talks toa model, the memory service
    holdsworkspace runtime token, the caller's own identity