Skip to content

API Reference parrot.storage.overflow

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.storage.overflow

View source

Generic artifact overflow store backed by any FileManagerInterface.

Transparently offloads artifact definitions that exceed the inline threshold (200 KB) to any FileManagerInterface implementation (S3, GCS, Local, Temp). On retrieval the reference is resolved back to the original dict.

FEAT-116: dynamodb-fallback-redis — Module 2 (OverflowStore generalization). See wiki/stores/storage-backends.md for overflow store configuration.

Alias FileManagerInterface

Re-exported from parrot.interfaces.file.abstract.FileManagerInterface.

Class OverflowStore

Generic artifact overflow store backed by any FileManagerInterface.

If an artifact's serialised definition is smaller than INLINE_THRESHOLD (200 KB), it stays inline in the storage backend. Otherwise the JSON is uploaded via the file manager and only the reference key is stored.

Parameter Type Default Description
file_manager FileManagerInterface Any FileManagerInterface implementation (S3, GCS, Local, Temp).

Attributes:

Attribute Type Description
INLINE_THRESHOLD int

Method OverflowStore.maybe_offload

Decide whether data fits inline or must be offloaded.

maybe_offload(data: Dict[str, Any], key_prefix: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]

Parameter Type Default Description
data Dict[str, Any] The artifact definition dict to evaluate.
key_prefix str Key prefix for the file manager, e.g. "artifacts/USER#u1#AGENT#bot/THREAD#sess/chart-x1".

Returns: Tuple[Optional[Dict[str, Any]], Optional[str]] — A tuple (inline_data, None) when the payload is small, or (None, ref_key) when the data was uploaded.

Method OverflowStore.resolve

Resolve an artifact definition, fetching from file manager if needed.

resolve(definition: Optional[Dict[str, Any]], definition_ref: Optional[str]) -> Optional[Dict[str, Any]]

Parameter Type Default Description
definition Optional[Dict[str, Any]] Inline definition dict (may be None).
definition_ref Optional[str] Key for the offloaded definition.

Returns: Optional[Dict[str, Any]] — The artifact definition dict, or None if resolution fails.

Method OverflowStore.generate_presigned_url

Generate a presigned URL for an overflow object.

Delegates to the underlying FileManagerInterface.get_file_url implementation. The expiry is silently capped at 604 800 seconds (7 days) — the maximum allowed by S3 sigv4.

If the underlying file manager does not support presigned URLs (e.g. LocalFileManager or TempFileManager) it will raise NotImplementedError or a provider-specific exception.

generate_presigned_url(key: str, *, expires_in: int = 604800) -> str

Parameter Type Default Description
key str S3 (or storage-backend) object key.
expires_in int 604800 Desired URL validity in seconds. Capped at 604 800.

Returns: str — A presigned URL string.

Method OverflowStore.delete

Delete the file for definition_ref if it exists.

This is a no-op when the artifact was stored inline.

delete(definition_ref: Optional[str]) -> bool

Parameter Type Default Description
definition_ref Optional[str] Key to delete, or None.

Returns: bool — True if a file was deleted, False otherwise.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally