PyCon India 2025

Memory is the Agent: Architecting Stateful Reasoning in Python
2025-09-13 , Track 1

Today’s AI agents generate, but they don’t remember. They hallucinate, forget goals, and can’t recover across tasks. Why? Because they’re stateless.

In this talk, we reframe memory as the core control loop of intelligent agents, not just a retrieval layer.


What You’ll Learn

  • How to architect persistent memory in Python using:
  • Redis (short-term memory buffers)
  • Vector databases (semantic recall)
  • Structured state buffers (long-term identity)
  • Design patterns for:
  • Episodic vs. semantic memory modeling
  • TTL-based forgetting + reinforcement
  • Memory-aware retries, planning, and reflection

Who This Is For

Whether you're building:

  • a chatbot
  • an LLM copilot
  • or an autonomous workflow agent

This talk will shift your lens from prompt engineering to memory engineering.


Core Message

Memory isn’t an optimization.
It’s the agent.


Memory is the Agent: Architecting Stateful Reasoning in Python


0–3 min: Setting the Problem

Title: Why Today’s Agents Fail
Goal: Hook the audience with a crisp, emotional insight: “Every agent today is a goldfish.”
Content:
* Brief demo or real-world failure case: an LLM forgets previous tasks
* Frame the core problem: agents are stateless, can’t reflect, retry, or adapt


3–8 min: Memory as Cognition (Epistemic Foundations)

Title: Not Retrieval: Reasoning
Goal: Shift the frame from “RAG = memory” to “memory = agent state”
Content:
* Define memory types: working, semantic, episodic, symbolic
* Introduce cognitive science foundations (from Mem0, SALM, Episodic Memory research)
* Explain why memory is necessary for identity, planning, and belief updates


8–14 min: System Architecture in Python

Title: Building Memory in Practice
Goal: Bridge theory to code: show how memory works in real infra
Content:
* Redis for short-term/working memory (task buffers, TTL)
* Vector DBs (Chroma/Faiss) for semantic memory (retrieval with decay)
* JSON/SQLite/Postgres for episodic traces (task logs, session recall)
* TTLs, reinforcement, expiry logic
* Diagrams: control loop → memory → planner → action


14–20 min: Symbolic Layer + Planning

Title: From Storage to Structure
Goal: Show how symbolic memory enables higher-order reasoning
Content:
* Use graph-based or metagraph memory (e.g., goals, subgoals, belief nodes)
* Reuse of planning queues, retry trees
* How belief revision and contradiction handling are wired


20–24 min: Live Demo

Title: Memory in Action
Goal: Prove the point visually
Content:
* Show an agent remembering tasks across sessions
* Show ra etry loop that consults past failure logs
* Show TTL-based forgetting in action (agent "forgets" old tasks)


24–28 min: Design Patterns & Trade-offs

Title: What Breaks and Why
Goal: Preempt reviewer questions and engineering pain
Content:
* Memory consistency, replay bugs
* Latency vs recall accuracy tradeoff
* Cost (vector DB vs Redis vs local JSON) comparison


28–30 min: Close Strong

Title: From Prompt Engineering to Memory Engineering
Goal: Leave the audience with a mental model shift
Content:
* “Prompt chaining is a crutch. Stateful reasoning is a system.”
* Share resources: Mem0, Redis agent stack, vector TTL pattern
* Call to action: adopt a memory-first design for agents that evolve



Prerequisites

Familiarity with Python and basic concepts in GenAI (e.g., prompts, embeddings, vector DBs). Prior exposure to Redis or retrieval-augmented generation (RAG) is helpful but not required.

Target Audience

Intermediate

I'm Archit Singh, a Senior Backend Engineer at Tarka Labs with 8+ years of experience building high-concurrency systems, distributed infrastructure, and GenAI-powered pipelines. I specialize in designing resilient backend architectures using Python, Redis, Kafka, Postgres, and vector DBs. I strongly focus on system design, infra observability, and real-world autonomy in AI agents.

I’ve led the development of scalable LLM agent platforms, built memory-aware retry loops, and designed stateful execution layers for copilots and multi-agent workflows. I’m passionate about bridging cognitive architecture with production-grade infra, turning stateless chains into real systems that remember, reflect, and evolve.