Base
Base storage provider interface.
BaseStorageProvider
Bases: ABC
Base interface for storage providers.
This abstract class defines the contract that all storage providers must implement to store and retrieve tool outputs.
clear()
abstractmethod
Clear all stored data.
Warning
This operation is irreversible
delete(key)
abstractmethod
Delete data by key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Unique identifier for the data |
required |
Note
Should not raise error if key doesn't exist
exists(key)
abstractmethod
Check if key exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Unique identifier to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if key exists, False otherwise |
get_presigned_url(key, expires_hours=24)
Generate presigned URL for direct access (optional).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Storage key |
required |
expires_hours |
int
|
URL expiration in hours |
24
|
Returns:
| Type | Description |
|---|---|
str | None
|
Presigned URL if supported, None otherwise |
list_keys(prefix='')
abstractmethod
List all keys with optional prefix filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix |
str
|
Optional prefix to filter keys |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of matching keys |
retrieve(key)
abstractmethod
Retrieve data by key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Unique identifier for the data |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The stored data |
Raises:
| Type | Description |
|---|---|
KeyError
|
If key not found |
StorageError
|
If retrieval operation fails |
store(key, data)
abstractmethod
Store data with the given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Unique identifier for the data |
required |
data |
Any
|
Data to store (must be serializable) |
required |
Raises:
| Type | Description |
|---|---|
StorageError
|
If storage operation fails |
StorageError
Bases: Exception
Base exception for storage operations.