Skip to main content

mem_get_observation

Signature

mem.mem_get_observation(user_id: str, observation_id: int) -> Observation | None

Fetches an observation by its integer primary key, scoped to user_id. Cross-user access returns None (never raises, never leaks). Use this to hydrate the full content of an observation surfaced by mem_search or mem_timeline.

Parameters

ParámetroTipoRequeridoDescripción
user_idstrOwner scope. If the observation belongs to a different user, the result is None.
observation_idintPositive integer primary key (obtained from mem_search or mem_timeline results).

Returns

Observation | None (Pydantic model | None):

The full observation if found and owned by user_id, else None. Fields:

  • id (int)
  • session_id (str)
  • user_id (str)
  • type (str)
  • title (str)
  • content (str) — full text, with <private> blocks already replaced by [REDACTED].
  • topic_key (str | None)
  • revision_count (int)
  • created_at (str, ISO-8601 UTC)
  • updated_at (str, ISO-8601 UTC)

Raises

  • ValueErrorobservation_id <= 0.

Examples

hits = mem.mem_search(user_id="alice", query="auth")
if hits:
full = mem.mem_get_observation(user_id="alice", observation_id=hits[0].id)
print(full.content)

See also