cadenya 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/cadenya/client.rb +2 -2
- data/lib/cadenya/models/agent_spec.rb +23 -1
- data/lib/cadenya/models/agents/agent_variation_info.rb +2 -1
- data/lib/cadenya/models/agents/agent_variation_spec.rb +1 -22
- data/lib/cadenya/models/agents/variation_add_memory_layer_params.rb +3 -2
- data/lib/cadenya/models/agents/variation_memory_layer_assignment.rb +7 -6
- data/lib/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_memory_entry_outcome.rb +2 -2
- data/lib/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_memory_layer_outcome.rb +4 -4
- data/lib/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_variation_memory_layer_outcome.rb +2 -2
- data/lib/cadenya/models/memory_layer.rb +4 -4
- data/lib/cadenya/models/memory_layer_list_params.rb +22 -1
- data/lib/cadenya/models/memory_layer_spec.rb +20 -2
- data/lib/cadenya/models/memory_layers/memory_entry.rb +2 -2
- data/lib/cadenya/models/memory_read.rb +2 -2
- data/lib/cadenya/models/memory_reference.rb +6 -5
- data/lib/cadenya/models/objective.rb +51 -16
- data/lib/cadenya/models/objective_create_params.rb +41 -16
- data/lib/cadenya/models/objective_event_data.rb +2 -2
- data/lib/cadenya/models/objective_info.rb +11 -9
- data/lib/cadenya/resources/agents/variations.rb +2 -2
- data/lib/cadenya/resources/memory_layers/entries.rb +2 -2
- data/lib/cadenya/resources/memory_layers.rb +14 -5
- data/lib/cadenya/resources/objectives.rb +4 -2
- data/lib/cadenya/version.rb +1 -1
- data/rbi/cadenya/client.rbi +2 -2
- data/rbi/cadenya/models/agent_spec.rbi +34 -0
- data/rbi/cadenya/models/agents/agent_variation_info.rbi +4 -2
- data/rbi/cadenya/models/agents/agent_variation_spec.rbi +0 -32
- data/rbi/cadenya/models/agents/variation_add_memory_layer_params.rbi +4 -2
- data/rbi/cadenya/models/agents/variation_memory_layer_assignment.rbi +10 -8
- data/rbi/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_memory_entry_outcome.rbi +4 -4
- data/rbi/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_memory_layer_outcome.rbi +8 -8
- data/rbi/cadenya/models/bulk_workspace_resources/bulk_workspace_apply_result_data_variation_memory_layer_outcome.rbi +4 -4
- data/rbi/cadenya/models/memory_layer.rbi +4 -4
- data/rbi/cadenya/models/memory_layer_list_params.rbi +26 -0
- data/rbi/cadenya/models/memory_layer_spec.rbi +28 -2
- data/rbi/cadenya/models/memory_layers/memory_entry.rbi +2 -2
- data/rbi/cadenya/models/memory_read.rbi +2 -2
- data/rbi/cadenya/models/memory_reference.rbi +9 -7
- data/rbi/cadenya/models/objective.rbi +81 -28
- data/rbi/cadenya/models/objective_create_params.rbi +72 -28
- data/rbi/cadenya/models/objective_event_data.rbi +4 -4
- data/rbi/cadenya/models/objective_info.rbi +16 -12
- data/rbi/cadenya/resources/agents/variations.rbi +3 -3
- data/rbi/cadenya/resources/memory_layers/entries.rbi +2 -2
- data/rbi/cadenya/resources/memory_layers.rbi +12 -4
- data/rbi/cadenya/resources/objectives.rbi +15 -13
- data/sig/cadenya/models/agent_spec.rbs +14 -0
- data/sig/cadenya/models/agents/agent_variation_spec.rbs +0 -14
- data/sig/cadenya/models/memory_layer_list_params.rbs +14 -0
- data/sig/cadenya/models/memory_layer_spec.rbs +14 -0
- data/sig/cadenya/models/objective.rbs +30 -5
- data/sig/cadenya/models/objective_create_params.rbs +26 -5
- data/sig/cadenya/models/objective_info.rbs +4 -4
- data/sig/cadenya/resources/memory_layers.rbs +2 -0
- data/sig/cadenya/resources/objectives.rbs +2 -1
- metadata +2 -2
|
@@ -32,8 +32,8 @@ module Cadenya
|
|
|
32
32
|
attr_writer :message
|
|
33
33
|
|
|
34
34
|
# MemoryRead is emitted each time the agent resolves a key against the memory
|
|
35
|
-
#
|
|
36
|
-
# emit this event.
|
|
35
|
+
# cascade and loads an entry. Lookups that miss (key not found in any layer) do
|
|
36
|
+
# not emit this event.
|
|
37
37
|
sig do
|
|
38
38
|
params(
|
|
39
39
|
memory_entry_id: String,
|
|
@@ -8,9 +8,10 @@ module Cadenya
|
|
|
8
8
|
T.any(Cadenya::MemoryReference, Cadenya::Internal::AnyHash)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
# When set,
|
|
12
|
-
# as a single-entry layer (only this key resolves at this position). The
|
|
13
|
-
# must belong to memory_layer_id; mismatches are rejected with
|
|
11
|
+
# When set, inserts only this entry from memory_layer_id into the cascade —
|
|
12
|
+
# behaves as a single-entry layer (only this key resolves at this position). The
|
|
13
|
+
# entry must belong to memory_layer_id; mismatches are rejected with
|
|
14
|
+
# InvalidArgument.
|
|
14
15
|
sig { returns(T.nilable(String)) }
|
|
15
16
|
attr_reader :memory_entry_id
|
|
16
17
|
|
|
@@ -24,7 +25,7 @@ module Cadenya
|
|
|
24
25
|
attr_writer :memory_layer_id
|
|
25
26
|
|
|
26
27
|
# MemoryReference identifies a memory layer or a specific entry within one, for
|
|
27
|
-
# composition into a memory
|
|
28
|
+
# composition into a memory cascade. Used on objectives (where entry pinning is
|
|
28
29
|
# permitted).
|
|
29
30
|
#
|
|
30
31
|
# memory*layer_id accepts both the canonical form (memlyr*…) and the external-id
|
|
@@ -35,9 +36,10 @@ module Cadenya
|
|
|
35
36
|
)
|
|
36
37
|
end
|
|
37
38
|
def self.new(
|
|
38
|
-
# When set,
|
|
39
|
-
# as a single-entry layer (only this key resolves at this position). The
|
|
40
|
-
# must belong to memory_layer_id; mismatches are rejected with
|
|
39
|
+
# When set, inserts only this entry from memory_layer_id into the cascade —
|
|
40
|
+
# behaves as a single-entry layer (only this key resolves at this position). The
|
|
41
|
+
# entry must belong to memory_layer_id; mismatches are rejected with
|
|
42
|
+
# InvalidArgument.
|
|
41
43
|
memory_entry_id: nil,
|
|
42
44
|
memory_layer_id: nil
|
|
43
45
|
)
|
|
@@ -19,28 +19,35 @@ module Cadenya
|
|
|
19
19
|
sig { params(metadata: Cadenya::OperationMetadata::OrHash).void }
|
|
20
20
|
attr_writer :metadata
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
|
|
22
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
23
|
+
sig { returns(T.nilable(Cadenya::Objective::EpisodicMemory)) }
|
|
24
|
+
attr_reader :episodic_memory
|
|
25
|
+
|
|
26
|
+
sig do
|
|
27
|
+
params(episodic_memory: Cadenya::Objective::EpisodicMemory::OrHash).void
|
|
28
|
+
end
|
|
29
|
+
attr_writer :episodic_memory
|
|
30
|
+
|
|
31
|
+
# Memory layers/entries layered over the baseline cascade inherited from the
|
|
32
|
+
# selected variation — element-level rules over inherited styles, in CSS terms.
|
|
24
33
|
#
|
|
25
|
-
# Array order is
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# position.
|
|
34
|
+
# Array order is resolution order: EARLIER elements are more specific and are
|
|
35
|
+
# consulted first. Entries pinned via memory_entry_id behave as single-entry
|
|
36
|
+
# layers at their position.
|
|
29
37
|
#
|
|
30
38
|
# System-managed layers (e.g., episodic) cannot be referenced here; they attach
|
|
31
|
-
# themselves automatically based on
|
|
32
|
-
#
|
|
33
|
-
# Stack size cap: the TOTAL effective stack (variation's memory layers
|
|
39
|
+
# themselves automatically based on the episodic key.
|
|
34
40
|
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
41
|
+
# Size cap: the TOTAL effective cascade (this field + the variation's memory layer
|
|
42
|
+
# assignments) must not exceed 10 entries. A request that would produce a larger
|
|
43
|
+
# cascade is rejected with InvalidArgument.
|
|
37
44
|
sig { returns(T.nilable(T::Array[Cadenya::MemoryReference])) }
|
|
38
|
-
attr_reader :
|
|
45
|
+
attr_reader :memory_cascade
|
|
39
46
|
|
|
40
47
|
sig do
|
|
41
|
-
params(
|
|
48
|
+
params(memory_cascade: T::Array[Cadenya::MemoryReference::OrHash]).void
|
|
42
49
|
end
|
|
43
|
-
attr_writer :
|
|
50
|
+
attr_writer :memory_cascade
|
|
44
51
|
|
|
45
52
|
# Secrets that can be used in the headers for tool calls using the secret
|
|
46
53
|
# interpolation format.
|
|
@@ -125,8 +132,9 @@ module Cadenya
|
|
|
125
132
|
state: Cadenya::Objective::State::OrSymbol,
|
|
126
133
|
system_prompt: String,
|
|
127
134
|
data: T::Hash[Symbol, T.anything],
|
|
135
|
+
episodic_memory: Cadenya::Objective::EpisodicMemory::OrHash,
|
|
128
136
|
info: Cadenya::ObjectiveInfo::OrHash,
|
|
129
|
-
|
|
137
|
+
memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
|
|
130
138
|
output: T::Hash[Symbol, T.anything],
|
|
131
139
|
parent_objective_id: String,
|
|
132
140
|
secrets: T::Array[Cadenya::ObjectiveSecret::OrHash],
|
|
@@ -150,25 +158,25 @@ module Cadenya
|
|
|
150
158
|
system_prompt:,
|
|
151
159
|
# Arbitrary data for the objective
|
|
152
160
|
data: nil,
|
|
161
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
162
|
+
episodic_memory: nil,
|
|
153
163
|
# ObjectiveInfo provides read-only aggregated statistics about an objective's
|
|
154
164
|
# execution
|
|
155
165
|
info: nil,
|
|
156
|
-
# Memory layers/entries
|
|
157
|
-
#
|
|
166
|
+
# Memory layers/entries layered over the baseline cascade inherited from the
|
|
167
|
+
# selected variation — element-level rules over inherited styles, in CSS terms.
|
|
158
168
|
#
|
|
159
|
-
# Array order is
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
# position.
|
|
169
|
+
# Array order is resolution order: EARLIER elements are more specific and are
|
|
170
|
+
# consulted first. Entries pinned via memory_entry_id behave as single-entry
|
|
171
|
+
# layers at their position.
|
|
163
172
|
#
|
|
164
173
|
# System-managed layers (e.g., episodic) cannot be referenced here; they attach
|
|
165
|
-
# themselves automatically based on
|
|
174
|
+
# themselves automatically based on the episodic key.
|
|
166
175
|
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
|
|
171
|
-
memory_stack: nil,
|
|
176
|
+
# Size cap: the TOTAL effective cascade (this field + the variation's memory layer
|
|
177
|
+
# assignments) must not exceed 10 entries. A request that would produce a larger
|
|
178
|
+
# cascade is rejected with InvalidArgument.
|
|
179
|
+
memory_cascade: nil,
|
|
172
180
|
# The output of the objective, populated when the objective completes. Will match
|
|
173
181
|
# the schema of output_json_schema or output_json_inferred. This will only be set
|
|
174
182
|
# if the state of the objective is set to STATE_FINALIZED
|
|
@@ -195,8 +203,9 @@ module Cadenya
|
|
|
195
203
|
state: Cadenya::Objective::State::TaggedSymbol,
|
|
196
204
|
system_prompt: String,
|
|
197
205
|
data: T::Hash[Symbol, T.anything],
|
|
206
|
+
episodic_memory: Cadenya::Objective::EpisodicMemory,
|
|
198
207
|
info: Cadenya::ObjectiveInfo,
|
|
199
|
-
|
|
208
|
+
memory_cascade: T::Array[Cadenya::MemoryReference],
|
|
200
209
|
output: T::Hash[Symbol, T.anything],
|
|
201
210
|
parent_objective_id: String,
|
|
202
211
|
secrets: T::Array[Cadenya::ObjectiveSecret],
|
|
@@ -236,6 +245,50 @@ module Cadenya
|
|
|
236
245
|
def self.values
|
|
237
246
|
end
|
|
238
247
|
end
|
|
248
|
+
|
|
249
|
+
class EpisodicMemory < Cadenya::Internal::Type::BaseModel
|
|
250
|
+
OrHash =
|
|
251
|
+
T.type_alias do
|
|
252
|
+
T.any(
|
|
253
|
+
Cadenya::Objective::EpisodicMemory,
|
|
254
|
+
Cadenya::Internal::AnyHash
|
|
255
|
+
)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# The caller-supplied episodic key. Objectives created with the same key (for the
|
|
259
|
+
# same agent) share one episodic memory layer.
|
|
260
|
+
sig { returns(T.nilable(String)) }
|
|
261
|
+
attr_reader :key
|
|
262
|
+
|
|
263
|
+
sig { params(key: String).void }
|
|
264
|
+
attr_writer :key
|
|
265
|
+
|
|
266
|
+
# The episodic memory layer resolved (created or reused) for this objective's key.
|
|
267
|
+
# Populated by the system at objective creation.
|
|
268
|
+
sig { returns(T.nilable(String)) }
|
|
269
|
+
attr_reader :memory_layer_id
|
|
270
|
+
|
|
271
|
+
sig { params(memory_layer_id: String).void }
|
|
272
|
+
attr_writer :memory_layer_id
|
|
273
|
+
|
|
274
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
275
|
+
sig do
|
|
276
|
+
params(key: String, memory_layer_id: String).returns(T.attached_class)
|
|
277
|
+
end
|
|
278
|
+
def self.new(
|
|
279
|
+
# The caller-supplied episodic key. Objectives created with the same key (for the
|
|
280
|
+
# same agent) share one episodic memory layer.
|
|
281
|
+
key: nil,
|
|
282
|
+
# The episodic memory layer resolved (created or reused) for this objective's key.
|
|
283
|
+
# Populated by the system at objective creation.
|
|
284
|
+
memory_layer_id: nil
|
|
285
|
+
)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
sig { override.returns({ key: String, memory_layer_id: String }) }
|
|
289
|
+
def to_hash
|
|
290
|
+
end
|
|
291
|
+
end
|
|
239
292
|
end
|
|
240
293
|
end
|
|
241
294
|
end
|
|
@@ -22,6 +22,18 @@ module Cadenya
|
|
|
22
22
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
23
23
|
attr_accessor :data
|
|
24
24
|
|
|
25
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
26
|
+
sig { returns(T.nilable(Cadenya::ObjectiveCreateParams::EpisodicMemory)) }
|
|
27
|
+
attr_reader :episodic_memory
|
|
28
|
+
|
|
29
|
+
sig do
|
|
30
|
+
params(
|
|
31
|
+
episodic_memory:
|
|
32
|
+
Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash
|
|
33
|
+
).void
|
|
34
|
+
end
|
|
35
|
+
attr_writer :episodic_memory
|
|
36
|
+
|
|
25
37
|
# Optional override for the initial message sent to the agent. This becomes the
|
|
26
38
|
# first user message in the LLM chat history. When not set, the selected
|
|
27
39
|
# variation's user_message_template is rendered with user_data instead. If neither
|
|
@@ -33,28 +45,26 @@ module Cadenya
|
|
|
33
45
|
sig { params(initial_message: String).void }
|
|
34
46
|
attr_writer :initial_message
|
|
35
47
|
|
|
36
|
-
# Memory layers/entries
|
|
37
|
-
#
|
|
48
|
+
# Memory layers/entries layered over the baseline cascade inherited from the
|
|
49
|
+
# selected variation — element-level rules over inherited styles, in CSS terms.
|
|
38
50
|
#
|
|
39
|
-
# Array order is
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
# position.
|
|
51
|
+
# Array order is resolution order: EARLIER elements are more specific and are
|
|
52
|
+
# consulted first. Entries pinned via memory_entry_id behave as single-entry
|
|
53
|
+
# layers at their position.
|
|
43
54
|
#
|
|
44
55
|
# System-managed layers (e.g., episodic) cannot be referenced here; they attach
|
|
45
|
-
# themselves automatically based on
|
|
46
|
-
#
|
|
47
|
-
# Stack size cap: the TOTAL effective stack (variation's memory layers
|
|
56
|
+
# themselves automatically based on the episodic key.
|
|
48
57
|
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
58
|
+
# Size cap: the TOTAL effective cascade (this field + the variation's memory layer
|
|
59
|
+
# assignments) must not exceed 10 entries. A request that would produce a larger
|
|
60
|
+
# cascade is rejected with InvalidArgument.
|
|
51
61
|
sig { returns(T.nilable(T::Array[Cadenya::MemoryReference])) }
|
|
52
|
-
attr_reader :
|
|
62
|
+
attr_reader :memory_cascade
|
|
53
63
|
|
|
54
64
|
sig do
|
|
55
|
-
params(
|
|
65
|
+
params(memory_cascade: T::Array[Cadenya::MemoryReference::OrHash]).void
|
|
56
66
|
end
|
|
57
|
-
attr_writer :
|
|
67
|
+
attr_writer :memory_cascade
|
|
58
68
|
|
|
59
69
|
# CreateOperationMetadata contains the user-provided fields for creating an
|
|
60
70
|
# operation. Read-only fields (id, account_id, workspace_id, created_at,
|
|
@@ -101,8 +111,10 @@ module Cadenya
|
|
|
101
111
|
workspace_id: String,
|
|
102
112
|
agent_id: String,
|
|
103
113
|
data: T::Hash[Symbol, T.anything],
|
|
114
|
+
episodic_memory:
|
|
115
|
+
Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash,
|
|
104
116
|
initial_message: String,
|
|
105
|
-
|
|
117
|
+
memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
|
|
106
118
|
metadata: Cadenya::CreateOperationMetadata::OrHash,
|
|
107
119
|
secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
|
|
108
120
|
user_data: T::Hash[Symbol, T.anything],
|
|
@@ -116,28 +128,28 @@ module Cadenya
|
|
|
116
128
|
# Arbitrary data for the objective. May be used in liquid templates for prompts
|
|
117
129
|
# configured on the agent variation
|
|
118
130
|
data:,
|
|
131
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
132
|
+
episodic_memory: nil,
|
|
119
133
|
# Optional override for the initial message sent to the agent. This becomes the
|
|
120
134
|
# first user message in the LLM chat history. When not set, the selected
|
|
121
135
|
# variation's user_message_template is rendered with user_data instead. If neither
|
|
122
136
|
# this field nor a user_message_template is present, the request is rejected with
|
|
123
137
|
# InvalidArgument.
|
|
124
138
|
initial_message: nil,
|
|
125
|
-
# Memory layers/entries
|
|
126
|
-
#
|
|
139
|
+
# Memory layers/entries layered over the baseline cascade inherited from the
|
|
140
|
+
# selected variation — element-level rules over inherited styles, in CSS terms.
|
|
127
141
|
#
|
|
128
|
-
# Array order is
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
# position.
|
|
142
|
+
# Array order is resolution order: EARLIER elements are more specific and are
|
|
143
|
+
# consulted first. Entries pinned via memory_entry_id behave as single-entry
|
|
144
|
+
# layers at their position.
|
|
132
145
|
#
|
|
133
146
|
# System-managed layers (e.g., episodic) cannot be referenced here; they attach
|
|
134
|
-
# themselves automatically based on
|
|
147
|
+
# themselves automatically based on the episodic key.
|
|
135
148
|
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
|
|
140
|
-
memory_stack: nil,
|
|
149
|
+
# Size cap: the TOTAL effective cascade (this field + the variation's memory layer
|
|
150
|
+
# assignments) must not exceed 10 entries. A request that would produce a larger
|
|
151
|
+
# cascade is rejected with InvalidArgument.
|
|
152
|
+
memory_cascade: nil,
|
|
141
153
|
# CreateOperationMetadata contains the user-provided fields for creating an
|
|
142
154
|
# operation. Read-only fields (id, account_id, workspace_id, created_at,
|
|
143
155
|
# profile_id) are excluded since they are set by the server.
|
|
@@ -162,8 +174,9 @@ module Cadenya
|
|
|
162
174
|
workspace_id: String,
|
|
163
175
|
agent_id: String,
|
|
164
176
|
data: T::Hash[Symbol, T.anything],
|
|
177
|
+
episodic_memory: Cadenya::ObjectiveCreateParams::EpisodicMemory,
|
|
165
178
|
initial_message: String,
|
|
166
|
-
|
|
179
|
+
memory_cascade: T::Array[Cadenya::MemoryReference],
|
|
167
180
|
metadata: Cadenya::CreateOperationMetadata,
|
|
168
181
|
secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret],
|
|
169
182
|
user_data: T::Hash[Symbol, T.anything],
|
|
@@ -175,6 +188,37 @@ module Cadenya
|
|
|
175
188
|
def to_hash
|
|
176
189
|
end
|
|
177
190
|
|
|
191
|
+
class EpisodicMemory < Cadenya::Internal::Type::BaseModel
|
|
192
|
+
OrHash =
|
|
193
|
+
T.type_alias do
|
|
194
|
+
T.any(
|
|
195
|
+
Cadenya::ObjectiveCreateParams::EpisodicMemory,
|
|
196
|
+
Cadenya::Internal::AnyHash
|
|
197
|
+
)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# The caller-supplied episodic key. Objectives created with the same key (for the
|
|
201
|
+
# same agent) share one episodic memory layer.
|
|
202
|
+
sig { returns(T.nilable(String)) }
|
|
203
|
+
attr_reader :key
|
|
204
|
+
|
|
205
|
+
sig { params(key: String).void }
|
|
206
|
+
attr_writer :key
|
|
207
|
+
|
|
208
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
209
|
+
sig { params(key: String).returns(T.attached_class) }
|
|
210
|
+
def self.new(
|
|
211
|
+
# The caller-supplied episodic key. Objectives created with the same key (for the
|
|
212
|
+
# same agent) share one episodic memory layer.
|
|
213
|
+
key: nil
|
|
214
|
+
)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
sig { override.returns({ key: String, memory_layer_id: String }) }
|
|
218
|
+
def to_hash
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
178
222
|
class Secret < Cadenya::Internal::Type::BaseModel
|
|
179
223
|
OrHash =
|
|
180
224
|
T.type_alias do
|
|
@@ -53,8 +53,8 @@ module Cadenya
|
|
|
53
53
|
attr_writer :finalized
|
|
54
54
|
|
|
55
55
|
# MemoryRead is emitted each time the agent resolves a key against the memory
|
|
56
|
-
#
|
|
57
|
-
# emit this event.
|
|
56
|
+
# cascade and loads an entry. Lookups that miss (key not found in any layer) do
|
|
57
|
+
# not emit this event.
|
|
58
58
|
sig { returns(T.nilable(Cadenya::MemoryRead)) }
|
|
59
59
|
attr_reader :memory_read
|
|
60
60
|
|
|
@@ -158,8 +158,8 @@ module Cadenya
|
|
|
158
158
|
# compaction, or continuation are permitted.
|
|
159
159
|
finalized: nil,
|
|
160
160
|
# MemoryRead is emitted each time the agent resolves a key against the memory
|
|
161
|
-
#
|
|
162
|
-
# emit this event.
|
|
161
|
+
# cascade and loads an entry. Lookups that miss (key not found in any layer) do
|
|
162
|
+
# not emit this event.
|
|
163
163
|
memory_read: nil,
|
|
164
164
|
sub_agent_spawned: nil,
|
|
165
165
|
sub_agent_updated: nil,
|
|
@@ -36,12 +36,14 @@ module Cadenya
|
|
|
36
36
|
sig { returns(String) }
|
|
37
37
|
attr_accessor :current_context_window_id
|
|
38
38
|
|
|
39
|
-
# The effective memory
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
39
|
+
# The effective memory cascade at objective creation time: the episodic layer
|
|
40
|
+
# (when present), then Objective.memory_cascade, then the variation's baseline
|
|
41
|
+
# layers by ascending position. Order is resolution order — index 0 is the most
|
|
42
|
+
# specific and is consulted first; the first layer containing a key wins. Returned
|
|
43
|
+
# on reads so clients can see exactly what the objective resolves against without
|
|
44
|
+
# re-joining variation state.
|
|
43
45
|
sig { returns(T::Array[Cadenya::MemoryReference]) }
|
|
44
|
-
attr_accessor :
|
|
46
|
+
attr_accessor :effective_memory_cascade
|
|
45
47
|
|
|
46
48
|
# Total number of context windows that this objective has generated
|
|
47
49
|
sig { returns(Integer) }
|
|
@@ -76,7 +78,7 @@ module Cadenya
|
|
|
76
78
|
agent_variation: Cadenya::ResourceMetadata::OrHash,
|
|
77
79
|
created_by: Cadenya::Profile::OrHash,
|
|
78
80
|
current_context_window_id: String,
|
|
79
|
-
|
|
81
|
+
effective_memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
|
|
80
82
|
total_context_windows: Integer,
|
|
81
83
|
total_events: Integer,
|
|
82
84
|
total_input_tokens: Integer,
|
|
@@ -97,11 +99,13 @@ module Cadenya
|
|
|
97
99
|
# ID of the objective's current (most recent) context window. Hydrated on demand;
|
|
98
100
|
# empty when the objective has not yet produced a context window.
|
|
99
101
|
current_context_window_id:,
|
|
100
|
-
# The effective memory
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
|
|
102
|
+
# The effective memory cascade at objective creation time: the episodic layer
|
|
103
|
+
# (when present), then Objective.memory_cascade, then the variation's baseline
|
|
104
|
+
# layers by ascending position. Order is resolution order — index 0 is the most
|
|
105
|
+
# specific and is consulted first; the first layer containing a key wins. Returned
|
|
106
|
+
# on reads so clients can see exactly what the objective resolves against without
|
|
107
|
+
# re-joining variation state.
|
|
108
|
+
effective_memory_cascade:,
|
|
105
109
|
# Total number of context windows that this objective has generated
|
|
106
110
|
total_context_windows:,
|
|
107
111
|
# Total number of events generated during this objective's execution
|
|
@@ -125,7 +129,7 @@ module Cadenya
|
|
|
125
129
|
agent_variation: Cadenya::ResourceMetadata,
|
|
126
130
|
created_by: Cadenya::Profile,
|
|
127
131
|
current_context_window_id: String,
|
|
128
|
-
|
|
132
|
+
effective_memory_cascade: T::Array[Cadenya::MemoryReference],
|
|
129
133
|
total_context_windows: Integer,
|
|
130
134
|
total_events: Integer,
|
|
131
135
|
total_input_tokens: Integer,
|
|
@@ -182,7 +182,7 @@ module Cadenya
|
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
# Attaches a memory layer to a variation at a given position in the variation's
|
|
185
|
-
# baseline memory
|
|
185
|
+
# baseline memory cascade.
|
|
186
186
|
sig do
|
|
187
187
|
params(
|
|
188
188
|
variation_id: String,
|
|
@@ -205,8 +205,8 @@ module Cadenya
|
|
|
205
205
|
# Body param: Layer to attach. Accepts the canonical `memlyr_…` form or the
|
|
206
206
|
# `external_id:<value>` form.
|
|
207
207
|
memory_layer_id: nil,
|
|
208
|
-
# Body param: Position in the
|
|
209
|
-
# position + 1).
|
|
208
|
+
# Body param: Position in the baseline cascade (lower = more specific). If
|
|
209
|
+
# omitted, the server appends at the most general end (max existing position + 1).
|
|
210
210
|
position: nil,
|
|
211
211
|
request_options: {}
|
|
212
212
|
)
|
|
@@ -4,8 +4,8 @@ module Cadenya
|
|
|
4
4
|
module Resources
|
|
5
5
|
class MemoryLayers
|
|
6
6
|
# Manage memory layers and their entries. Layers are named containers that can be
|
|
7
|
-
# composed into an objective's memory
|
|
8
|
-
# layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
7
|
+
# composed into an objective's memory cascade; entries are the keyed values within
|
|
8
|
+
# a layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
9
9
|
# cannot be mutated through this API.
|
|
10
10
|
class Entries
|
|
11
11
|
# Creates a new entry in a memory layer. Returns the detail view, including the
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
module Cadenya
|
|
4
4
|
module Resources
|
|
5
5
|
# Manage memory layers and their entries. Layers are named containers that can be
|
|
6
|
-
# composed into an objective's memory
|
|
7
|
-
# layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
6
|
+
# composed into an objective's memory cascade; entries are the keyed values within
|
|
7
|
+
# a layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
8
8
|
# cannot be mutated through this API.
|
|
9
9
|
class MemoryLayers
|
|
10
10
|
# Manage memory layers and their entries. Layers are named containers that can be
|
|
11
|
-
# composed into an objective's memory
|
|
12
|
-
# layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
11
|
+
# composed into an objective's memory cascade; entries are the keyed values within
|
|
12
|
+
# a layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
13
13
|
# cannot be mutated through this API.
|
|
14
14
|
sig { returns(Cadenya::Resources::MemoryLayers::Entries) }
|
|
15
15
|
attr_reader :entries
|
|
@@ -84,8 +84,10 @@ module Cadenya
|
|
|
84
84
|
sig do
|
|
85
85
|
params(
|
|
86
86
|
workspace_id: String,
|
|
87
|
+
agent_id: String,
|
|
87
88
|
bundle_key: String,
|
|
88
89
|
cursor: String,
|
|
90
|
+
episodic_key_prefix: String,
|
|
89
91
|
include_info: T::Boolean,
|
|
90
92
|
limit: Integer,
|
|
91
93
|
prefix: String,
|
|
@@ -97,10 +99,16 @@ module Cadenya
|
|
|
97
99
|
end
|
|
98
100
|
def list(
|
|
99
101
|
workspace_id,
|
|
102
|
+
# Filter to episodic layers belonging to this agent.
|
|
103
|
+
agent_id: nil,
|
|
100
104
|
# Filter by bundle_key — return only resources owned by this bundle.
|
|
101
105
|
bundle_key: nil,
|
|
102
106
|
# Pagination cursor from previous response
|
|
103
107
|
cursor: nil,
|
|
108
|
+
# Filter to episodic layers whose episodic key starts with this prefix (e.g.
|
|
109
|
+
# "customer/" matches "customer/42" and "customer/43"). Useful for namespaced
|
|
110
|
+
# keys, similar to a redis key scan.
|
|
111
|
+
episodic_key_prefix: nil,
|
|
104
112
|
# When set to true you may use more of your alloted API rate-limit
|
|
105
113
|
include_info: nil,
|
|
106
114
|
# Maximum number of results to return
|
|
@@ -21,8 +21,10 @@ module Cadenya
|
|
|
21
21
|
workspace_id: String,
|
|
22
22
|
agent_id: String,
|
|
23
23
|
data: T::Hash[Symbol, T.anything],
|
|
24
|
+
episodic_memory:
|
|
25
|
+
Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash,
|
|
24
26
|
initial_message: String,
|
|
25
|
-
|
|
27
|
+
memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
|
|
26
28
|
metadata: Cadenya::CreateOperationMetadata::OrHash,
|
|
27
29
|
secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
|
|
28
30
|
user_data: T::Hash[Symbol, T.anything],
|
|
@@ -36,28 +38,28 @@ module Cadenya
|
|
|
36
38
|
# Arbitrary data for the objective. May be used in liquid templates for prompts
|
|
37
39
|
# configured on the agent variation
|
|
38
40
|
data:,
|
|
41
|
+
# Episodic is used to configure the episodic memory for the objective
|
|
42
|
+
episodic_memory: nil,
|
|
39
43
|
# Optional override for the initial message sent to the agent. This becomes the
|
|
40
44
|
# first user message in the LLM chat history. When not set, the selected
|
|
41
45
|
# variation's user_message_template is rendered with user_data instead. If neither
|
|
42
46
|
# this field nor a user_message_template is present, the request is rejected with
|
|
43
47
|
# InvalidArgument.
|
|
44
48
|
initial_message: nil,
|
|
45
|
-
# Memory layers/entries
|
|
46
|
-
#
|
|
49
|
+
# Memory layers/entries layered over the baseline cascade inherited from the
|
|
50
|
+
# selected variation — element-level rules over inherited styles, in CSS terms.
|
|
47
51
|
#
|
|
48
|
-
# Array order is
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
# position.
|
|
52
|
+
# Array order is resolution order: EARLIER elements are more specific and are
|
|
53
|
+
# consulted first. Entries pinned via memory_entry_id behave as single-entry
|
|
54
|
+
# layers at their position.
|
|
52
55
|
#
|
|
53
56
|
# System-managed layers (e.g., episodic) cannot be referenced here; they attach
|
|
54
|
-
# themselves automatically based on
|
|
57
|
+
# themselves automatically based on the episodic key.
|
|
55
58
|
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
memory_stack: nil,
|
|
59
|
+
# Size cap: the TOTAL effective cascade (this field + the variation's memory layer
|
|
60
|
+
# assignments) must not exceed 10 entries. A request that would produce a larger
|
|
61
|
+
# cascade is rejected with InvalidArgument.
|
|
62
|
+
memory_cascade: nil,
|
|
61
63
|
# CreateOperationMetadata contains the user-provided fields for creating an
|
|
62
64
|
# operation. Read-only fields (id, account_id, workspace_id, created_at,
|
|
63
65
|
# profile_id) are excluded since they are set by the server.
|
|
@@ -4,6 +4,8 @@ module Cadenya
|
|
|
4
4
|
{
|
|
5
5
|
variation_selection_mode: Cadenya::Models::AgentSpec::variation_selection_mode,
|
|
6
6
|
description: String,
|
|
7
|
+
enable_episodic_memory: bool,
|
|
8
|
+
episodic_memory_ttl: Integer,
|
|
7
9
|
input_data_schema: ::Hash[Symbol, top],
|
|
8
10
|
output_definition: ::Hash[Symbol, top],
|
|
9
11
|
webhook_events_url: String
|
|
@@ -16,6 +18,14 @@ module Cadenya
|
|
|
16
18
|
|
|
17
19
|
def description=: (String) -> String
|
|
18
20
|
|
|
21
|
+
attr_reader enable_episodic_memory: bool?
|
|
22
|
+
|
|
23
|
+
def enable_episodic_memory=: (bool) -> bool
|
|
24
|
+
|
|
25
|
+
attr_reader episodic_memory_ttl: Integer?
|
|
26
|
+
|
|
27
|
+
def episodic_memory_ttl=: (Integer) -> Integer
|
|
28
|
+
|
|
19
29
|
attr_reader input_data_schema: ::Hash[Symbol, top]?
|
|
20
30
|
|
|
21
31
|
def input_data_schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
|
|
@@ -31,6 +41,8 @@ module Cadenya
|
|
|
31
41
|
def initialize: (
|
|
32
42
|
variation_selection_mode: Cadenya::Models::AgentSpec::variation_selection_mode,
|
|
33
43
|
?description: String,
|
|
44
|
+
?enable_episodic_memory: bool,
|
|
45
|
+
?episodic_memory_ttl: Integer,
|
|
34
46
|
?input_data_schema: ::Hash[Symbol, top],
|
|
35
47
|
?output_definition: ::Hash[Symbol, top],
|
|
36
48
|
?webhook_events_url: String
|
|
@@ -39,6 +51,8 @@ module Cadenya
|
|
|
39
51
|
def to_hash: -> {
|
|
40
52
|
variation_selection_mode: Cadenya::Models::AgentSpec::variation_selection_mode,
|
|
41
53
|
description: String,
|
|
54
|
+
enable_episodic_memory: bool,
|
|
55
|
+
episodic_memory_ttl: Integer,
|
|
42
56
|
input_data_schema: ::Hash[Symbol, top],
|
|
43
57
|
output_definition: ::Hash[Symbol, top],
|
|
44
58
|
webhook_events_url: String
|