Overview
Concrete base storage handler for file-based and cloud storage operations across multiple formats and backends.
Description
The StorageBase class provides an abstract base with support for JSON, pickle, CSV, YAML, and XML file formats. It offers read/write/list/delete operations across local files and cloud storage (Supabase, S3). Uses `pathlib` for cross-platform path handling. This is the tools-layer storage base — distinct from the RAG-layer `StorageHandler` in `evoagentx/storages/base.py`.
Usage
- File persistence: Use for reading and writing data files in multiple formats.
- Cloud storage: Extend for Supabase or S3 backend integration.
- Agent data management: Attach to agents that need to persist data across executions.
Code Reference
Source Location
Signature
class StorageBase:
# Abstract base for file and cloud storage operations
# Supports JSON, pickle, CSV, YAML, XML formats
# read/write/list/delete operations
# Local files, Supabase, S3 backends
...
Import
from evoagentx.tools.storage_base import StorageBase
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| path |
str |
Yes |
File path
|
| data |
Any |
Yes (write) |
Data to write
|
| format |
str |
No |
File format (json, pickle, csv, yaml, xml)
|
Outputs
| Name |
Type |
Description
|
| read returns |
Any |
Deserialized file content
|
| list returns |
List[str] |
List of file paths
|
Usage Examples
Read and Write JSON
from evoagentx.tools.storage_base import StorageBase
storage = StorageBase()
storage.write("data.json", {"key": "value"}, format="json")
data = storage.read("data.json")
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.