Skip to content

Storage adapter for ElizaOS that enables storing agent data in Storacha Network

Notifications You must be signed in to change notification settings

storacha/elizaos-adapter

Repository files navigation

@storacha/elizaos-storacha

Storacha implements a database adapter for ElizaOS that enables decentralized storage of agent data using the Storacha network.

Overview

  • Storacha: A decentralized storage network built on IPFS and w3up, providing secure and efficient data storage with content addressing.
  • ElizaOS: An AI agent operating system that enables building, deploying and managing intelligent agents. website

Prerequisites

Before getting started, ensure you have:

  • Node.js 23+
  • pnpm 9+
  • Git for version control
  • A code editor (VS Code recommended)
  • Storacha delegation token - (learn how to create one at storacha.network)

Quick Start

Install ElizaOS

  1. Clone the repository
git clone https://github.com/elizaos/eliza.git
cd eliza
  1. Switch to latest tagged release
# This project iterates fast, so we recommend checking out the latest release
git checkout $(git describe --tags --abbrev=0)
# If the above doesn't work, try:
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
  1. Install dependencies
pnpm install --no-frozen-lockfile
  1. Build ElizaOS
pnpm build

Install the Storacha Adapter

Install in ElizaOS Workspace (Recommended)

  1. Install the Storacha package
pnpm add @storacha/adapter-storacha
  1. Add the Storacha Adapter to the agent runtime
--- a/agent/src/index.ts
+++ b/agent/src/index.ts
@@ -7,6 +7,7 @@ import { LensAgentClient } from "@elizaos/client-lens";
 import { SlackClientInterface } from "@elizaos/client-slack";
 import { TelegramClientInterface } from "@elizaos/client-telegram";
 import { TwitterClientInterface } from "@elizaos/client-twitter";
+import { StorachaDatabaseAdapter } from "@storacha/elizaos-adapter";
 import {
     AgentRuntime,
     CacheManager,
@@ -677,8 +678,12 @@ async function startAgent(
             fs.mkdirSync(dataDir, { recursive: true });
         }
 
-        db = initializeDatabase(dataDir) as IDatabaseAdapter &
-            IDatabaseCacheAdapter;
+        db = new StorachaDatabaseAdapter({
+            delegation: process.env.STORACHA_DELEGATION,
+            storachaAgentPrivateKey: process.env.STORACHA_AGENT_PRIVATE_KEY,
+            gateway: process.env.GATEWAY || 'https://w3s.link/ipfs',
+        });
 
         await db.init();

Configure Environment Variables

  1. Copy the example environment file:
cp .env.example .env
  1. Configure the required variables in your .env:
# Required Configuration
STORACHA_DELEGATION=your-delegation-token      # Get from storacha.network
STORACHA_AGENT_PRIVATE_KEY=your-private-key    # Your agent's Ed25519 private key

# Optional Configuration
GATEWAY=https://w3s.link/ipfs                  # Custom IPFS gateway if needed

Roadmap & Features

  • Create Memory Storage Adapter for ElizaOS
  • Integrate with Storacha Client Using Existing Delegation
  • Implement Agent Data Sharing Mechanisms
  • Provide Developer Documentation
  • Make It Work with ElizaOS
  • Add GitHub SSO Onboarding and Free-Tier Storage via Stripe
  • Add Encrypted Agent Storage with Lit Protocol
  • Handle Mutability for Stored Data

License

MIT & Apache-2.0

About

Storage adapter for ElizaOS that enables storing agent data in Storacha Network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published