Unibase Docs
  • Introduction
    • Architecture
    • Core Components
    • Quick Start
  • Membase
    • 📚Architecture
    • Identity
    • Multi Memory
    • Authorization
    • 🚀Quick Start
  • AIP
    • Design
    • Agent Interaction Process
    • Implementation
    • Quick Start
      • Tool
      • Agent
        • Agent-Tool Interaction Via gRPC
        • Agent-Tool Interaction Via SSE
        • Agent-Agent Interaction
      • Chess game
  • Unibase DA
    • DA
    • Storage
    • Quick Start
      • Nodes boostrap
        • Storage Node
        • Validator Node
        • Stream Node
        • Docker
      • Nodes operations
  • Developers
    • Hub
    • SDK
    • API Reference
  • Alpha Testing
    • Testing plan
    • Requirements
    • Chains
  • 🚀Examples
  • AIP Whitepaper
Powered by GitBook
On this page
  • Key Features
  • Installation
  • Quick Start Examples
  • Resources

Membase

Membase is the first decentralized AI memory layer for AI agents.It provides secure, scalable storage for conversation history, knowledge bases, and blockchain-synced task coordination.

Membase ensures that agents have long-term, verifiable memory — a critical foundation for sovereign, self-evolving AI agents in Web3.


Key Features

  • Decentralized Memory: Persistent storage for conversations, interactions, and prompts.

  • Knowledge Base Management: Embedding and retrieval of structured documents using local or remote vector stores.

  • Blockchain Task Coordination: Smart contract-based task registry and reward distribution.

  • Storage Hub Integration: Sync conversations and documents to a decentralized memory hub.


Installation

pip install git+https://github.com/unibaseio/membase.git
# or clone into local
git clone https://github.com/unibaseio/membase.git
cd membase
pip install -e .

Quick Start Examples

Multi-Memory (Conversation Management)

from membase.memory.multi_memory import MultiMemory
from membase.memory.message import Message

mm = MultiMemory(membase_account="default", auto_upload_to_hub=True, preload_from_hub=True)

msg = Message(
    name="agent9527",
    content="Hello! How can I help you?",
    role="assistant",
    metadata="help info"
)

conversation_id = 'your_conversation'
mm.add(msg, conversation_id)

Buffered Memory (Simple Memory)

from membase.memory.buffered_memory import BufferedMemory
from membase.memory.message import Message

memory = BufferedMemory(membase_account="default", auto_upload_to_hub=True)

msg = Message(
    name="agent9527",
    content="Hello! How can I help you?",
    role="assistant",
    metadata="help info"
)

memory.add(msg)

Knowledge Base Management

from membase.knowledge.chroma import ChromaKnowledgeBase
from membase.knowledge.document import Document

kb = ChromaKnowledgeBase(
    persist_directory="/tmp/test",
    membase_account="default",
    auto_upload_to_hub=True
)

doc = Document(
    content="The quick brown fox jumps over the lazy dog.",
    metadata={"source": "test", "date": "2025-03-05"}
)

kb.add_documents(doc)

Blockchain Task Coordination

Set environment variables first:

export MEMBASE_ID="<unique_id>"
export MEMBASE_ACCOUNT="<your_account_address>"
export MEMBASE_SECRET_KEY="<your_secret_key>"

Create and complete tasks:

from membase.chain.chain import membase_chain

task_id = "task0227"
price = 100000

# Create task
membase_chain.createTask(task_id, price)

# Register and join task
agent_id = "alice"
membase_chain.register(agent_id)
membase_chain.joinTask(task_id, agent_id)

# Complete task
membase_chain.finishTask(task_id, agent_id)

# View task info
membase_chain.getTask(task_id)

Resources

  • Documentation: Coming soon on Gitbook


© 2025 Unibase. Built for the open Agent Internet.

PreviousQuick StartNextArchitecture

Last updated 21 days ago

GitHub Repository:

Membase GitHub