DS DevShelfHub Projects · AI tools
Tutorials / CrewAI / Reference / Methods / self.recall()
Method Flow, Agent

self.recall(): Reference Guide

By DevShelfHub

Retrieves stored memories ranked by semantic similarity, recency, and importance.

See the CrewAI methods catalog, CrewAI introduction, kickoff() reference, and core concepts for surrounding context.

What is self.recall()?

self.recall(scope=None, limit=10) queries CrewAI's unified memory layer — typically backed by a vector database plus metadata — and returns the strongest matches for the current semantic context. Scopes are hierarchical path prefixes such as /agent/researcher or /tenant/acme/support so you can isolate customer-specific facts from global playbooks. The scorer blends embedding similarity with recency and importance weights so stale bulletins decay naturally without manual deletes.

Use recall at the beginning of a flow step or agent turn when you need institutional memory: prior decisions, user preferences, or summarized artifacts produced by earlier runs. Keep payloads small: retrieve snippets and pointers, not entire PDFs, unless your downstream task truly needs them. When combined with self.remember(), treat the pair like a transactional read-after-write — write summaries with explicit scopes so future recall queries stay precise.

Recall is not a substitute for structured Flow state that must be deterministic within a single kickoff. State belongs in the Pydantic model attached to the flow; memory belongs to knowledge that should span runs or cross agents. Blurring the two creates heisenbugs where a recalled paragraph contradicts freshly computed state because embeddings matched incidental wording.

Use Cases

  • Cross-run context
  • Personalization
  • Replaying decisions

Key Features

  • Composite scoring
  • Scope-narrowing
  • Configurable depth

When NOT to Use

When the data lives in the Flow state — read state directly.

Notes

Scope too broad

Omitting scope searches the entire corpus and surfaces unrelated high-similarity noise. Start narrow, widen only when metrics show recall@k is too low.

Embedding drift

If you change embedders or dimensions, reindex before trusting scores. Mixed embedding spaces produce false positives that look like semantic matches.

Latency budgets

Each recall is a vector query. For real-time UIs, prefetch memories in parallel with tool calls or cache hot scopes in Redis keyed by tenant.

Privacy

Memories may contain PII from prior user sessions. Apply the same retention and access controls as your primary database; recall bypasses application-level ORMs.

Parameters

Parameter Type Required Purpose
scope str | None No Sub-tree to search.
limit int No Max results to return.

Code Examples

Search

python
items = self.recall('/project/alpha', limit=5)

Prefetch into flow state

python
@listen(start_step)
def hydrate(self):
    snippets = self.recall(scope='/playbook/support', limit=4)
    self.state.memory_hits = snippets
    return self.state

When to Use

When an agent needs context from prior runs.

Common Mistakes

❌ Forgetting to set scope and getting noise

✅ Always scope queries to the relevant sub-tree.

Related: @tool decorator reference, Agent class reference, and the first Crew tutorial.

self.recall() FAQ

What is self.recall() in CrewAI?

Retrieves stored memories ranked by semantic similarity, recency, and importance. self.recall(scope=None, limit=10) queries CrewAI's unified memory layer — typically backed by a vector database plus metadata — and returns the strongest matches for the current semantic context. Scopes are hierarchical path prefixes such as /agent/researcher or /tenant/acme/support so you can isolate customer-specific facts from global playbooks. The scorer blends embedding similarity with recency and importance weights so stale bulletins decay naturally without manual delet…

Which CrewAI types expose the method self.recall()?

DevShelfHub documents self.recall() on Flow, Agent. The reference maps it to Python module crewai.flow.flow.Flow — pin your installed crewai version and match imports to the snippet on this page.

When should I use self.recall()?

When an agent needs context from prior runs.

When should I avoid self.recall()?

When the data lives in the Flow state — read state directly.

How do I call self.recall() from Python?

results = self.recall(scope='/agent/researcher')

Where can I explore more CrewAI API reference pages?

Open the CrewAI API reference index on DevShelfHub to search classes, methods, and decorators, each with runnable examples, parameters, common mistakes, and cross-links.