1
Create the agent
agent_memory.py
2
Install dependencies
3
Export your API key
4
Run
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Give an agent persistent memory across conversations.
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."
Install dependencies
pip install definable
uv pip install definable
poetry add definable
Export your API key
export OPENAI_API_KEY=sk-***
setx OPENAI_API_KEY sk-***
Run
python agent_memory.py
memory=True:agent = Agent(model="gpt-4o", memory=True) # InMemoryStore