Framework

From Architecture to Code: Implementing DREAM as a Python Framework

In recent weeks, I published a technical study proposing the DREAM Architecture, an architecture focused on long-term memory organization for artificial intelligence agents. The proposal emerged from a common concern in LLM-based systems: the heavy reliance on short context windows, the high energy cost of maintaining large volumes of information in active memory, and the tight coupling between models, memory, and infrastructure.

While the paper presented the idea from a conceptual and architectural perspective, it quickly became clear to me that an architecture only becomes truly understandable when it is forced to exist in code. Ideas that appear solid on paper often reveal ambiguities, hidden coupling, or structural weaknesses once they need to be implemented, even in a minimal form.

From this realization came the decision to build a reference implementation of the DREAM Architecture, structured as a Python framework.

 Why a reference implementation? 

The goal of this framework is not to provide a production-ready system, nor to compete with existing vector storage solutions or AI infrastructure platforms. The motivation is much simpler, and at the same time more rigorous.

A reference implementation exists to answer fundamental questions:

 By translating the architecture into a minimal framework, I was forced to make explicit decisions that, on paper, can remain implicit. This process alone already functions as a form of architectural validation. 

 Memory as a first-class component 

The central idea behind DREAM is to treat memory as an independent, first-class component, rather than as an internal detail of the model or a mere extension of the context window.

In the framework, this is reflected in a simple and stable API, where agents interact with memory without needing to know anything about storage mechanisms, indexing strategies, or retrieval implementations. Memory becomes a logical service, decoupled from the model that consumes it.

This separation does not solve all problems related to intelligent agents, but it creates a healthier architectural space for experimentation, especially when thinking about systems that must scale over time, data volume, and energy consumption.

 Modular architecture and pluggable backends 

For this separation to be real, and not merely conceptual, the framework was designed with an explicit memory backend abstraction. The interface defines only two essential behaviors: storing episodes and retrieving relevant information.

The current implementation includes only an in-memory backend, intentionally simple. It is not optimized, persistent, or intelligent. Its role is to serve as a reference and to ensure that the architecture supports, from the very beginning, the replacement of internal mechanisms without impacting the public API.

This design allows future exploration of additional backends: persistent storage, vector databases, embeddings, or even distributed approaches. The framework does not assume these solutions, but it was built to not prevent their existence.

 Intentional limitations 

It is important to clarify what this project is not.

The DREAM framework is not a production system, not an AGI solution, not a replacement for modern vector databases, and not an attempt to solve memory challenges in AI by itself. It is intentionally minimal.

This choice is deliberate. In early stages, architectural clarity is more valuable than functional complexity. The purpose of this framework is to serve as a foundation for experimentation, study, and technical discussion, not as a final product.

 Relation to the original study 

This framework is directly aligned with the technical study that proposed the DREAM Architecture. While the paper presents the vision, principles, and theoretical motivations, the code offers a concrete starting point for those interested in exploring these ideas in practice.

Technical paper:
 https://zenodo.org/records/17619917

Framework repository:
 https://github.com/MatheusPereiraSilva/dream-framework

 Final considerations 

Turning an architecture into code is an exercise in humility. The process exposes limitations, forces decisions, and often dismantles certainties that once seemed solid. At the same time, it is one of the most honest ways to test whether an idea deserves further development.

The DREAM framework is released in this spirit: not as a definitive answer, but as a tool for learning and validation. Technical feedback, questioning, and critique are not only welcome, but essential for the maturation of this proposal.

MP

Written by Pereira, Matheus

December 16, 2025