# Extract memories from a session

Launch stage: Beta

`POST /api/2.0/agents/{session_store=session-stores/*}/sessions/{session_id}/extractions`

Synchronously extracts memories from a single session into the given memory store, returning
 the entries that were written.

API scopes: agent-kit

## Path parameters

- `session_store` (string, required)
  Session store containing the session, in the form `session-stores/{session_store_id}`.
- `session_id` (string, required)
  Identifier of the session whose transcript is distilled into memories.

## Request body

- `memory_store` (string, required)
  Memory store the extracted entries are written to, in the form
   `memory-stores/{managed_memory_store_id}`.
- `instructions` (string, optional)
  Instructions steering what is extracted from the session.
- `dry_run` (boolean, optional)
  When true, extract and return the entries without writing them to the memory store. Defaults
   to false, which persists the extracted entries and returns them.

## Returns

- `name` (string, optional, Output only)
  Correlation identifier for this extraction, for logging and tracing. Not a fetchable resource.
- `entries` (array of object, optional, Output only)
  The memory entries written by this extraction.
  - `name` (string, optional, Output only, ID, Immutable)
    Resource name in the form
     `memory-stores/{managed_memory_store_id}/entries/{managed_memory_entry_id}`.
  - `actor_id` (string, required, Immutable)
    Customer-provided identifier for the actor whose memory this entry represents.
  - `session_id` (string, optional, Immutable)
    Optional identifier for the session associated with this memory entry. When omitted, the
     entry applies across the actor's sessions.
  - `path` (string, required, Immutable)
    Absolute, case-sensitive path identifying the entry within its actor and optional session.
     Paths must begin with `/` and must not contain empty, `.` or `..` segments.
  - `content` (string, optional)
    Optional free-form memory content.
  - `description` (string, optional)
    Human-readable description of the memory entry.
  - `source_type` (string, optional, Immutable)
    Which writer created this entry. Caller sets this on Create; immutable after creation.
    Possible values:
    - `MANAGED_MEMORY_ENTRY_SOURCE_TYPE_AGENT`
    - `MANAGED_MEMORY_ENTRY_SOURCE_TYPE_DREAMER`
  - `create_time` (string, optional, Output only)
    Time when the entry was created.
  - `update_time` (string, optional, Output only)
    Time when the entry was last updated.

## Response

```json
{
  "name": "string",
  "entries": [
    {
      "name": "string",
      "actor_id": "string",
      "session_id": "string",
      "path": "string",
      "content": "string",
      "description": "string",
      "source_type": "MANAGED_MEMORY_ENTRY_SOURCE_TYPE_AGENT",
      "create_time": "string",
      "update_time": "string"
    }
  ]
}
```

