Skip to main content
Dreams

Dream schemas

A Dream is an asynchronous memory consolidation task. After creating a task, use the list or get endpoint to check its execution status and results.

A Dream is an asynchronous memory consolidation task. After creating a task, use the list or get endpoint to check its execution status and results.

Dream object

The create, list, get, cancel, and archive endpoints use the following Dream object:
FieldTypeDescription
idstringDream ID with the drm_ prefix.
typestringAlways dream.
statusstringExecution status. See Dream status.
inputsobject[]Inputs submitted when the task was created. An identity_template input is returned in its original form without expanding the internally resolved Memory Store ID.
outputsobject[]Consolidation results. An empty array is returned before completion and when the task fails or is canceled.
modelobjectModel configuration used for this task.
model.idstringModel tier: auto, lite, or ultimate.
instructionsstringConsolidation instructions submitted at creation; an empty string if omitted.
usageobjectToken usage. See Dream usage. All fields are 0 until the task incurs usage.
errorobject/nullError details when the task fails. See Dream error. null in other states.
created_atstringCreation time in UTC RFC 3339 format.
ended_atstring/nullTime when the task reached a terminal state, in UTC RFC 3339 format; null until it ends.
archived_atstring/nullArchive time in UTC RFC 3339 format; null if not archived.

Dream status

ValueDescription
pendingCreated and waiting to run.
runningConsolidating memories.
completedConsolidation completed. outputs contains the resulting Memory Store.
failedExecution or result application failed. See error for details.
canceledThe task was canceled.
completed, failed, and canceled are terminal states.

Dream input

inputs must contain exactly one primary input and can include additional Session inputs:
typeFieldDescription
memory_storememory_store_idConsolidate a Memory Store accessible to the caller directly.
identity_templateidentity_id、template_idConsolidate the Default Memory currently mounted to the specified Identity and Template.
sessionssession_idsOptional array of Session IDs to focus on during review; all sessions inputs combined can contain at most 100 IDs.
memory_store and identity_template are mutually exclusive and cannot be submitted in the same request. Each input can contain only the fields defined for its type.

Processing memory_store

The Memory Store specified by memory_store_id is used directly as input. When the task completes, the output is a new Memory Store. The original input Store is not overwritten, and no Identity and Template mounts are changed automatically.

Processing identity_template

At creation, the current Default Memory for the specified Identity and Template is resolved and recorded. On completion, the output Memory Store automatically becomes the new Default Memory for the same Identity and Template. If another operation replaces the Default Memory while the task is running, the new mount is not overwritten. Instead, the Dream is marked as failed with error code memory_changed_during_dream.

Dream output

When the Dream completes, outputs contains one element:
FieldTypeDescription
typestringAlways memory_store.
memory_store_idstringID of the Memory Store produced by consolidation.
files_touchedstring[]Paths of memory files created, modified, or deleted during consolidation. Omitted when details are unavailable.

Dream usage

FieldTypeDescription
input_tokensintegerNumber of input tokens.
output_tokensintegerNumber of output tokens.
cache_creation_input_tokensintegerNumber of input tokens used to create the cache.
cache_read_input_tokensintegerNumber of input tokens read from the cache.

Dream error

FieldTypeDescription
typestringError type, such as no_output or internal_error.
codestringOptional stable error code. This field is omitted when no code is provided.
messagestringError description for troubleshooting. Do not use it for programmatic decisions.
Best Practices
API reference