WithMemory. Pick one backend per run.
| Backend | Entrypoint |
|---|---|
| Weaviate | go run ./agent_with_memory/weaviate |
| PostgreSQL + pgvector | go run ./agent_with_memory/pgvector |
task infra:weaviate:up / task infra:pgvector:up creates the memory class/table (AgentMemory / agent_memories) in addition to retriever schema. No seed rows — memories are written by agent runs.
Source: examples/agent_with_memory/
What it demonstrates
memory.DefaultConfigwith vector backendsMEMORY_STORE_MODE—ondemand(save_memorytool) vsalways(run-end extract)- Scope via
MEMORY_USER_ID(defaultdemo-user) — must match across runs you want to share - Telemetry:
total_memory_recalls/total_memory_storeswithSHOW_TELEMETRY=true
| Backend | Default store mode |
|---|---|
| Weaviate | always |
| pgvector | ondemand |
MEMORY_RECALL_ENABLED=false for store-only (skip load before LLM).
Setup
Fromexamples/:
curl -s http://localhost:8080/v1/schema | jq '.classes[].class' — expect Document and AgentMemory.
pgvector:
task infra:weaviate:down && task infra:weaviate:up.
Run behavior
- No CLI args — two runs in one process: run 1 stores a preference, run 2 recalls it.
- With args — single custom prompt.
task examples:local includes memory targets when infra is up.
Expected output
Two-run flow (no CLI args):SHOW_TELEMETRY=true:
Learn more
Memory
Store modes, scope, recall config
Retrieval
RAG with same vector infra