Every Assistant comes with built-in memory that can be used to access the Chat History or LLM Messages. Access the assistant memory using assistant.memory

  • Chat History: The messages between the user and LLM.
  • LLM Messages: The full list of messages sent to the LLM, including system prompt, tool calls etc.


from rich.pretty import pprint
from phi.assistant import Assistant, AssistantMemory

assistant = Assistant()

# -*- Print a response
assistant.print_response("Share a 5 word horror story.")

# -*- Get the memory
memory: AssistantMemory = assistant.memory

# -*- Print Chat History
print("============ Chat History ============")

# -*- Print LLM Messages
print("============ LLM Messages ============")

AssistantMemory only lasts while the session is active. To provide memory across sessions, add Storage to the Assistant.