Memory
Give an agent multi-turn recall. Pass a backend name or an instance; the agent loads prior turns into context and persists each turn automatically.
from neuroagent import Agent
agent = Agent(provider="openai", memory="sqlite") # persists across restarts
agent.run("Hi, I'm Amit.")
agent.run("What's my name?") # → "Your name is Amit."
| Backend | memory= | Notes |
|---|---|---|
| In-process | "session" | Fast, ephemeral |
| SQLite | "sqlite" | Persistent, stdlib, multi-conversation |
| Redis | "redis" | Distributed (needs [redis] extra) |
| Vector | VectorMemory(embedder=...) | Semantic search over past messages |
from neuroagent.memory import SQLiteMemory, VectorMemory
from neuroagent.providers.openai import OpenAIProvider
# Explicit instances for full control:
agent = Agent(provider="openai", memory=SQLiteMemory("chat.db", conversation_id="amit"))
# Semantic recall: find the most relevant prior messages, not just the latest.
mem = VectorMemory(embedder=OpenAIProvider())
agent = Agent(provider="openai", memory=mem)
relevant = await mem.search("what did we decide about pricing?", k=3)
Want a custom backend? Implement the
Memory ABC
(load, append, search) and pass an instance — anywhere a
backend name is accepted, an instance works too.
NeuroAgent AI