Phase 7: Agent Memory Systems · 60 min · Python · Anthropic SDK
Personalization via Memory
Personalization is the product moat for AI assistants — and it's built on memory, not model size.
Hiring signal: Personalization is the product moat for AI assistants. Companies like Inflection, Character.ai, and enterprise assistant products invest heavily in memory-driven personalization. Engineers who can build this infrastructure — structured profiles, implicit learning, and injected context — are building the differentiation layer of AI products.
What you will learn
- Build a structured UserProfile that the agent reads and updates across sessions
- Implement implicit preference learning from behavioral signals without requiring explicit user input
- Design a personalization injection pattern: compress the profile to under 500 tokens and inject into every system prompt
The Problem
Netflix knows your viewing habits. Spotify knows your music taste. Your AI assistant knows... nothing. It asks for your expertise level on every session. It explains concepts you already understand. It gives verbose prose to someone who lives in bullet points. It ignores the project you've mentioned 20 times.
The gap is not model capability — it's memory infrastructure. An expert Python developer asking about async patterns should get a concise, high-signal answer that assumes deep knowledge and references their current project context. A junior developer asking the same question should get a step-by-step explanation with analogies.
The same model produces dramatically different quality depending on what context is injected into the system prompt. This lesson builds the infrastructure to inject the right context — automatically, at every turn, improving over time.
Structured user profile
The UserProfile schema captures everything that should influence agent behavior: expertise_level (novice/intermediate/expert), communication_style (prefers_brevity, prefers_bullets, wants_code_examples, detail_level), domain_focus, ongoing_projects, stated_goals, and explicit_preferences. It also tracks implicit_signals from behavioral data. This structured profile is compressed to under 500 tokens and injected into every system prompt.
Structured User Profile Schema
A minimal but production-ready profile schema:
@dataclass
class UserProfile:
user_id: str
name: str
expertise_level: str # novice | intermediate | expert
communication_style: CommunicationStyle # prefers_brevity, prefers_bullets, detail_level
domain_focus: list[str] # ["healthcare AI", "data engineering"]
ongoing_projects: list[Project]
stated_goals: list[str]
explicit_preferences: dict # {"sql_style": "use EXPLAIN ANALYZE"}
implicit_signals: dict # {"revision_count": 3, "code_copies": 7}
last_updated: float
Each field serves a purpose:
expertise_level determines how much background to assume and whether to include definitionscommunication_style controls format and length — a "prefers_brevity + prefers_bullets" user gets a different response than a "high detail_level + prefers_analogies" userongoing_projects lets the agent reference current work without the user re-explaining context each session ("for your Patient Record RAG System, you'd use pgvector's <-> operator...")explicit_preferences holds direct user statements ("I always use EXPLAIN ANALYZE")implicit_signals accumulates behavioral evidence without user intervention
The profile is updated by both explicit statements ("I prefer brevity") and implicit signals (user consistently revises responses to be shorter). Behavioral signals are more reliable than stated preferences for communication style — people often claim preferences they don't actually exhibit.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Implicit Preference Learning, Personalization Injection, Build It, What to Practice — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy