# Memory
URL: https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html

# 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:

#### classmethod create(description=None, llm_model_name=None)

Create a new memory space.

Added in version v3.15.

- Parameters:
- 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:
- 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:
- 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](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.MemorySpace).

Sessions track conversations between participants and store the sequence of [Event](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.Event) objects that reflect either a single message or a state.

Added in version v3.15.

- Variables:

#### 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.Session).

Events are always scoped to a session. Use [Session.post_event()](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.Session.post_event), [Session.events()](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.Session.events), and [Session.update_event()](https://docs.datarobot.com/en/docs/api/reference/sdk/memory.html#datarobot.models.memory.Session.update_event) to manage them.

Added in version v3.15.

- Variables:

---
