import marvin
from marvin import Thread, Memory, Agent
# Create a memory for storing user preferences
user_preferences = Memory(key="user_preferences")
# Create an agent with this memory
assistant = Agent(
name="Personal Assistant",
instructions="You are a helpful assistant",
memories=[user_preferences]
)
# Use the agent in a thread
with Thread() as thread:
# The agent can access both thread context (recent conversation)
# and memory (long-term stored information)
assistant.run("Remember that I prefer dark mode")
assistant.run("What are my UI preferences?") # Will recall from memory