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

self.remember(): Reference Guide

By DevShelfHub

Stores a value in scoped memory for later recall by this flow or other agents.

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

What is self.remember()?

`self.remember(value, scope=None, metadata=None)` appends to CrewAI's unified memory service: values become retrievable through `self.recall()` and higher-level recall helpers instead of ad-hoc JSON files or oversized Flow state blobs. Scope strings should read like filesystem paths — `/project/acme/contracts`, `/agent/researcher/preferences` — so different agents can share a namespace deliberately while staying isolated from unrelated crews.

Metadata is the right place for non-semantic facets you still want to filter on later: tenant ids, environment labels, confidence scores, or source URLs. Keep `value` itself embedding-friendly: short natural language facts, canonical identifiers, or compact JSON summaries rather than megabyte payloads that will bloat vector indexes and slow every recall query.

Think of remember/recall as cross-run semantic scratch space, while Flow `state` remains authoritative for typed, Pydantic-shaped data that must serialize with the graph. Mixing the two blindly leads to double sources of truth; prefer remember when multiple agents or future runs need fuzzy retrieval, and state when you need strict validation inside the current execution.

Use Cases

  • Cross-run learning
  • Sharing facts between agents

Key Features

  • Scoped paths
  • Metadata support
  • Backed by ChromaDB/LanceDB

When NOT to Use

Volatile per-call data — use Flow state instead.

Notes

Scope hygiene prevents cross-talk

Omitting scope sends memories into a wide default bucket where unrelated agents can retrieve noise. Prefix every production write with tenant or workspace identifiers.

Embedding cost and latency

Each remember triggers indexing work. Batch related facts into one write when possible instead of thousands of single-sentence inserts inside tight loops.

Retention and GDPR

Unified memory persists outside your application heap. Pair writes with deletion runbooks and document what you store because exports may contain end-user content.

Version skew with recall scoring

Recall blends semantic similarity, recency, and importance. Old remembers can outrank fresher facts if embeddings are similar — add timestamps in metadata and post-filter in application code when freshness matters.

Parameters

Parameter Type Required Purpose
value Any No Object to store.
scope str | None No Hierarchical path that scopes the memory.
metadata dict | None No Arbitrary tags.

Code Examples

Save

python
self.remember('migrate by Q3', scope='/project/alpha/decisions')

Tenant-scoped fact with metadata

python
self.remember(
    "Acme prefers EU hosting",
    scope="/tenant/acme/preferences",
    metadata={"source": "kickoff-2026-05-01", "confidence": 0.92},
)

Retrieve later in another method

python
hits = self.recall(scope="/tenant/acme/preferences", limit=3)
# merge top hits into a prompt or Flow state field

When to Use

Persisting decisions, facts, or outputs that should survive a single kickoff.

Common Mistakes

❌ Storing huge objects

✅ Store summaries and references, not raw payloads.

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

self.remember() FAQ

What is self.remember() in CrewAI?

Stores a value in scoped memory for later recall by this flow or other agents. `self.remember(value, scope=None, metadata=None)` appends to CrewAI's unified memory service: values become retrievable through `self.recall()` and higher-level recall helpers instead of ad-hoc JSON files or oversized Flow state blobs. Scope strings should read like filesystem paths — `/project/acme/contracts`, `/agent/researcher/preferences` — so different agents can share a namespace deliberately while staying isolated from unrelated crews. Metadata is the right place for …

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

DevShelfHub documents self.remember() 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.remember()?

Persisting decisions, facts, or outputs that should survive a single kickoff.

When should I avoid self.remember()?

Volatile per-call data — use Flow state instead.

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

self.remember(fact, 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.