Documentation Index
Fetch the complete documentation index at: https://docs.definable.ai/llms.txt
Use this file to discover all available pages before exploring further.
Create an agent that remembers past conversations using a SQLite-backed memory store.
Create the agent
from definable.agent import Agent
from definable.memory import Memory, SQLiteStore
agent = Agent(
model="gpt-4o",
instructions="You are a helpful assistant with persistent memory.",
memory=Memory(store=SQLiteStore("./memory.db")),
)
# First conversation — the agent stores this
output = agent.run("My name is Alice and I work at Acme Corp.", user_id="alice")
print(output.content)
# Second conversation — the agent recalls
output = agent.run("Where do I work?", user_id="alice")
print(output.content) # "You work at Acme Corp."
Export your API key
export OPENAI_API_KEY=sk-***
Run
The agent stores facts from the first conversation and recalls them in the second.
For quick testing without persistent storage, use memory=True:agent = Agent(model="gpt-4o", memory=True) # InMemoryStore