Skip to main content
Open in Kaggle  Open in Colab  Download Notebook
This documentation page is also available as an interactive notebook. You can launch the notebook in Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the above links.
Create an AI agent that remembers important information across conversations.

Problem

You want to build an AI agent that can store and recall important information—user preferences, key facts, or context from previous conversations.

Solution

What’s in this recipe:
  • Store memories with embeddings for semantic search
  • Retrieve relevant memories based on conversation context
  • Use @pxt.query for retrieval functions
This pattern is inspired by Pixelbot and Pixelmemory.

Setup

Created directory ‘agent_demo’.
<pixeltable.catalog.dir.Dir at 0x32a0c6390>

Create memory bank

Created table ‘memories’.

Define retrieval function

Store some memories

Inserting rows into `memories`: 5 rows [00:00, 590.53 rows/s]
Inserted 5 rows with 0 errors.
5 rows inserted, 15 values computed.

Create conversation table with memory retrieval

Created table ‘conversations’.
Added 0 column values with 0 errors.
No rows affected.
Added 0 column values with 0 errors.
No rows affected.
Added 0 column values with 0 errors.
Added 0 column values with 0 errors.
No rows affected.

Chat with memory-aware agent

Inserting rows into `conversations`: 3 rows [00:00, 1047.88 rows/s]
Inserted 3 rows with 0 errors.
3 rows inserted, 18 values computed.

Explanation

Memory-aware agent architecture:
User Message → Retrieve Memories → Build Prompt → LLM Response
                    ↓
            Memory Bank (with embeddings)
Key components:
Adding new memories:

See also

Last modified on June 24, 2026