Skip to content

API Reference parrot.tools.execution_plan.memory

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

parrot.tools.execution_plan.memory

View source

Plan-scoped working-memory binding and exact-version recovery (FEAT-585 M2).

Class PlanMemoryBinding

Own plan-only memory preparation and borrowed/owned resource lifetimes.

Parameter Type Default Description
working_memory 'WorkingMemoryToolkit' Toolkit receiving the prepared plan binding.
runtime Optional[TaskMemoryRuntime] Started host runtime to borrow, when supplied.
scope Optional[TaskScope] Trusted host scope for a supplied runtime.
max_restore_bytes int Cumulative recovery read budget.

Attributes:

Attribute Type Description
scope Optional[TaskScope] Return the trusted scope in force after preparation.
artifact_mode str Return durable only when the active configuration is durable.
resume_level_hint str Return the recovery level supported by the current binding.

Method PlanMemoryBinding.prepare

Enable plan memory atomically while preserving legacy state on failure.

prepare() -> TaskMemory

Returns: TaskMemory — The enabled task-memory composition root.

Method PlanMemoryBinding.restore

Restore authorized exact versions within the configured cumulative budget.

restore(refs: Sequence[ArtifactRef]) -> None

Parameter Type Default Description
refs Sequence[ArtifactRef] Checkpoint-published immutable artifact references.

Raises:

  • RestoreError — If preparation, checkpoint structure, or budget is invalid.

Method PlanMemoryBinding.close

Close only runtime resources created by this binding.

close() -> None

Class PlanWorkingMemoryCatalog

Catalog that restores exact artifact versions without backend mutation.

Parameter Type Default Description
*args Any ()
**kwargs Any {}

Method PlanWorkingMemoryCatalog.restore_version

Authorize, load, and publish ref under key without writing a version.

restore_version(key: str, ref: EvidenceRef, *, max_bytes: int) -> None

Parameter Type Default Description
key str Local catalog alias to publish.
ref EvidenceRef Exact artifact version to restore.
max_bytes int Hard materialization ceiling for this restoration.

Raises:

  • RestoreError — When scope is unavailable, the version cannot be loaded, the bounded read is refused, or an alias is already pinned elsewhere.

Method PlanWorkingMemoryCatalog.aget

Read locally, lazily restoring a pinned exact version when necessary.

aget(key: str) -> CatalogEntry | GenericEntry

Parameter Type Default Description
key str Local alias to retrieve.

Returns: CatalogEntry | GenericEntry — The existing or restored catalog entry.

Class RestoreError

A restoration was refused; code is one of the spec §2 stable codes.

Parameter Type Default Description
code str
message str

Function synthesize_process_scope

Create a process-local namespace for legacy plan wiring.

synthesize_process_scope(session_id: str) -> TaskScope

Parameter Type Default Description
session_id str Working-memory session identifier to preserve.

Returns: TaskScope — A process-local task scope; it is not user authentication.

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