Skip to content

API Reference parrot.bots.flows.core.storage.backends.base

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

parrot.bots.flows.core.storage.backends.base

View source

ResultStorage abstract base class for pluggable crew/flow result persistence.

Class ResultStorage

Abstract pluggable backend for crew/flow execution result persistence.

Implementations must be async-safe and idempotent on close().

Method ResultStorage.save

Persist a single execution document.

save(collection: str, document: dict[str, Any]) -> None

Parameter Type Default Description
collection str Target collection or table name (e.g. "crew_executions").
document dict[str, Any] Execution result document to persist.

Method ResultStorage.close

Release any underlying connection/pool. Safe to call multiple times.

close() -> None

Method ResultStorage.fetch

Return all documents in collection matching execution_id.

Non-abstract on purpose: existing third-party ResultStorage subclasses that predate the read API keep working (they simply don't support fetch() until they opt in).

fetch(collection: str, execution_id: str) -> list[dict[str, Any]]

Parameter Type Default Description
collection str Target collection or table name.
execution_id str Crew-level execution id to match documents against.

Returns: list[dict[str, Any]] — List of persisted documents whose execution_id matches.

Raises:

  • NotImplementedError — Always, unless overridden by a subclass.

Method ResultStorage.list

List persisted execution documents, newest first.

Backends that support read operations must override this method. The default implementation raises NotImplementedError so that existing write-only backends continue to work unchanged.

list(collection: str, filters: dict[str, Any] | None = None, limit: int = 20, offset: int = 0) -> list[dict[str, Any]]

Parameter Type Default Description
collection str Target collection or table name.
filters dict[str, Any] | None None Optional plain-dict filters (e.g. tenant, user_id).
limit int 20 Maximum number of documents to return.
offset int 0 Number of documents to skip (pagination).

Returns: list[dict[str, Any]] — A list of execution documents.

Raises:

  • NotImplementedError — If the backend does not support list().

Method ResultStorage.get

Retrieve a single execution document by its record id.

get(collection: str, record_id: str) -> dict[str, Any] | None

Parameter Type Default Description
collection str Target collection or table name.
record_id str Unique identifier of the record (UUID as string).

Returns: dict[str, Any] | None — The execution document, or None if not found.

Raises:

  • NotImplementedError — If the backend does not support get().

Method ResultStorage.delete

Delete a single execution document by its record id.

delete(collection: str, record_id: str) -> bool

Parameter Type Default Description
collection str Target collection or table name.
record_id str Unique identifier of the record (UUID as string).

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

Raises:

  • NotImplementedError — If the backend does not support delete().

Method ResultStorage.count

Count persisted execution documents matching the given filters.

count(collection: str, filters: dict[str, Any] | None = None) -> int

Parameter Type Default Description
collection str Target collection or table name.
filters dict[str, Any] | None None Optional plain-dict filters (e.g. tenant, user_id).

Returns: int — The number of matching documents.

Raises:

  • NotImplementedError — If the backend does not support count().

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