Skip to content

Memory

class datarobot.models.memory.MemorySpace

A container for chat sessions and their events.

A memory space groups related sessions and memories together, providing an isolation boundary for conversational, semantic, and episodic memories in agentic applications.

Added in version v3.15.

  • Variables:
    • id (str) – The ID of the memory space.
    • user_id (str) – The ID of the user who owns the memory space.
    • tenant_id (str) – The ID of the tenant.
    • description (str or None) – Optional. A human-readable description.
    • llm_model_name (str or None) – Optional. An LLM model name associated with the memory space (maximum 200 characters).
    • created_at (datetime.datetime) – The timestamp when the memory space was created.

classmethod create(description=None, llm_model_name=None)

Create a new memory space.

Added in version v3.15.

  • Parameters:
    • description (str or None) – Optional. A human-readable description for the memory space.
    • llm_model_name (str or None) – Optional. An LLM model name to associate with the memory space (maximum 200 characters).
  • Returns: The newly created memory space.
  • Return type: MemorySpace

classmethod list(offset=None, limit=None)

List memory spaces accessible to the current user.

Added in version v3.15.

  • Parameters:
    • offset (int or None) – Optional number of events to skip from the beginning.
    • limit (int or None) – Optional. The maximum number of items to return.
  • Returns: The available memory spaces.
  • Return type: list of MemorySpace

classmethod get(memory_space_id)

Get a memory space by its ID.

Added in version v3.15.

  • Parameters: memory_space_id (str) – The ID of the memory space to retrieve.
  • Returns: The requested memory space.
  • Return type: MemorySpace

update(description=, llm_model_name=)

Update the memory space.

If called without arguments, there is no effect. Pass None to clear a field.

Added in version v3.15.

  • Parameters:
    • description (str or None) – The new description. Pass None to clear the existing description.
    • llm_model_name (str or None) – The new LLM model name (maximum 200 characters). Pass None to clear an existing LLM.
  • Return type: None

delete()

Delete the memory space.

Added in version v3.15.

  • Return type: None

class datarobot.models.memory.Session

A chat session within a MemorySpace.

Sessions track conversations between participants and store the sequence of Event objects that reflect either a single message or a state.

Added in version v3.15.

  • Variables:
    • id (str) – The session ID.
    • participants (list of str) – IDs of the participants in this session.
    • description (str or None) – Optional. A human-readable description.
    • metadata (dict or None) – Optional. Application-defined metadata.
    • created_at (datetime.datetime) – The timestamp when the session was created.
    • lifecycle_strategies (list of dict) – The lifecycle strategy configurations attached to this session.
    • memory_space_id (str or None) – The ID of the parent memory space. This value is set automatically.

classmethod create(memory_space_id, participants, lifecycle_strategies=None, description=None, metadata=None)

Create a new session in a memory space.

Every session must have at least one lifecycle strategy. If lifecycle_strategies is not provided or is an empty list, the server attaches a default strategy.

Added in version v3.15.

  • Parameters:
    • memory_space_id (str) – The ID of the memory space to create the session in.
    • participants (list of str) – IDs of the participants in the session.
    • lifecycle_strategies (list of dict or None) – Optional. The lifecycle strategy configurations. When omitted, the server applies a default strategy.
    • description (str or None) – Optional. A human-readable description.
    • metadata (dict or None) – Optional. Application-defined metadata.
  • Returns: The newly created session.
  • Return type: Session

classmethod list(memory_space_id, offset=None, limit=None, participants=None, description=None)

List sessions within a single memory space.

Added in version v3.15.

  • Parameters:
    • memory_space_id (str) – The ID of the memory space.
    • offset (int or None) – Optional number of events to skip from the beginning.
    • limit (int or None) – Optional maximum number of items to return.
    • participants (list of str or None) – Optional filter by participant IDs.
    • description (str or None) – Optional filter by description.
  • Returns: The matching sessions.
  • Return type: list of Session

classmethod get(memory_space_id, session_id)

Get a session by its ID.

Added in version v3.15.

  • Parameters:
    • memory_space_id (str) – The ID of the memory space.
    • session_id (str) – The ID of the session to retrieve.
  • Returns: The requested session.
  • Return type: Session

update(description=, metadata=)

Update the session.

If called without arguments, there is no effect. Pass None to clear a field.

Added in version v3.15.

  • Parameters:
    • description (str or None) – The new description. Pass None to clear.
    • metadata (dict or None) – The new metadata. Pass None to clear.
  • Return type: None

delete()

Delete the session.

Added in version v3.15.

  • Return type: None

post_event(body, emitter, event_type=None)

Create an event in this session.

Added in version v3.15.

  • Parameters:
    • body (dict) – The event payload.
    • emitter (dict) – Identifies the entity that produced the event, which typically contains "type" and "id" keys.
    • event_type (str or None) – Optional. An application-defined event-type label.
  • Returns: The newly created event.
  • Return type: Event

events(offset=None, limit=None, last_n=None, event_type=None)

List events in this session.

Provide either offset or last_n, but not both.

Added in version v3.15.

  • Parameters:
    • offset (int or None) – Optional . The number of events to skip from the beginning.
    • limit (int or None) – Optional. The maximum number of events to return.
    • last_n (int or None) – Optional. The number of most recent events to return. This value is mutually exclusive with offset.
    • event_type (str or None) – Optional. An event-type label.
  • Returns: The matching events.
  • Return type: list of Event

update_event(sequence_id, body=, event_type=, emitter=, created_at=None)

Update an event by its sequence ID.

When created_at is provided, the server uses it for optimistic concurrency control. Specifically, if the event has been modified since that timestamp, the server rejects the update. The caller must handle this error and reload the event before retrying.

Added in version v3.15.

  • Parameters:
    • sequence_id (int) – The ordinal position of the event to update.
    • body (dict or None) – The new event payload.
    • event_type (str or None) – The new event-type label.
    • emitter (dict or None) – The new emitter information; the type of entity that emitted the event (e.g. "agent" or "user").
    • created_at (datetime.datetime or None) – Optional timestamp for optimistic concurrency control.
  • Returns: The updated event, or None if called with no changes.
  • Return type: Event or None

class datarobot.models.memory.Event

A single action or chat message within a Session.

Events are always scoped to a session. Use Session.post_event(), Session.events(), and Session.update_event() to manage them.

Added in version v3.15.

  • Variables:
    • body (dict or None) – The event payload.
    • event_type (str or None) – An application-defined event-type label.
    • emitter_type (str or None) – The type of entity that emitted the event (e.g., "agent" or "user").
    • emitter_id (str or None) – The ID of the entity that generated the event.
    • sequence_id (int or None) – The ordinal position of the event within its session.
    • created_at (datetime.datetime or None) – The timestamp when the event was created.