Skip to main content

PyPI Python License

evoid-smart-storage

Multi-DB routing — Intent Handler system

Quick StartIntent HandlerRoutingAPI


Quick Start

uv add evoid-smart-storage

Method 1: Intent Handler (Recommended)

from evoid_smart_storage import register_handlers
from evoid.core.storage import storage_read, storage_write

# Register Smart Storage as storage handler
register_handlers(config={
    "mapping": {
        "credentials": "postgresql",
        "session": "redis",
        "logs": "memory",
    },
})

# Routes automatically based on data type
await storage_write("cred:db_pass", {"password": "secret"})
await storage_write("session:abc", {"user": "alice"})

Method 2: Direct API

from evoid_smart_storage import SmartStorage

storage = SmartStorage(config={...})
await storage.write("key", {"data": "value"})

Intent Handler

evoid-smart-storage registers these Intent handlers:

Intent Handler Description
storage.read handle_read Read with smart routing
storage.write handle_write Write with smart routing
storage.delete handle_delete Delete with smart routing
storage.health handle_health Check all backends

Routing

Smart Storage routes data based on:

  1. Data type — credentials → PostgreSQL, sessions → Redis
  2. Intent level — CRITICAL → PostgreSQL, STANDARD → SQLite
  3. User ID — multi-tenancy support
  4. Metadata override — explicit backend selection

Configuration

TOML

[engines]
storage = "smart_storage"

[engines.options.smart_storage]
mapping = { credentials = "postgresql", session = "redis" }

API

register_handlers(config: dict)

Register Smart Storage as Intent handlers.

SmartStorage Methods

Method Signature Returns Description
read async read(key: str) Any | None Read with routing
write async write(key: str, data: dict) bool Write with routing
delete async delete(key: str) bool Delete with routing
health async health() bool Check all backends

How It Works

Smart Storage reads the mapping config and routes each key to the correct backend:

  • credentials → PostgreSQL (sensitive data)
  • session → Redis (ephemeral)
  • logs → Memory (debug)

Level routing sends CRITICAL Intents to PostgreSQL, STANDARD to SQLite. Your handler code never sees the routing logic.

Dependencies

  • evoid>=0.4.0
  • At least one storage plugin (sqlite, postgresql, redis, etc.)

Links

License

MIT

Release files for evoid-smart-storage 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for evoid-smart-storage 0.2.0
File Interpreter ABI Platform
evoid_smart_storage-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / evoid_smart_storage-0.2.0-py3-none-any.whl

Download URL evoid_smart_storage-0.2.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
865ed3722b096ab536f2760916cd5fd7c9f9835ba949ac85282c811df305424a
BLAKE2b-256 checksum
How to use checksums
45baf1881752b7792ac8d7367b53c47f299b3cd94b2de668d31f37537c37d5d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page