Memory & Context

Configure how agents maintain state, access history, and retrieve context across sessions.

Memory types

Session memory

Cleared after each agent run. Use for stateless tasks where no state should persist between invocations.

memory:
  type: session
  max_tokens: 8192

Persistent memory

State is retained across runs in a configured backend store. Use for agents that need to remember context, build up knowledge, or maintain state over time.

memory:
  type: persistent
  backend: postgres
  namespace: my-agent
  ttl: 30d

Retrieval-augmented

Agent queries an external knowledge store at runtime to retrieve relevant context. Use for agents that need access to large knowledge bases without holding everything in the context window.

memory:
  type: retrieval
  store: vector_db
  embedding_model: configured_embedding_model
  top_k: 10
  namespace: company-knowledge

Backend configuration

BackendUse caseNotes
PostgreSQLProduction persistent memoryRecommended for production
SQLiteDevelopment, single-nodeZero configuration
RedisFast session memoryIn-memory, volatile
Vector DBRetrieval-augmentedpgvector, Qdrant, Weaviate