# Claude Managed Agents Dreams **Research preview (`dreaming-2026-04-21` beta header, on top of `managed-agents-2026-04-01`).** Dreams let Claude clean up a [[Claude Managed Agents Memory Stores|memory store]] by reflecting on past sessions: deduplicating, replacing stale or contradicted entries with the latest value, and folding in new insights surfaced from session transcripts. The compelling design choice: dreams are **non-destructive**. The input store is never modified; the dream produces a *new* output store. You review it, decide to attach it to future sessions or to discard it. Memory curation becomes a reviewable side effect, not a destructive in-place mutation. ## Why this matters Memory stores in their default mode accumulate entropy: an agent writes incrementally, sometimes duplicating, sometimes contradicting earlier entries, never tidying up. Manual curation through the Memory Stores API works but doesn't scale across many sessions. Dreams give you a scheduled "tidy up" pass that uses Claude itself to summarise, reconcile, and reorganise based on what was actually said during sessions. Closest mental model: the sleep-consolidation analogy that gives the feature its name. ## Mental model A **dream** is an asynchronous job whose inputs are: - One pre-existing memory store (the "before" version) - 1 to 100 session transcripts (the source material to mine) The job runs the curation pipeline through Claude and produces an **output memory store** referenced in `dream.outputs[]` once the dream reaches `running`. Input store and sessions are read-only; outputs are independent. If you have only sessions and no existing store, [create an empty memory store](https://platform.claude.com/docs/en/managed-agents/memory#create-a-memory-store) and pass that as the `memory_store` input. ## Create a dream ```python dream = client.beta.dreams.create( inputs=[ {"type": "memory_store", "memory_store_id": store_id}, {"type": "sessions", "session_ids": [session_a, session_b]}, ], model="claude-opus-4-7", instructions="Focus on coding-style preferences; ignore one-off debugging notes.", ) print(dream.id) # drm_01... ``` Curl equivalent: ```bash curl -s https://api.anthropic.com/v1/dreams \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: managed-agents-2026-04-01,dreaming-2026-04-21" \ -H "content-type: application/json" \ -d '{ "inputs": [ {"type": "memory_store", "memory_store_id": "memstore_..."}, {"type": "sessions", "session_ids": ["sesn_01", "sesn_02"]} ], "model": "claude-opus-4-7", "instructions": "Focus on coding-style preferences..." }' ``` The CLI form (`ant beta:dreams create`) and SDK calls for TypeScript, Go, C#, Java, PHP, Ruby all exist; SDKs set both beta headers automatically. The `instructions` field (max 4,096 chars) is your steering knob: tell the dream what to keep, what to drop, what to prioritise. ## Lifecycle | `status` | Meaning | |---|---| | `pending` | Queued; not yet started | | `running` | Pipeline executing; `usage` updates live; `session_id` points at the underlying session | | `completed` | Output memory store is ready in `outputs[]` | | `failed` | Terminated with an error; output store preserved with partial contents | | `canceled` | Caller stopped it; output store preserved with partial contents | Typical wall-clock: minutes to tens of minutes depending on input size. Poll by ID or stream the underlying session's [events](https://platform.claude.com/docs/en/managed-agents/events-and-streaming) to watch what the dream is reading and writing in real time. ## Using the output On `completed`, the `memory_store` entry in `outputs[]` is a fully populated, independent memory store. Two paths: - **Adopt**: attach it as a `memory_store` resource on future sessions, in place of or alongside the input store - **Discard**: delete or archive via the Memory Stores API Inputs are never touched, even on success. If the result isn't useful, the original is exactly as you left it. ## Cancel and archive - `cancel` moves `pending`/`running` to `canceled` immediately; idempotent on already-canceled; 400 on `completed` or `failed` - `archive` sets `archived_at` on dreams in a terminal state (does not affect output store); archived dreams are hidden from default `list` calls but readable by ID; no unarchive - While `pending`/`running`, archiving or deleting the *output* store is rejected with 400. Archiving or deleting an *input* store or session mid-run fails the dream with `input_memory_store_unavailable` / `input_session_unavailable`. ## Errors worth knowing | `error.type` | When | |---|---| | `timeout` | Pipeline exceeded its runtime budget | | `internal_error` | Unclassified pipeline failure | | `memory_store_org_limit_exceeded` | Org hit its memory-store cap during provisioning | | `input_memory_store_too_large` | Input store exceeds pipeline limits | | `input_memory_store_unavailable` | Input store archived/deleted after creation | | `input_session_unavailable` | An input session archived/deleted after creation | ## Limits | Limit | Value | |---|---| | Sessions per dream | 100 | | `instructions` length | 4,096 characters | | Supported models | `claude-opus-4-7`, `claude-sonnet-4-6` | Default rate limits apply during beta. Contact support for higher limits. ## Billing Standard API token rates for the model selected; the dream resource's `usage` reports the exact totals. Cost scales roughly linearly with the number and length of input sessions. Start with a small batch, scale up once curation quality looks right. ## Access Research preview; access by [request form](https://claude.com/form/claude-managed-agents). Requires the `managed-agents-2026-04-01` base header **and** the `dreaming-2026-04-21` feature header. SDKs add both automatically. ## How it fits the Managed Agents stack - [[Claude Managed Agents Memory Stores]] are the substrate dreams operate on - [[Claude Managed Agents Sessions]] are the source material dreams mine - The dream itself runs as a managed session internally, so the same [[Claude Managed Agents Events|events and streaming]] surface is available to watch it work Closest contrast inside the Managed Agents family: [[Claude Managed Agents Outcomes]] is rubric-based self-grading inside a session; dreams are post-hoc reflection across many sessions. ## References - https://platform.claude.com/docs/en/managed-agents/dreams ## Related - [[Claude Managed Agents]] - [[Claude Managed Agents Memory Stores]] - [[Claude Managed Agents Sessions]] - [[Claude Managed Agents Events]] - [[Claude Managed Agents Outcomes]] - [[AI Agent Memory]]