Skip to content

Add cognee + flyte sleep/wake memory store tutorial#249

Open
AdilFayyaz wants to merge 8 commits into
mainfrom
adil/memory-store-app
Open

Add cognee + flyte sleep/wake memory store tutorial#249
AdilFayyaz wants to merge 8 commits into
mainfrom
adil/memory-store-app

Conversation

@AdilFayyaz

@AdilFayyaz AdilFayyaz commented May 26, 2026

Copy link
Copy Markdown
Contributor

Motivation

Adds a new end-to-end tutorial demonstrating a production-grade sleep/wake memory architecture for AI agents. Showcases flyte.map.aio, flyte.io.Dir, report=True, cache="auto", and flyte.app.AppEnvironment in a realistic multi-session agentic application.

Summary

  • memory_store.py — audited, versioned, file-based memory store synced via flyte.io.Dir; prefix-based access control, optimistic concurrency (SHA-256 preconditions), immutable version history, and multi-session isolation under user/sessions/<name>/memories/
  • agent.py — staged proposal pipeline: untrusted writes land in staging/sessions/<session>/inbox/, validated against prompt-injection heuristics, then auto-promoted by the sleep cycle
  • workflow.py — Flyte tasks: ingest_url (BFS crawl + Cognee graph indexing), consolidate_cluster (parallel Claude memory merges via flyte.map.aio), sleep_cycle (scheduled every 6h), wake_cycle (per-question retrieval with raw-file fallback when Cognee graph is incomplete), summarize_chat_session
  • app.py — Streamlit UI served via flyte.app.AppEnvironment; session selector, URL ingestion, inline memory proposal cards (accept/edit/deny), sleep cycle trigger; fixes _configure_cognee_runtime missing from local retrieval path and SearchResult text extraction using str(r) instead of r.search_result

Test Plan

  • python v2/tutorials/cognee_memory_store/memory_store.py — built-in self-check (write, concurrency, access control, audit)
  • SELF_CHECK=true python v2/tutorials/cognee_memory_store/app.py — app self-check
  • uv run v2/tutorials/cognee_memory_store/app.py — deploys to Union; ingest a URL, ask a question, verify ctx_chars > 0 in debug captions (AI_MEMORY_STORE_DEBUG=1)
  • Create two sessions, stage a memory in one, trigger sleep cycle, confirm it appears only under user/sessions/<session>/memories/ and not the other
  • Check "Topic knowledge base" expander shows all ingested files

Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
@AdilFayyaz AdilFayyaz changed the title Memory Store App feat: add cognee + flyte sleep/wake memory store tutorial May 27, 2026
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
@AdilFayyaz AdilFayyaz changed the title feat: add cognee + flyte sleep/wake memory store tutorial Add cognee + flyte sleep/wake memory store tutorial May 27, 2026
@AdilFayyaz AdilFayyaz self-assigned this May 27, 2026
@AdilFayyaz AdilFayyaz requested a review from cosmicBboy May 27, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant