Memory
Note: The sandbox forgets the files when the run ends. On your machine, the memory files remain.
Turn memory on
Memory lets a later task see what an earlier task was told.
memory=True stores the conversation in files. No extra package is required.
Example
from praisonai import Agent
agent = Agent(
name="Personal Assistant",
instructions="You are a helpful assistant that remembers user preferences.",
memory=True,
)
print(agent.start("My name is Amina and I prefer dark mode"))
print(agent.start("What is my name?"))Example explained
- memory=True — File-based memory for this agent.
Stricter recall
On your machine, memory persists across start calls. In Try it Yourself both turns run in one script — practise the two-step pattern you will use locally.
Example
from praisonai import Agent
agent = Agent(
name="Prefs",
instructions="Remember names the user gives you.",
memory=True,
)
print(agent.start("My favourite editor is VS Code."))
print(agent.start("Which editor did I prefer?"))Example explained
- from praisonai import Agent — Imports Agent needed for stricter recall.
- Agent(…) — Instantiates the Agent configured for stricter recall.
- .start(…) — Executes the configured run for stricter recall and returns the result.
Reference: documentation