All examples

Example 12

Experiment

Persistent Agent Memory

Give an agent a past: what it did, what it learned, and what it can do next.

An agent that forgets between sessions has to start from scratch every time. This example records each session, compacts it into memories the agent can search, traverse, and compare, and wraps it all in an identity, permissions, and a model to think with.

Chapter one

When an agent holds a conversation

The agent runs somewhere else, on whatever framework it likes. The platform stays agent-neutral and gives it an identity, limits, a model to think with, and a place for the conversation to be kept.

  1. 1
    Federated Auth & User Management

    The agent knows who it is

    The Identity engine lets the agent identify itself and validate who it is interacting with.

  2. 2
    Authorization Layer

    The agent knows its limits

    The Authorization engine defines what the agent is allowed to do.

  3. 3
    LLM Plane

    A model is provided to think with

    The LLM engine gives the agent a model for its reasoning and for choosing which tools to use.

  4. 4
    RAG

    Another source is consulted

    Only when the agent needs information beyond its memory

    The RAG engine offers the agent an alternative source of information to draw on.

  5. 5
    Session Storage for Agents

    The session is memorialized

    The Sessions engine records the conversation, whether the agent is built with LangGraph, Claw, Hermes, or something custom.

Chapter two

When a session becomes a memory

Raw sessions are long. On a schedule, the agent compacts what happened into something small enough to keep and meaningful enough to reuse.

  1. 1
    Cron

    Compaction is scheduled

    The Cron engine lets the agent schedule when its memories are compacted, so it happens without anyone asking.

  2. 2
    LLM Plane

    The session is compacted

    The LLM engine provides the model that distills a long session into a compact memory.

  3. 3
    File Server

    The compacted memory is stored

    The File engine stores the compacted memories so they outlast the session they came from.

  4. 4
    Schemas & Ontology Versioning

    The memory is given meaning

    The Semantic engine lets the agent understand what the stored data means and how it relates to other documents.

Chapter three

When the agent remembers

A memory is only worth keeping if it can be found again. The agent can reach the same past in four different ways, depending on what it remembers about it.

The agent needs to remember

Something in the present calls for something from the past.

  • By keyword

    A word brings it back

    The Search engine indexes the compacted memories so the agent can recall them by the words they contain.

  • By similarity

    Something similar comes to mind

    The Vector engine lets the agent find memories that resemble the situation in front of it.

  • By connection

    One memory leads to the next

    The Graph engine stores memory as a graph, so the agent can traverse from one memory to the ones connected to it.

  • By number

    Numbers are remembered as they were

    The Timeseries engine keeps the numerical facts the agent needs, like a history of what it believed and when.

Make it yours

Variations worth trying

  • Start with sessions and keyword recall, and add similarity and the graph later.
  • Keep one memory per agent, or share a pool across agents, and see which behaves better.
  • Leave scheduling out until the agent has something worth doing on its own.

Starting point

Ask your coding agent for your version

Use this prompt as a starting point, then change whatever does not fit your idea.

Build persistent memory for an agent that records its sessions, compacts them into searchable, comparable, traversable memories, and acts under its own identity and permissions.

Use these Ultrahost building blocks, in this flow.

When an agent holds a conversation:
1. Federated Auth & User Management: The Identity engine lets the agent identify itself and validate who it is interacting with.
2. Authorization Layer: The Authorization engine defines what the agent is allowed to do.
3. LLM Plane: The LLM engine gives the agent a model for its reasoning and for choosing which tools to use.
4. RAG (only when the agent needs information beyond its memory): The RAG engine offers the agent an alternative source of information to draw on.
5. Session Storage for Agents: The Sessions engine records the conversation, whether the agent is built with LangGraph, Claw, Hermes, or something custom.

When a session becomes a memory:
1. Cron: The Cron engine lets the agent schedule when its memories are compacted, so it happens without anyone asking.
2. LLM Plane: The LLM engine provides the model that distills a long session into a compact memory.
3. File Server: The File engine stores the compacted memories so they outlast the session they came from.
4. Schemas & Ontology Versioning: The Semantic engine lets the agent understand what the stored data means and how it relates to other documents.

When the agent remembers:
- By keyword (Search Engine): The Search engine indexes the compacted memories so the agent can recall them by the words they contain.
- By similarity (Vector DB): The Vector engine lets the agent find memories that resemble the situation in front of it.
- By connection (Graph Database): The Graph engine stores memory as a graph, so the agent can traverse from one memory to the ones connected to it.
- By number (Timeseries Database): The Timeseries engine keeps the numerical facts the agent needs, like a history of what it believed and when.

Treat this as a starting point. Keep the parts that fit my idea and adapt the rest.

Next example

Searchable & Connected Data