Skip to content

API Reference parrot.bots.flows.core.storage.persistence

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

parrot.bots.flows.core.storage.persistence

View source

PersistenceMixin — pluggable persistence for crew/flow execution results (FEAT-147).

Replaces the former hard-wired DocumentDB persistence with a delegating mixin that respects self._persist_results (opt-out) and lazily resolves a ResultStorage backend on first write.

The host class is responsible for initialising four attributes in its __init__:

self._persist_results: bool                        # default True
self._result_storage_arg: str | ResultStorage | None
self._result_storage: Optional[ResultStorage]      # populated lazily
self._persist_tasks: set[asyncio.Task]             # initialised to set()

All four are accessed via getattr with safe defaults so the mixin remains backwards-compatible with host classes that have not yet been wired.

A host may additionally opt out of per-agent persistence only (FEAT-306) via a fifth, optional attribute:

self._persist_agent_results: bool                  # default True

Also accessed via getattr with a safe default of True, so hosts that have not been wired for per-agent persistence keep working unchanged.

Hosts may also expose an optional self._execution_wiki (an ExecutionWikiRecorder) — aclose() closes it when present, again via getattr so unwired hosts keep working unchanged.

Class PersistenceMixin

Pluggable persistence for crew/flow execution results.

Method PersistenceMixin.aclose

Wait for all in-flight persist tasks, then release the storage backend.

Idempotent: safe to call multiple times and safe to call before any _save_result has been scheduled (no-op in that case).

The method awaits every task in self._persist_tasks with return_exceptions=True so a failing background save does not block the close sequence.

aclose() -> None

Alias ResultStorage

Re-exported from parrot.bots.flows.core.storage.backends.ResultStorage.

Alias get_result_storage

Re-exported from parrot.bots.flows.core.storage.backends.get_result_storage.

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