Inspiration

The idea for MemoryOS was born out of a critical flaw in today's AI agent ecosystem: amnesia in production.

As AI agents transition from simple single-turn chatbots into autonomous entities that write code, manage pipelines, and execute complex business logic, they hit a hard wall. Standard stateless architectures force agents to start from scratch every session, discarding user context, prior decisions, and operational history. When an agent forgets, it degrades customer experience, repeats expensive reasoning steps, and fails in production workflows where continuity is non-negotiable.

Existing workarounds—such as stitching together disjointed vector databases, temporary key-value caches, and custom operational DBs—introduce severe data consistency gaps, operational bloat, and single points of failure.

What it does

Persistent State & Decision Logging: Stores full conversation logs, active task execution states, user-defined preferences, and historical agent reasoning paths across multiple sessions using CockroachDB's distributed SQL engine. Unified Semantic & Relational Search: Employs CockroachDB Distributed Vector Indexing to generate and query vector embeddings alongside structured operational data. The agent retrieves past context, code artifacts, and project documentation via hybrid semantic search without needing a separate vector database. Secure Tool Access & Execution: Connects directly to CockroachDB via the CockroachDB Cloud Managed MCP Server, providing standard Model Context Protocol access with read/write safety, RBAC, and full audit logging for agent operations.Serverless Agent Execution: Operates on AWS Lambda for event-driven compute and utilizes Amazon Bedrock for foundation model reasoning, allowing the agent to scale down to zero when idle while remaining instantly accessible.Autonomous Environment Management: Leverages the agent-ready ccloud CLI to allow the agent (or operational workflows) to inspect cluster health, monitor query usage, and manage cloud backup states dynamically via JSON outputs.

How we built it

To build this agentic AI architecture, you first set up CockroachDB as the central transactional memory layer by defining schemas for session state, vector embeddings, and audit trails, while wrapping enterprise tools in Model Context Protocol (MCP) servers to give agents secure, standardized data access. Next, you construct the agent's core reasoning engine using the Strands Agents SDK paired with AWS Bedrock foundation models, packaging this execution logic inside ephemeral AWS Lambda functions that pull context from CockroachDB on invocation and push updates back upon completion. Finally, you implement the Continuum resilience pattern by committing state checkpoints to CockroachDB before and after every tool or LLM interaction, ensuring that if a Lambda container crashes mid-cycle, a new process can rehydrate from the last database checkpoint, seamlessly resume execution, and preserve a fully observable audit trail.

Challenges we ran into

Building this architecture presents major challenges around transaction contention when concurrent agents write to shared state tables in CockroachDB, cold-start latency and 15-minute timeouts when loading heavy agent runtimes into ephemeral AWS Lambda functions, and context saturation caused by verbose tool payloads delivered over the Model Context Protocol (MCP). Additionally, teams struggle with preventing partial writes and state drift when process crashes interrupt multi-step reasoning cycles mid-step, as well as mitigating prompt injection and privilege-escalation risks when granting autonomous agents write-access to core enterprise systems.

Accomplishments that we're proud of

We successfully demonstrated that long-running agent workflows can seamlessly survive mid-execution container crashes by anchoring persistent state in CockroachDB, while simultaneously creating a deterministic, compliance-ready audit trail for every reasoning step and tool invocation. By consolidating semantic vector search and transactional session tracking inside a single CockroachDB database, we eliminated the architectural complexity of dedicated vector stores. Additionally, we established secure, standardized enterprise integrations through Model Context Protocol (MCP) adapters and enabled highly concurrent serverless scaling with AWS Lambda and the Strands Agents SDK, relying on serializable ACID guarantees to completely prevent state corruption across parallel agent execution.

What we learned

We learned that long-term agent resilience depends fundamentally on data architecture rather than LLM context windows, proving that anchoring state and semantic memory in a transactional database like CockroachDB is essential for production stability. Strict ACID guarantees proved non-negotiable, as concurrent multi-agent writes will cause race conditions and memory drift without serializable isolation. Adopting the Model Context Protocol (MCP) drastically simplified our integrations by giving agents a standardized, secure interface across enterprise systems, while designing for automatic failure recovery via transactional checkpoints ensured ephemeral AWS Lambda tasks could crash and resume without context loss. Finally, we discovered that context hygiene is critical for cost and performance, requiring aggressive filtering and summarization of tool outputs to prevent prompt bloat and keep inference latency low.

What's next for MemoryOS

The next step for MemoryOS is to evolve it into a universal memory layer for AI agents, allowing them to remember important user preferences, conversations, goals, and decisions across sessions. We plan to add smarter memory retrieval and consolidation, a dashboard for users to view, edit, and delete memories, strong privacy controls, and seamless MCP/API integrations. By deploying MemoryOS with CockroachDB and AWS, we aim to make it scalable, reliable, and capable of supporting multiple AI agents while providing users with a more personalized and consistent AI experience.

Built With

  • cockroachdb
Share this project:

Updates

Submission history