| license | Apache-2.0 |
| name | always-on-agent-architecture |
| description | Architecture and systems design for building always-on AI agents with episodic memory. Covers the memory hierarchy (core/recall/archival), persistence layers, agent server infrastructure, vector stores, and framework selection. Provides concrete deployment patterns for agents that maintain identity and learn across sessions. Activate on: "always-on agent", "persistent agent architecture", "episodic memory system", "agent memory design", "long-running agent", "stateful agent", "agent that remembers", "MemGPT architecture", "Letta deployment", "/always-on-agent-architecture". NOT for: choosing what data to feed the agent (use always-on-agent-inputs), brainstorming applications (use always-on-agent-applications), safety and privacy concerns (use always-on-agent-safety), general agentic patterns (use agentic-patterns).
|
| allowed-tools | ["Read","Write","Edit","Bash","Glob","Grep","Task","WebSearch","WebFetch"] |
| metadata | {"category":"AI & Agents","tags":["always-on","persistent-agent","episodic-memory","architecture","memory-systems","stateful-agents","infrastructure"],"pairs-with":[{"skill":"always-on-agent-inputs","reason":"Architecture defines what memory stores exist; inputs defines what fills them"},{"skill":"always-on-agent-safety","reason":"Persistent memory creates unique privacy and cost risks that must be designed in"},{"skill":"background-job-orchestrator","reason":"Always-on agents need daemon-style process management and supervision"},{"skill":"agentic-patterns","reason":"Core agent loop patterns apply within each reasoning cycle of the persistent agent"},{"skill":"agent-creator","reason":"The agent-creator skill handles building the agent itself; this skill handles the persistence layer"}]} |
| category | Agent & Orchestration |
| tags | ["always","agent","architecture","deployment","ai","design"] |
/always-on-agent-architecture — Building Agents That Never Forget
You are designing the architecture for an always-on AI agent with episodic memory. This is not a chatbot with a long context window. This is a system that persists state across sessions, manages its own memory hierarchy, runs as a service, and maintains identity over weeks and months. The core insight: treat the LLM as a CPU that operates on managed memory, not as a stateless function.
Decision Points
Memory Framework Selection Tree
Q1: Do you want a full agent runtime (server, APIs, tools)?
├─ Yes → Use Letta (most complete, production-ready)
└─ No, I have my own agent loop
├─ Q2: Do you need temporal/relationship tracking?
│ ├─ Yes → Use Zep/Graphiti (best temporal knowledge graph)
│ └─ No → Go to Q3
│ ├─ Q3: Do you need graph + vector hybrid?
│ │ ├─ Yes → Use Mem0 (graph mode)
│ │ └─ No → Go to Q4
│ │ ├─ Q4: Already on LangGraph?
│ │ │ ├─ Yes → Use LangMem
│ │ │ └─ No → Use pgvector or Chroma
└─ Want zero dependencies? → Custom SQLite + local embeddings
Core Memory Eviction Triggers
| Trigger | Threshold | Action |
|---|
| Size Overflow | Core memory > 4KB | Summarize least-recent block, move summary to archival |
| Age Decay | Data unused > 30 days | Mark for compaction review |
| Relevance Drop | Access score < 0.3 | Move to archival memory with decay tag |
| User Override | User says "forget X" | Immediate removal + archival tombstone |
| Conflict Detection | Contradictory facts stored | Prompt agent to reconcile or ask user |
Vector DB Selection Criteria
If query_latency_requirement < 10ms AND data_size > 100M vectors:
→ Use Qdrant (optimized for speed)
Else if already_using_postgresql:
→ Use pgvector (single DB, simpler ops)
Else if need_hybrid_search (keyword + semantic):
→ Use Weaviate (best hybrid)
Else if zero_ops_preferred:
→ Use Pinecone (fully managed)
Else:
→ Use Chroma (local-first, simple API)
Memory Tier Routing Decision
Input: User message or agent observation
│
├─ Contains identity/preference update?
│ └─ Yes → Update core memory, persist immediately
├─ Requires conversation context?
│ └─ Yes → Search recall memory (conversation history)
├─ Needs factual knowledge?
│ └─ Yes → Search archival memory (vector store)
└─ External data needed?
└─ Yes → Use external tools (APIs, files, etc.)