Skip to content

API Reference parrot.memory.episodic.reflection

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

parrot.memory.episodic.reflection

View source

Reflection engine for episodic memory.

LLM-powered reflection with heuristic fallback. Analyzes agent interactions and extracts actionable lessons to store alongside episodes.

Alias AbstractClient

Re-exported from parrot.clients.base.AbstractClient.

Alias EpisodeOutcome

Re-exported from parrot.memory.episodic.models.EpisodeOutcome.

Attribute REFLECTION_PROMPT

Class ReflectionEngine

LLM-powered reflection engine with heuristic fallback.

When an LLM client is available, uses structured prompting to generate reflections. Falls back to pattern-matching heuristics when the LLM is unavailable or fails.

Parameter Type Default Description
llm_client AbstractClient | None None Optional AbstractClient instance for LLM-powered reflection.
llm_provider str 'google' Provider name (used for selecting model).
model str 'gemini-3.8-flash' Model identifier for reflection calls.
fallback_to_heuristic bool True If True, use heuristic when LLM is unavailable or fails.

Method ReflectionEngine.reflect

Generate a reflection for an episode.

Tries LLM first (if client available), then falls back to heuristics.

reflect(situation: str, action_taken: str, outcome: EpisodeOutcome | str, error_message: str | None = None) -> ReflectionResult

Parameter Type Default Description
situation str What the agent was trying to do.
action_taken str What action was executed.
outcome EpisodeOutcome | str The outcome of the action.
error_message str | None None Error message if the outcome was a failure.

Returns: ReflectionResult — ReflectionResult with reflection, lesson_learned, and suggested_action.

Alias ReflectionResult

Re-exported from parrot.memory.episodic.models.ReflectionResult.

Attribute logger

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