Debian Codegraph @

src/anthropic/types/beta/beta_dream.py

raw
1 from typing import List, Optional
2 from datetime import datetime
3 from typing_extensions import Literal
4
5 from ..._models import BaseModel
6 from .beta_dream_error import BetaDreamError
7 from .beta_dream_input import BetaDreamInput
8 from .beta_dream_usage import BetaDreamUsage
9 from .beta_dream_output import BetaDreamOutput
10 from .beta_dream_status import BetaDreamStatus
11 from .beta_output_behavior import BetaOutputBehavior
12 from .beta_dream_model_config import BetaDreamModelConfig
13
14 __all__ = ["BetaDream"]
15
16
17 class BetaDream(BaseModel):
18 """
19 An asynchronous job that reads a memory store and past sessions, then writes a reorganized version of that memory store.
20
21 By default the dream writes its result to a new memory store and doesn't change the input memory store. With `output_behavior` set to `update_existing`, it writes its result into the input memory store instead.
22
23 The Dreams API is in research preview: the request and response shapes are volatile and may change without the deprecation period that applies to generally-available endpoints.
24
25 See the [Dreams guide](https://platform.claude.com/docs/en/managed-agents/dreams#how-it-works) for what a dream reads and produces.
26 """
27
28 id: str
29 """The unique ID of the dream (`drm_...`)."""
30
31 archived_at: Optional[datetime] = None
32 """When the dream was archived, in RFC 3339, or `null` if it hasn't been archived."""
33
34 created_at: datetime
35 """When the dream was created, in RFC 3339.
36
37 Lists of dreams are sorted by this time, newest first.
38 """
39
40 ended_at: Optional[datetime] = None
41 """
42 When the dream reached `completed`, `failed`, or `canceled`, in RFC 3339, or
43 `null` if it is still `pending` or `running`.
44 """
45
46 error: Optional[BetaDreamError] = None
47 """Why the dream failed, or `null` if `status` isn't `failed`."""
48
49 inputs: List[BetaDreamInput]
50 """The sources that the dream reads, from the request that created it."""
51
52 instructions: Optional[str] = None
53 """The guidance given when the dream was created, or `null` if none was given."""
54
55 model: BetaDreamModelConfig
56 """The model that runs a dream, from the request that created it.
57
58 The dream uses this model for all of its work. The response always gives the
59 model as an object, even if the request gave only a model ID.
60 """
61
62 output_behavior: BetaOutputBehavior
63 """Where the dream writes its result, as set in the request that created the dream.
64
65 If that request left out `output_behavior`, the dream used the `create_new`
66 behavior.
67 """
68
69 outputs: List[BetaDreamOutput]
70 """
71 The memory store that holds the dream's result, as a one-item array, or an empty
72 array until the dream records that memory store.
73
74 The array is empty while the dream is `pending` and for a short time after it
75 starts `running`. It can stay empty if the dream fails or is canceled before
76 then. The memory store holds the complete result only once `status` is
77 `completed`.
78
79 See the
80 [Dreams guide](https://platform.claude.com/docs/en/managed-agents/dreams#use-the-output)
81 for how to review and use the result.
82 """
83
84 session_id: Optional[str] = None
85 """
86 The ID of the session that runs the dream (`sesn_...`), or `null` if that
87 session hasn't started.
88
89 Stream that session's events to follow what the dream reads and writes.
90
91 See the
92 [Dreams guide](https://platform.claude.com/docs/en/managed-agents/dreams#watch-the-pipeline-run)
93 for how to watch a running dream.
94 """
95
96 status: BetaDreamStatus
97 """Where a dream is in its lifecycle.
98
99 `completed`, `failed`, and `canceled` are final: once a dream has one of these
100 statuses, its status doesn't change again.
101
102 See the
103 [Dreams guide](https://platform.claude.com/docs/en/managed-agents/dreams#lifecycle)
104 for what each status means.
105 """
106
107 type: Literal["dream"]
108
109 usage: BetaDreamUsage
110 """
111 The dream's token counts, which stop changing once its `status` is `completed`
112 or `failed`. After a cancel, they can keep changing.
113 """