jypi
  • Explore
ChatWays to LearnMind mapAbout

jypi

  • About Us
  • Our Mission
  • Team
  • Careers

Resources

  • Ways to Learn
  • Mind map
  • Blog
  • Help Center
  • Community Guidelines
  • Contributor Guide

Legal

  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Content Policy

Connect

  • Twitter
  • Discord
  • Instagram
  • Contact Us
jypi

© 2026 jypi. All rights reserved.

Building Stateful and Personalised Agents with ADK
Chapters

1Course Introduction and ADK Overview

2Foundations: Agent Concepts, State, and Memory

Agent roles and behavior modelsTypes of memory: short, episodic, semanticRepresenting state and contextTemporal reasoning and session modeling

3ADK Architecture and Core Components

4Designing Memory Schemas and State Models

Courses/Building Stateful and Personalised Agents with ADK/Foundations: Agent Concepts, State, and Memory

Foundations: Agent Concepts, State, and Memory

4 views

Cover core concepts including agent architectures, types of memory and state, temporal modeling, and strategies for representing user context and intents.

Content

2 of 4

Types of memory: short, episodic, semantic

Types of Memory for Agents: Short, Episodic & Semantic
4 views
beginner
stateful
memory
computer science
humorous
gpt-5-mini
4 views

Versions:

Types of Memory for Agents: Short, Episodic & Semantic

Watch & Learn

AI-discovered learning video

YouTube

Start learning for free

Sign up to save progress, unlock study materials, and track your learning.

  • Bookmark content and pick up later
  • AI-generated study materials
  • Flashcards, timelines, and more
  • Progress tracking and certificates

Free to join · No credit card required

Types of Memory for Agents: short, episodic, semantic — the trio that actually remembers

"If stateful agents are people, memory is everything from the sticky note on their forehead to the dusty photo album in the attic."

You're already familiar with agent roles, behavior models, and the big stateless vs stateful choice from earlier modules. Now we zoom into the how of remembering: the three memory flavors every practical ADK-based agent needs — short (working) memory, episodic memory, and semantic memory. We'll cover what each is, why it matters for personalization, how they interact, and pragmatic hints for implementing them in the ADK ecosystem.


Quick map: why we split memory

Think of building agents like running a household. You want quick access to what you're cooking (short memory), a scrapbook of milestone moments (episodic), and a knowledge cabinet of facts and preferences (semantic). Each layer has different lifetimes, structures, and retrieval strategies — and mixing them up is how agents get weird or creepy.

The three types, demystified

1) Short memory (working memory)

  • What it is: Immediate conversational context and transient task state. The stuff the agent needs right now.
  • Duration: Seconds to minutes (until the session or task ends, or until explicitly flushed).
  • Structure: Lightweight key-value pairs, recent messages, in-memory buffers.
  • Examples: Latest user utterance, last 3 system actions, intermediate outputs for a multi-step plan.

Why it matters: Short memory keeps the conversation coherent and lets the agent follow the thread without expensive lookups. It's the difference between "Oh — I remember you mentioned that" and "Wait, what were we talking about?"

Implementation note: store in process memory (cache) or ephemeral ADK context objects. Keep it small; it's read/write heavy and usually not persisted.

2) Episodic memory

  • What it is: Logged events and contextual snapshots tied to user sessions, moments, or interactions — basically the agent's diary.
  • Duration: Hours to years (configurable). More permanent than short-term, but can be pruned.
  • Structure: Time-stamped records: conversation transcripts, actions taken, decisions, user confirmations, notable events with metadata (channel, sentiment, outcome).
  • Examples: "User changed subscription on 2026-03-11", a troubleshooting session transcript, first-time onboarding steps.

Why it matters: Episodic memory supports long-range personalization, auditability, and continuity across sessions. It's what allows the agent to say "Last time we fixed X, you preferred method A".

Implementation note: store in a persistent store (event DB, document DB). Index by user ID and time; tag with topics and outcomes to accelerate retrieval.

3) Semantic memory

  • What it is: Generalized facts, concepts, and distilled user preferences derived from experience or external knowledge. Think of it as the agent's encyclopedia and user model merged.
  • Duration: Long-lived; evolved and updated over time.
  • Structure: Vector embeddings, structured user profiles, ontologies, rules, or feature stores.
  • Examples: "User prefers vegetarian recipes", embedding for user's product taste, knowledge that "premium tier -> 20% discount".

