Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX StorageHandler

From Leeroopedia
Knowledge Sources
Domains Storage, RAG
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete tool for managing storage backends (database, vector store, graph store) via a unified interface with factory-based initialization.

Description

The StorageHandler class is a Pydantic BaseModule that initializes and manages three storage backends: a database store (SQLite by default), a vector store (FAISS by default), and an optional graph store (Neo4j). Backends are created via factory classes (`DBStoreFactory`, `VectorStoreFactory`, `GraphStoreFactory`) based on the StoreConfig. The handler provides `load()`, `save()`, and `parse_result()` methods for persisting and retrieving agents, workflows, memory, history, and index data.

Usage

  • RAG pipeline: Pass a `StorageHandler` to `RAGEngine` to provide the DB, vector, and graph backends.
  • Agent persistence: Use `StorageHandler` in `AgentManager` for loading/saving agents from/to persistent storage.
  • Workflow storage: Persist workflow execution data and results.

Code Reference

Source Location

  • Repository: EvoAgentX
  • Config File: evoagentx/storages/storages_config.py (L8-51)
  • Handler File: evoagentx/storages/base.py (L15-344)

Signature

class StoreConfig(BaseConfig):
    dbConfig: DBConfig
    vectorConfig: Optional[VectorStoreConfig] = None
    graphConfig: Optional[GraphStoreConfig] = None
    path: Optional[str] = "/index_cache"

class StorageHandler(BaseModule):
    storageConfig: StoreConfig
    storageDB: Optional[Union[DBStoreBase, Any]] = None
    vector_store: Optional[Union[VectorStoreBase, Any]] = None
    graph_store: Optional[Union[GraphStoreBase, Any]] = None

    def init_module(self) -> None
    def load(self, tables: Optional[List[str]] = None, *args, **kwargs) -> Dict[str, Any]
    def save(self, tables: Optional[List[str]] = None, *args, **kwargs) -> Dict[str, Any]
    def parse_result(self, record: dict, schema_class: Type[BaseModel]) -> dict

Import

from evoagentx.storages.base import StorageHandler
from evoagentx.storages.storages_config import (
    StoreConfig, DBConfig, VectorStoreConfig, GraphStoreConfig
)

I/O Contract

Inputs

Name Type Required Description
storageConfig StoreConfig Yes Aggregated config for all backends
dbConfig DBConfig Yes Database config (db_name, path)
vectorConfig VectorStoreConfig No Vector store config (name, dimensions)
graphConfig GraphStoreConfig No Graph store config (name, uri, credentials)

Outputs

Name Type Description
storageDB DBStoreBase Initialized database backend
vector_store VectorStoreBase Initialized vector store backend
graph_store GraphStoreBase Initialized graph store backend

Usage Examples

Configure Storage for RAG

from evoagentx.storages.base import StorageHandler
from evoagentx.storages.storages_config import (
    StoreConfig, DBConfig, VectorStoreConfig
)

storage_handler = StorageHandler(storageConfig=StoreConfig(
    dbConfig=DBConfig(db_name="sqlite", path="./data/rag.db"),
    vectorConfig=VectorStoreConfig(vector_name="faiss", dimensions=1536),
    path="./data",
))

# Pass to RAGEngine
from evoagentx.rag.rag import RAGEngine
from evoagentx.rag.rag_config import RAGConfig

engine = RAGEngine(config=RAGConfig(), storage_handler=storage_handler)

With Graph Store

from evoagentx.storages.storages_config import StoreConfig, DBConfig, VectorStoreConfig, GraphStoreConfig

storage_handler = StorageHandler(storageConfig=StoreConfig(
    dbConfig=DBConfig(db_name="sqlite", path="./data/rag.db"),
    vectorConfig=VectorStoreConfig(vector_name="faiss", dimensions=1536),
    graphConfig=GraphStoreConfig(
        graph_name="neo4j",
        uri="bolt://localhost:7687",
        username="neo4j",
        password="password",
    ),
))

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment