Skip to content

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

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

parrot.bots.flows.core.storage.memory

View source

Flow Primitives — ExecutionMemory.

Copied from parrot.bots.flow.storage.memory into the shared core storage location. Relative imports updated for the new package depth.

Updated (TASK-976): AgentResult → NodeResult from flows.core.result.

Class ExecutionMemory

In-memory storage for execution history.

Optionally indexes results into a FAISS vector store (via VectorStoreMixin) when an embedding_model is provided.

Parameter Type Default Description
original_query str '' The initial prompt/task string for this execution.
embedding_model None Optional embedding model for FAISS indexing.
dimension int 384 Embedding dimension (default 384).
index_type str 'Flat' FAISS index type ("Flat", "FlatIP", or "HNSW").

Fields:

Field Type Default Description
original_query Optional[str] original_query
results Dict[str, NodeResult] {}
execution_graph Dict[str, List[str]] {}
execution_order List[str] []

Method ExecutionMemory.add_result

Add a result and update execution graph.

add_result(result: NodeResult, vectorize: bool = True) -> None

Parameter Type Default Description
result NodeResult The NodeResult (or legacy AgentResult) to store.
vectorize bool True If True and an embedding model is configured, schedule async FAISS indexing.

Method ExecutionMemory.get_results_by_agent

Retrieve result from a specific agent/node.

get_results_by_agent(agent_id: str) -> Optional[NodeResult]

Parameter Type Default Description
agent_id str Agent/node identifier.

Returns: Optional[NodeResult] — NodeResult or None if not found.

Method ExecutionMemory.get_reexecuted_results

Return only results from re-executions triggered by ask().

get_reexecuted_results() -> List[NodeResult]

Returns: List[NodeResult] — List of NodeResult instances with a non-None parent_execution_id.

Method ExecutionMemory.get_context_for_agent

Return the context available to an agent at execution time.

get_context_for_agent(agent_id: str) -> Any

Parameter Type Default Description
agent_id str Agent identifier.

Returns: Any — Initial query for the first agent, previous agent's result when available, or original_query if either look-up fails.

Method ExecutionMemory.clear

Clear execution memory.

clear(keep_query: bool = False) -> None

Parameter Type Default Description
keep_query bool False If True, preserves original_query.

Method ExecutionMemory.get_snapshot

Return a serialisable snapshot of the current memory state.

get_snapshot() -> Dict[str, Any]

Returns: Dict[str, Any] — Dictionary with all memory state information.

Alias NodeResult

Re-exported from parrot.bots.flows.core.result.NodeResult.

Alias VectorStoreMixin

Re-exported from parrot.bots.flows.core.storage.mixin.VectorStoreMixin.

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