Why it matters: Semantic memory enables personalization without replaying entire conversations. It answers the question What do we know about this user that should shape future behavior?

Implementation note: common storage is a vector DB for embeddings (semantic search) paired with a relational or document store for structured profile fields.


Comparison at a glance

Attribute Short Memory Episodic Memory Semantic Memory
Lifetime Seconds–minutes Days–years Long-term (persistent)
Structure Key-value, buffers Time-stamped logs Embeddings, structured profiles
Use case Context, coherence Recall past events, audits Personality, preferences, facts
Storage In-memory cache Document DB / event store Vector DB + profile DB

How they interact — the pipeline

  1. User says something -> short memory updates (immediate context).
  2. If something notable happens (e.g., user confirms an address), create an episodic entry.
  3. Periodically or via triggers, consolidate recurring or stable info from episodic logs into semantic memory (update profile or embeddings).

This consolidation step is critical: it prevents the agent from endlessly re-storing the same trivial facts and converts repeated episodes into actionable preferences.

"Consolidation is the agent's version of 'learning from experience' — not just remembering, but abstracting what matters."


Practical ADK design patterns (pseudo-code + tips)

Pseudocode: Memory objects

short_memory = { recent_messages: [], task_state: {} }
episodic_store.save(user_id, { timestamp, event_type, payload })

# semantic update: run offline job or real-time rule
if count_events(user_id, 'liked_recommendation') > 3:
    semantic_profile.update(user_id, { preference: 'likes_recommendations' })

# retrieval: combine all three
context = short_memory.get(user_id)
episodes = episodic_store.query(user_id, last=30_days)
semantics = semantic_store.lookup(user_id)

# construct prompt or decision with weighted recall
prompt = build_prompt(context, retrieve_relevant(episodes), semantics)

Retrieval strategies

  • Always check short memory first for immediate context.
  • Use filters and recency when querying episodic (e.g., last 90 days for support issues).
  • Use semantic search (vector similarity) to fetch conceptually-related preferences or facts.
  • Merge results with priority: short > semantic (explicit user setting) > episodic (contextual history), unless a specific business rule overrides.

Best practices & pitfalls

  • Privacy by design: store only what you need, encrypt PII, support deletion requests. Episodic logs are gold for personalization but risky legally.
  • TTLs and pruning: set sensible lifetimes for episodic logs; compress or summarize old episodes into semantic facts.
  • Cost vs latency: short memory = cheap & fast; semantic vector search = cost & latency trade-offs; episodic queries = variable. Cache smartly.
  • Avoid leakage: don't automatically surface sensitive episodic details in prompts.
  • Interpretability: keep metadata on how semantic facts were derived (source episodes, confidence scores).

Short checklist for implementing memory in ADK

  1. Define what belongs in short vs episodic vs semantic for your agent.
  2. Choose storage tech: in-memory caches, document/event stores, vector DBs.
  3. Implement consolidation pipelines (episodic -> semantic).
  4. Add access controls, audit logs, and retention policies.
  5. Test retrieval relevance and update flows with real user data.

Final takeaway — make it human

  • Short memory keeps the conversation alive.
  • Episodic memory builds a chronological story of interactions.
  • Semantic memory stores what matters about the person.

Treat them as a symphony, not a haystack. When each plays its role, your ADK agent feels smart, respectful, and genuinely helpful — rather than the digital equivalent of that one friend who never remembers your birthday.

"Design memory well, and your agent will remember the important things without being a stalker about it."


Key next steps: map out a memory schema for your agent persona (what to store where), sketch consolidation triggers, and draft retention/privacy rules. We'll use this blueprint when we design behavior models tied to memory in the next module.

Flashcards
Mind Map
Speed Challenge

Comments (0)

Please sign in to leave a comment.

No comments yet. Be the first to comment!

Ready to practice?

Sign up now to study with flashcards, practice questions, and more — and track your progress on this topic.

Study with flashcards, timelines, and more
Earn certificates for completed courses
Bookmark content for later reference
Track your progress across all topics