Skip to main content
A minimal comparison of two agent-memory patterns: one agent that remembers the active session and one agent that only reads from the persistent knowledge graph. Before you start:
  • Complete Quickstart or have Cognee installed and configured
  • Ensure you have LLM Providers configured
  • Be familiar with the remember() workflow

Shared Setup

Both agents use the same LLMGateway helper. The updated example starts clean with forget(everything=True), stores one baseline fact with remember(), and then compares session memory against graph memory. LLMGateway.acreate_structured_output() automatically picks up whatever memory the decorator retrieved and prepends it to the text input. In this flow, save_session_traces=True lets the support agent persist session traces into the knowledge graph after enough turns.

Compare the Agents

This agent relies on session memory instead of graph retrieval. It can remember the recent conversation, and after enough turns its saved traces are persisted into the knowledge graph.

Full Example

The decorator does not create memory by itself. The example works because baseline graph memory is stored first with remember(), and the session-aware support agent persists traces only after those conversation turns happen.

Agent Memory Decorator

Concept overview and parameter reference

Low-Level LLM

LLMGateway for direct model calls

Remember

Store memory before using the decorator

Sessions

Learn how trace-backed session context behaves