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
|
@@ -38,8 +38,8 @@ module Cadenya
|
|
|
38
38
|
|
|
39
39
|
# @!attribute memory_read
|
|
40
40
|
# MemoryRead is emitted each time the agent resolves a key against the memory
|
|
41
|
-
#
|
|
42
|
-
# emit this event.
|
|
41
|
+
# cascade and loads an entry. Lookups that miss (key not found in any layer) do
|
|
42
|
+
# not emit this event.
|
|
43
43
|
#
|
|
44
44
|
# @return [Cadenya::Models::MemoryRead, nil]
|
|
45
45
|
optional :memory_read, -> { Cadenya::MemoryRead }, api_name: :memoryRead
|
|
@@ -31,16 +31,18 @@ module Cadenya
|
|
|
31
31
|
# @return [String]
|
|
32
32
|
required :current_context_window_id, String, api_name: :currentContextWindowId
|
|
33
33
|
|
|
34
|
-
# @!attribute
|
|
35
|
-
# The effective memory
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
34
|
+
# @!attribute effective_memory_cascade
|
|
35
|
+
# The effective memory cascade at objective creation time: the episodic layer
|
|
36
|
+
# (when present), then Objective.memory_cascade, then the variation's baseline
|
|
37
|
+
# layers by ascending position. Order is resolution order — index 0 is the most
|
|
38
|
+
# specific and is consulted first; the first layer containing a key wins. Returned
|
|
39
|
+
# on reads so clients can see exactly what the objective resolves against without
|
|
40
|
+
# re-joining variation state.
|
|
39
41
|
#
|
|
40
42
|
# @return [Array<Cadenya::Models::MemoryReference>]
|
|
41
|
-
required :
|
|
43
|
+
required :effective_memory_cascade,
|
|
42
44
|
-> { Cadenya::Internal::Type::ArrayOf[Cadenya::MemoryReference] },
|
|
43
|
-
api_name: :
|
|
45
|
+
api_name: :effectiveMemoryCascade
|
|
44
46
|
|
|
45
47
|
# @!attribute total_context_windows
|
|
46
48
|
# Total number of context windows that this objective has generated
|
|
@@ -80,7 +82,7 @@ module Cadenya
|
|
|
80
82
|
required :total_tool_calls, Integer, api_name: :totalToolCalls
|
|
81
83
|
end
|
|
82
84
|
|
|
83
|
-
# @!method initialize(agent:, agent_variation:, created_by:, current_context_window_id:,
|
|
85
|
+
# @!method initialize(agent:, agent_variation:, created_by:, current_context_window_id:, effective_memory_cascade:, total_context_windows:, total_events:, total_input_tokens:, total_iterations:, total_output_tokens:, total_tool_calls:)
|
|
84
86
|
# Some parameter documentations has been truncated, see
|
|
85
87
|
# {Cadenya::Models::ObjectiveInfo} for more details.
|
|
86
88
|
#
|
|
@@ -95,7 +97,7 @@ module Cadenya
|
|
|
95
97
|
#
|
|
96
98
|
# @param current_context_window_id [String] ID of the objective's current (most recent) context window. Hydrated on
|
|
97
99
|
#
|
|
98
|
-
# @param
|
|
100
|
+
# @param effective_memory_cascade [Array<Cadenya::Models::MemoryReference>] The effective memory cascade at objective creation time: the
|
|
99
101
|
#
|
|
100
102
|
# @param total_context_windows [Integer] Total number of context windows that this objective has generated
|
|
101
103
|
#
|
|
@@ -256,7 +256,7 @@ module Cadenya
|
|
|
256
256
|
# {Cadenya::Models::Agents::VariationAddMemoryLayerParams} for more details.
|
|
257
257
|
#
|
|
258
258
|
# Attaches a memory layer to a variation at a given position in the variation's
|
|
259
|
-
# baseline memory
|
|
259
|
+
# baseline memory cascade.
|
|
260
260
|
#
|
|
261
261
|
# @overload add_memory_layer(variation_id, workspace_id:, agent_id:, memory_layer_id: nil, position: nil, request_options: {})
|
|
262
262
|
#
|
|
@@ -268,7 +268,7 @@ module Cadenya
|
|
|
268
268
|
#
|
|
269
269
|
# @param memory_layer_id [String] Body param: Layer to attach. Accepts the canonical `memlyr_…` form or the `exter
|
|
270
270
|
#
|
|
271
|
-
# @param position [Integer] Body param: Position in the
|
|
271
|
+
# @param position [Integer] Body param: Position in the baseline cascade (lower = more specific). If
|
|
272
272
|
#
|
|
273
273
|
# @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
274
274
|
#
|
|
@@ -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
|
# Some parameter documentations has been truncated, see
|
|
@@ -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
|
# @return [Cadenya::Resources::MemoryLayers::Entries]
|
|
15
15
|
attr_reader :entries
|
|
@@ -108,16 +108,23 @@ module Cadenya
|
|
|
108
108
|
)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# Some parameter documentations has been truncated, see
|
|
112
|
+
# {Cadenya::Models::MemoryLayerListParams} for more details.
|
|
113
|
+
#
|
|
111
114
|
# Lists all memory layers in the workspace
|
|
112
115
|
#
|
|
113
|
-
# @overload list(workspace_id, bundle_key: nil, cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, type: nil, request_options: {})
|
|
116
|
+
# @overload list(workspace_id, agent_id: nil, bundle_key: nil, cursor: nil, episodic_key_prefix: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, type: nil, request_options: {})
|
|
114
117
|
#
|
|
115
118
|
# @param workspace_id [String]
|
|
116
119
|
#
|
|
120
|
+
# @param agent_id [String] Filter to episodic layers belonging to this agent.
|
|
121
|
+
#
|
|
117
122
|
# @param bundle_key [String] Filter by bundle_key — return only resources owned by this bundle.
|
|
118
123
|
#
|
|
119
124
|
# @param cursor [String] Pagination cursor from previous response
|
|
120
125
|
#
|
|
126
|
+
# @param episodic_key_prefix [String] Filter to episodic layers whose episodic key starts with this prefix
|
|
127
|
+
#
|
|
121
128
|
# @param include_info [Boolean] When set to true you may use more of your alloted API rate-limit
|
|
122
129
|
#
|
|
123
130
|
# @param limit [Integer] Maximum number of results to return
|
|
@@ -142,7 +149,9 @@ module Cadenya
|
|
|
142
149
|
method: :get,
|
|
143
150
|
path: ["v1/workspaces/%1$s/memory_layers", workspace_id],
|
|
144
151
|
query: query.transform_keys(
|
|
152
|
+
agent_id: "agentId",
|
|
145
153
|
bundle_key: "bundleKey",
|
|
154
|
+
episodic_key_prefix: "episodicKeyPrefix",
|
|
146
155
|
include_info: "includeInfo",
|
|
147
156
|
sort_order: "sortOrder"
|
|
148
157
|
),
|
|
@@ -20,7 +20,7 @@ module Cadenya
|
|
|
20
20
|
#
|
|
21
21
|
# Creates a new objective in the workspace
|
|
22
22
|
#
|
|
23
|
-
# @overload create(workspace_id, agent_id:, data:, initial_message: nil,
|
|
23
|
+
# @overload create(workspace_id, agent_id:, data:, episodic_memory: nil, initial_message: nil, memory_cascade: nil, metadata: nil, secrets: nil, user_data: nil, variation_id: nil, request_options: {})
|
|
24
24
|
#
|
|
25
25
|
# @param workspace_id [String]
|
|
26
26
|
#
|
|
@@ -28,9 +28,11 @@ module Cadenya
|
|
|
28
28
|
#
|
|
29
29
|
# @param data [Hash{Symbol=>Object}] Arbitrary data for the objective. May be used in liquid templates for prompts co
|
|
30
30
|
#
|
|
31
|
+
# @param episodic_memory [Cadenya::Models::ObjectiveCreateParams::EpisodicMemory] Episodic is used to configure the episodic memory for the objective
|
|
32
|
+
#
|
|
31
33
|
# @param initial_message [String] Optional override for the initial message sent to the agent. This becomes the fi
|
|
32
34
|
#
|
|
33
|
-
# @param
|
|
35
|
+
# @param memory_cascade [Array<Cadenya::Models::MemoryReference>] Memory layers/entries layered over the baseline cascade inherited
|
|
34
36
|
#
|
|
35
37
|
# @param metadata [Cadenya::Models::CreateOperationMetadata] CreateOperationMetadata contains the user-provided fields for creating
|
|
36
38
|
#
|
data/lib/cadenya/version.rb
CHANGED
data/rbi/cadenya/client.rbi
CHANGED
|
@@ -32,8 +32,8 @@ module Cadenya
|
|
|
32
32
|
attr_reader :objectives
|
|
33
33
|
|
|
34
34
|
# Manage memory layers and their entries. Layers are named containers that can be
|
|
35
|
-
# composed into an objective's memory
|
|
36
|
-
# layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
35
|
+
# composed into an objective's memory cascade; entries are the keyed values within
|
|
36
|
+
# a layer. System-managed layers (e.g., episodic layers created by the runtime)
|
|
37
37
|
# cannot be mutated through this API.
|
|
38
38
|
sig { returns(Cadenya::Resources::MemoryLayers) }
|
|
39
39
|
attr_reader :memory_layers
|
|
@@ -18,6 +18,26 @@ module Cadenya
|
|
|
18
18
|
sig { params(description: String).void }
|
|
19
19
|
attr_writer :description
|
|
20
20
|
|
|
21
|
+
# Enable episodic memory for objectives created for this agent. When true,
|
|
22
|
+
# objective creation requires an episodic_memory key and the system finds or
|
|
23
|
+
# creates a memory layer for that (agent, key) pair, letting the agent store and
|
|
24
|
+
# retrieve memories across objectives that share the key. Memory is agent-level so
|
|
25
|
+
# all variations of the agent share the same layers.
|
|
26
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
27
|
+
attr_reader :enable_episodic_memory
|
|
28
|
+
|
|
29
|
+
sig { params(enable_episodic_memory: T::Boolean).void }
|
|
30
|
+
attr_writer :enable_episodic_memory
|
|
31
|
+
|
|
32
|
+
# How long episodic memories should be retained. Each new objective slides the
|
|
33
|
+
# layer's expiry forward by this duration, and stored entries expire this long
|
|
34
|
+
# after they are written. If not set, episodic memories are retained indefinitely.
|
|
35
|
+
sig { returns(T.nilable(Integer)) }
|
|
36
|
+
attr_reader :episodic_memory_ttl
|
|
37
|
+
|
|
38
|
+
sig { params(episodic_memory_ttl: Integer).void }
|
|
39
|
+
attr_writer :episodic_memory_ttl
|
|
40
|
+
|
|
21
41
|
# InputDataSchema is used for enforcing a data input when objectives are created.
|
|
22
42
|
# This is valuable when using liquid formatting in agent variation prompts. Input
|
|
23
43
|
# data schema is also valuable when using an agent as a sub-agent, as the schema
|
|
@@ -52,6 +72,8 @@ module Cadenya
|
|
|
52
72
|
variation_selection_mode:
|
|
53
73
|
Cadenya::AgentSpec::VariationSelectionMode::OrSymbol,
|
|
54
74
|
description: String,
|
|
75
|
+
enable_episodic_memory: T::Boolean,
|
|
76
|
+
episodic_memory_ttl: Integer,
|
|
55
77
|
input_data_schema: T::Hash[Symbol, T.anything],
|
|
56
78
|
output_definition: T::Hash[Symbol, T.anything],
|
|
57
79
|
webhook_events_url: String
|
|
@@ -63,6 +85,16 @@ module Cadenya
|
|
|
63
85
|
variation_selection_mode:,
|
|
64
86
|
# Description of the agent's purpose
|
|
65
87
|
description: nil,
|
|
88
|
+
# Enable episodic memory for objectives created for this agent. When true,
|
|
89
|
+
# objective creation requires an episodic_memory key and the system finds or
|
|
90
|
+
# creates a memory layer for that (agent, key) pair, letting the agent store and
|
|
91
|
+
# retrieve memories across objectives that share the key. Memory is agent-level so
|
|
92
|
+
# all variations of the agent share the same layers.
|
|
93
|
+
enable_episodic_memory: nil,
|
|
94
|
+
# How long episodic memories should be retained. Each new objective slides the
|
|
95
|
+
# layer's expiry forward by this duration, and stored entries expire this long
|
|
96
|
+
# after they are written. If not set, episodic memories are retained indefinitely.
|
|
97
|
+
episodic_memory_ttl: nil,
|
|
66
98
|
# InputDataSchema is used for enforcing a data input when objectives are created.
|
|
67
99
|
# This is valuable when using liquid formatting in agent variation prompts. Input
|
|
68
100
|
# data schema is also valuable when using an agent as a sub-agent, as the schema
|
|
@@ -85,6 +117,8 @@ module Cadenya
|
|
|
85
117
|
variation_selection_mode:
|
|
86
118
|
Cadenya::AgentSpec::VariationSelectionMode::OrSymbol,
|
|
87
119
|
description: String,
|
|
120
|
+
enable_episodic_memory: T::Boolean,
|
|
121
|
+
episodic_memory_ttl: Integer,
|
|
88
122
|
input_data_schema: T::Hash[Symbol, T.anything],
|
|
89
123
|
output_definition: T::Hash[Symbol, T.anything],
|
|
90
124
|
webhook_events_url: String
|
|
@@ -54,7 +54,8 @@ module Cadenya
|
|
|
54
54
|
attr_writer :assignments
|
|
55
55
|
|
|
56
56
|
# Read-only list of memory layer assignments for this variation, returned in
|
|
57
|
-
# ascending `position` (
|
|
57
|
+
# ascending `position` (most specific first — resolution order). Capped at 10
|
|
58
|
+
# entries.
|
|
58
59
|
sig do
|
|
59
60
|
returns(
|
|
60
61
|
T.nilable(T::Array[Cadenya::Agents::VariationMemoryLayerAssignment])
|
|
@@ -133,7 +134,8 @@ module Cadenya
|
|
|
133
134
|
# Total number of objective feedbacks received for this variation
|
|
134
135
|
feedback_count: nil,
|
|
135
136
|
# Read-only list of memory layer assignments for this variation, returned in
|
|
136
|
-
# ascending `position` (
|
|
137
|
+
# ascending `position` (most specific first — resolution order). Capped at 10
|
|
138
|
+
# entries.
|
|
137
139
|
memory_layer_assignments: nil,
|
|
138
140
|
# Count of memory layer assignments.
|
|
139
141
|
memory_layer_count: nil,
|
|
@@ -51,25 +51,6 @@ module Cadenya
|
|
|
51
51
|
sig { params(description: String).void }
|
|
52
52
|
attr_writer :description
|
|
53
53
|
|
|
54
|
-
# Enable episodic memory for objectives using this variation. When true, the
|
|
55
|
-
# system automatically creates a document namespace for each objective using the
|
|
56
|
-
# objective's episodic_key as the external_id, allowing the agent to store and
|
|
57
|
-
# retrieve documents specific to that episode.
|
|
58
|
-
sig { returns(T.nilable(T::Boolean)) }
|
|
59
|
-
attr_reader :enable_episodic_memory
|
|
60
|
-
|
|
61
|
-
sig { params(enable_episodic_memory: T::Boolean).void }
|
|
62
|
-
attr_writer :enable_episodic_memory
|
|
63
|
-
|
|
64
|
-
# How long episodic memories should be retained. After this duration, episodic
|
|
65
|
-
# document namespaces can be automatically cleaned up. If not set, episodic
|
|
66
|
-
# memories are retained indefinitely.
|
|
67
|
-
sig { returns(T.nilable(Integer)) }
|
|
68
|
-
attr_reader :episodic_memory_ttl
|
|
69
|
-
|
|
70
|
-
sig { params(episodic_memory_ttl: Integer).void }
|
|
71
|
-
attr_writer :episodic_memory_ttl
|
|
72
|
-
|
|
73
54
|
# ModelConfig defines the model configuration for a variation
|
|
74
55
|
sig do
|
|
75
56
|
returns(T.nilable(Cadenya::Agents::AgentVariationSpecModelConfig))
|
|
@@ -139,8 +120,6 @@ module Cadenya
|
|
|
139
120
|
Cadenya::Agents::AgentVariationSpecCompactionConfig::OrHash,
|
|
140
121
|
constraints: Cadenya::Agents::AgentVariationSpecConstraints::OrHash,
|
|
141
122
|
description: String,
|
|
142
|
-
enable_episodic_memory: T::Boolean,
|
|
143
|
-
episodic_memory_ttl: Integer,
|
|
144
123
|
model_config:
|
|
145
124
|
Cadenya::Agents::AgentVariationSpecModelConfig::OrHash,
|
|
146
125
|
progressive_discovery:
|
|
@@ -158,15 +137,6 @@ module Cadenya
|
|
|
158
137
|
constraints: nil,
|
|
159
138
|
# Human-readable description of what this variation does or when it should be used
|
|
160
139
|
description: nil,
|
|
161
|
-
# Enable episodic memory for objectives using this variation. When true, the
|
|
162
|
-
# system automatically creates a document namespace for each objective using the
|
|
163
|
-
# objective's episodic_key as the external_id, allowing the agent to store and
|
|
164
|
-
# retrieve documents specific to that episode.
|
|
165
|
-
enable_episodic_memory: nil,
|
|
166
|
-
# How long episodic memories should be retained. After this duration, episodic
|
|
167
|
-
# document namespaces can be automatically cleaned up. If not set, episodic
|
|
168
|
-
# memories are retained indefinitely.
|
|
169
|
-
episodic_memory_ttl: nil,
|
|
170
140
|
# ModelConfig defines the model configuration for a variation
|
|
171
141
|
model_config: nil,
|
|
172
142
|
# ProgressiveDiscovery is used to indicate that the agent should automatically
|
|
@@ -199,8 +169,6 @@ module Cadenya
|
|
|
199
169
|
Cadenya::Agents::AgentVariationSpecCompactionConfig,
|
|
200
170
|
constraints: Cadenya::Agents::AgentVariationSpecConstraints,
|
|
201
171
|
description: String,
|
|
202
|
-
enable_episodic_memory: T::Boolean,
|
|
203
|
-
episodic_memory_ttl: Integer,
|
|
204
172
|
model_config: Cadenya::Agents::AgentVariationSpecModelConfig,
|
|
205
173
|
progressive_discovery:
|
|
206
174
|
Cadenya::Agents::AgentVariationSpecProgressiveDiscovery,
|
|
@@ -32,7 +32,8 @@ module Cadenya
|
|
|
32
32
|
sig { params(memory_layer_id: String).void }
|
|
33
33
|
attr_writer :memory_layer_id
|
|
34
34
|
|
|
35
|
-
# Position in the
|
|
35
|
+
# Position in the baseline cascade (lower = more specific). If omitted, the server
|
|
36
|
+
# appends at the most general end (max existing position + 1).
|
|
36
37
|
sig { returns(T.nilable(Integer)) }
|
|
37
38
|
attr_reader :position
|
|
38
39
|
|
|
@@ -56,7 +57,8 @@ module Cadenya
|
|
|
56
57
|
# Layer to attach. Accepts the canonical `memlyr_…` form or the
|
|
57
58
|
# `external_id:<value>` form.
|
|
58
59
|
memory_layer_id: nil,
|
|
59
|
-
# Position in the
|
|
60
|
+
# Position in the baseline cascade (lower = more specific). If omitted, the server
|
|
61
|
+
# appends at the most general end (max existing position + 1).
|
|
60
62
|
position: nil,
|
|
61
63
|
request_options: {}
|
|
62
64
|
)
|
|
@@ -24,9 +24,10 @@ module Cadenya
|
|
|
24
24
|
sig { params(memory_layer: Cadenya::BareMetadata::OrHash).void }
|
|
25
25
|
attr_writer :memory_layer
|
|
26
26
|
|
|
27
|
-
# Position in the variation's baseline
|
|
28
|
-
#
|
|
29
|
-
#
|
|
27
|
+
# Position in the variation's baseline cascade. Position is specificity,
|
|
28
|
+
# CSS-style: a LOWER position is more specific and is consulted first; the
|
|
29
|
+
# highest-position assignment is the most general fallback. Gaps are fine — only
|
|
30
|
+
# relative position matters. Positions must be unique within a variation; a
|
|
30
31
|
# request that would collide with an existing assignment's position is rejected
|
|
31
32
|
# with InvalidArgument.
|
|
32
33
|
sig { returns(T.nilable(Integer)) }
|
|
@@ -44,8 +45,8 @@ module Cadenya
|
|
|
44
45
|
attr_writer :id
|
|
45
46
|
|
|
46
47
|
# VariationMemoryLayerAssignment attaches a single MemoryLayer to a variation at a
|
|
47
|
-
# given position in the variation's baseline memory
|
|
48
|
-
# one assignment per memory_layer_id.
|
|
48
|
+
# given position in the variation's baseline memory cascade. A variation has at
|
|
49
|
+
# most one assignment per memory_layer_id.
|
|
49
50
|
#
|
|
50
51
|
# Variations only support whole-layer attachments — entry pinning is an
|
|
51
52
|
# objective-level capability.
|
|
@@ -67,9 +68,10 @@ module Cadenya
|
|
|
67
68
|
# to an objective. Both fields are server-populated; clients provide IDs through
|
|
68
69
|
# sibling fields rather than by constructing a BareMetadata themselves.
|
|
69
70
|
memory_layer: nil,
|
|
70
|
-
# Position in the variation's baseline
|
|
71
|
-
#
|
|
72
|
-
#
|
|
71
|
+
# Position in the variation's baseline cascade. Position is specificity,
|
|
72
|
+
# CSS-style: a LOWER position is more specific and is consulted first; the
|
|
73
|
+
# highest-position assignment is the most general fallback. Gaps are fine — only
|
|
74
|
+
# relative position matters. Positions must be unique within a variation; a
|
|
73
75
|
# request that would collide with an existing assignment's position is rejected
|
|
74
76
|
# with InvalidArgument.
|
|
75
77
|
position: nil
|
|
@@ -61,8 +61,8 @@ module Cadenya
|
|
|
61
61
|
# MemoryEntry is a single keyed value within a MemoryLayer. Entries are addressed
|
|
62
62
|
# by their key, which follows the S3 object key safe-character convention (see
|
|
63
63
|
# MemoryEntrySpec.key for the full rule). Keys are unique within a single layer;
|
|
64
|
-
# the same key may appear in multiple layers, in which case the
|
|
65
|
-
# determines which one wins for a given objective.
|
|
64
|
+
# the same key may appear in multiple layers, in which case the cascade walk
|
|
65
|
+
# determines which one wins for a given objective (most specific layer first).
|
|
66
66
|
#
|
|
67
67
|
# MemoryEntry is the summary shape, returned by ListMemoryEntries. It does not
|
|
68
68
|
# carry the entry body — callers that need the body must fetch the entry
|
|
@@ -98,8 +98,8 @@ module Cadenya
|
|
|
98
98
|
# MemoryEntry is a single keyed value within a MemoryLayer. Entries are addressed
|
|
99
99
|
# by their key, which follows the S3 object key safe-character convention (see
|
|
100
100
|
# MemoryEntrySpec.key for the full rule). Keys are unique within a single layer;
|
|
101
|
-
# the same key may appear in multiple layers, in which case the
|
|
102
|
-
# determines which one wins for a given objective.
|
|
101
|
+
# the same key may appear in multiple layers, in which case the cascade walk
|
|
102
|
+
# determines which one wins for a given objective (most specific layer first).
|
|
103
103
|
#
|
|
104
104
|
# MemoryEntry is the summary shape, returned by ListMemoryEntries. It does not
|
|
105
105
|
# carry the entry body — callers that need the body must fetch the entry
|
|
@@ -59,11 +59,11 @@ module Cadenya
|
|
|
59
59
|
attr_writer :external_id
|
|
60
60
|
|
|
61
61
|
# MemoryLayer is a named container of memory entries that can be composed into an
|
|
62
|
-
# objective's memory
|
|
63
|
-
# controls how its entries participate in the agent loop — see
|
|
64
|
-
# details.
|
|
62
|
+
# objective's memory cascade. Layers are workspace-scoped resources. The layer
|
|
63
|
+
# type controls how its entries participate in the agent loop — see
|
|
64
|
+
# MemoryLayerType for details.
|
|
65
65
|
#
|
|
66
|
-
# See "Memory
|
|
66
|
+
# See "Memory cascade composition" above for how layers compose at lookup time.
|
|
67
67
|
sig { returns(T.nilable(Cadenya::MemoryLayer)) }
|
|
68
68
|
attr_reader :resource
|
|
69
69
|
|
|
@@ -91,11 +91,11 @@ module Cadenya
|
|
|
91
91
|
error: nil,
|
|
92
92
|
external_id: nil,
|
|
93
93
|
# MemoryLayer is a named container of memory entries that can be composed into an
|
|
94
|
-
# objective's memory
|
|
95
|
-
# controls how its entries participate in the agent loop — see
|
|
96
|
-
# details.
|
|
94
|
+
# objective's memory cascade. Layers are workspace-scoped resources. The layer
|
|
95
|
+
# type controls how its entries participate in the agent loop — see
|
|
96
|
+
# MemoryLayerType for details.
|
|
97
97
|
#
|
|
98
|
-
# See "Memory
|
|
98
|
+
# See "Memory cascade composition" above for how layers compose at lookup time.
|
|
99
99
|
resource: nil
|
|
100
100
|
)
|
|
101
101
|
end
|
|
@@ -53,8 +53,8 @@ module Cadenya
|
|
|
53
53
|
attr_writer :error
|
|
54
54
|
|
|
55
55
|
# VariationMemoryLayerAssignment attaches a single MemoryLayer to a variation at a
|
|
56
|
-
# given position in the variation's baseline memory
|
|
57
|
-
# one assignment per memory_layer_id.
|
|
56
|
+
# given position in the variation's baseline memory cascade. A variation has at
|
|
57
|
+
# most one assignment per memory_layer_id.
|
|
58
58
|
#
|
|
59
59
|
# Variations only support whole-layer attachments — entry pinning is an
|
|
60
60
|
# objective-level capability.
|
|
@@ -89,8 +89,8 @@ module Cadenya
|
|
|
89
89
|
# [API Design Guide](https://cloud.google.com/apis/design/errors).
|
|
90
90
|
error: nil,
|
|
91
91
|
# VariationMemoryLayerAssignment attaches a single MemoryLayer to a variation at a
|
|
92
|
-
# given position in the variation's baseline memory
|
|
93
|
-
# one assignment per memory_layer_id.
|
|
92
|
+
# given position in the variation's baseline memory cascade. A variation has at
|
|
93
|
+
# most one assignment per memory_layer_id.
|
|
94
94
|
#
|
|
95
95
|
# Variations only support whole-layer attachments — entry pinning is an
|
|
96
96
|
# objective-level capability.
|
|
@@ -26,11 +26,11 @@ module Cadenya
|
|
|
26
26
|
attr_writer :info
|
|
27
27
|
|
|
28
28
|
# MemoryLayer is a named container of memory entries that can be composed into an
|
|
29
|
-
# objective's memory
|
|
30
|
-
# controls how its entries participate in the agent loop — see
|
|
31
|
-
# details.
|
|
29
|
+
# objective's memory cascade. Layers are workspace-scoped resources. The layer
|
|
30
|
+
# type controls how its entries participate in the agent loop — see
|
|
31
|
+
# MemoryLayerType for details.
|
|
32
32
|
#
|
|
33
|
-
# See "Memory
|
|
33
|
+
# See "Memory cascade composition" above for how layers compose at lookup time.
|
|
34
34
|
sig do
|
|
35
35
|
params(
|
|
36
36
|
metadata: Cadenya::ResourceMetadata::OrHash,
|
|
@@ -14,6 +14,13 @@ module Cadenya
|
|
|
14
14
|
sig { returns(String) }
|
|
15
15
|
attr_accessor :workspace_id
|
|
16
16
|
|
|
17
|
+
# Filter to episodic layers belonging to this agent.
|
|
18
|
+
sig { returns(T.nilable(String)) }
|
|
19
|
+
attr_reader :agent_id
|
|
20
|
+
|
|
21
|
+
sig { params(agent_id: String).void }
|
|
22
|
+
attr_writer :agent_id
|
|
23
|
+
|
|
17
24
|
# Filter by bundle_key — return only resources owned by this bundle.
|
|
18
25
|
sig { returns(T.nilable(String)) }
|
|
19
26
|
attr_reader :bundle_key
|
|
@@ -28,6 +35,15 @@ module Cadenya
|
|
|
28
35
|
sig { params(cursor: String).void }
|
|
29
36
|
attr_writer :cursor
|
|
30
37
|
|
|
38
|
+
# Filter to episodic layers whose episodic key starts with this prefix (e.g.
|
|
39
|
+
# "customer/" matches "customer/42" and "customer/43"). Useful for namespaced
|
|
40
|
+
# keys, similar to a redis key scan.
|
|
41
|
+
sig { returns(T.nilable(String)) }
|
|
42
|
+
attr_reader :episodic_key_prefix
|
|
43
|
+
|
|
44
|
+
sig { params(episodic_key_prefix: String).void }
|
|
45
|
+
attr_writer :episodic_key_prefix
|
|
46
|
+
|
|
31
47
|
# When set to true you may use more of your alloted API rate-limit
|
|
32
48
|
sig { returns(T.nilable(T::Boolean)) }
|
|
33
49
|
attr_reader :include_info
|
|
@@ -73,8 +89,10 @@ module Cadenya
|
|
|
73
89
|
sig do
|
|
74
90
|
params(
|
|
75
91
|
workspace_id: String,
|
|
92
|
+
agent_id: String,
|
|
76
93
|
bundle_key: String,
|
|
77
94
|
cursor: String,
|
|
95
|
+
episodic_key_prefix: String,
|
|
78
96
|
include_info: T::Boolean,
|
|
79
97
|
limit: Integer,
|
|
80
98
|
prefix: String,
|
|
@@ -86,10 +104,16 @@ module Cadenya
|
|
|
86
104
|
end
|
|
87
105
|
def self.new(
|
|
88
106
|
workspace_id:,
|
|
107
|
+
# Filter to episodic layers belonging to this agent.
|
|
108
|
+
agent_id: nil,
|
|
89
109
|
# Filter by bundle_key — return only resources owned by this bundle.
|
|
90
110
|
bundle_key: nil,
|
|
91
111
|
# Pagination cursor from previous response
|
|
92
112
|
cursor: nil,
|
|
113
|
+
# Filter to episodic layers whose episodic key starts with this prefix (e.g.
|
|
114
|
+
# "customer/" matches "customer/42" and "customer/43"). Useful for namespaced
|
|
115
|
+
# keys, similar to a redis key scan.
|
|
116
|
+
episodic_key_prefix: nil,
|
|
93
117
|
# When set to true you may use more of your alloted API rate-limit
|
|
94
118
|
include_info: nil,
|
|
95
119
|
# Maximum number of results to return
|
|
@@ -110,8 +134,10 @@ module Cadenya
|
|
|
110
134
|
override.returns(
|
|
111
135
|
{
|
|
112
136
|
workspace_id: String,
|
|
137
|
+
agent_id: String,
|
|
113
138
|
bundle_key: String,
|
|
114
139
|
cursor: String,
|
|
140
|
+
episodic_key_prefix: String,
|
|
115
141
|
include_info: T::Boolean,
|
|
116
142
|
limit: Integer,
|
|
117
143
|
prefix: String,
|
|
@@ -19,6 +19,22 @@ module Cadenya
|
|
|
19
19
|
sig { params(description: String).void }
|
|
20
20
|
attr_writer :description
|
|
21
21
|
|
|
22
|
+
# Server-set on episodic layers: the agent this layer belongs to. Unset for
|
|
23
|
+
# non-episodic layers.
|
|
24
|
+
sig { returns(T.nilable(String)) }
|
|
25
|
+
attr_reader :agent_id
|
|
26
|
+
|
|
27
|
+
sig { params(agent_id: String).void }
|
|
28
|
+
attr_writer :agent_id
|
|
29
|
+
|
|
30
|
+
# Server-set on episodic layers: the caller-supplied episodic key the layer was
|
|
31
|
+
# created for. Unset for non-episodic layers.
|
|
32
|
+
sig { returns(T.nilable(String)) }
|
|
33
|
+
attr_reader :episodic_key
|
|
34
|
+
|
|
35
|
+
sig { params(episodic_key: String).void }
|
|
36
|
+
attr_writer :episodic_key
|
|
37
|
+
|
|
22
38
|
# For layers with a finite lifetime (e.g., episodic), the time at which the layer
|
|
23
39
|
# becomes eligible for cleanup. Set by the system; unset for persistent layers.
|
|
24
40
|
sig { returns(T.nilable(Time)) }
|
|
@@ -29,7 +45,7 @@ module Cadenya
|
|
|
29
45
|
|
|
30
46
|
# Server-set. True for layers managed by the system (e.g., episodic layers created
|
|
31
47
|
# automatically when an objective uses an episodic_key). System-managed layers
|
|
32
|
-
# cannot be assigned to objective
|
|
48
|
+
# cannot be assigned to objective cascades via the API and cannot be mutated by
|
|
33
49
|
# clients — their lifecycle is controlled entirely by the runtime.
|
|
34
50
|
sig { returns(T.nilable(T::Boolean)) }
|
|
35
51
|
attr_reader :system_managed
|
|
@@ -40,22 +56,30 @@ module Cadenya
|
|
|
40
56
|
sig do
|
|
41
57
|
params(
|
|
42
58
|
type: Cadenya::MemoryLayerSpec::Type::OrSymbol,
|
|
59
|
+
agent_id: String,
|
|
43
60
|
description: String,
|
|
61
|
+
episodic_key: String,
|
|
44
62
|
expires_at: Time,
|
|
45
63
|
system_managed: T::Boolean
|
|
46
64
|
).returns(T.attached_class)
|
|
47
65
|
end
|
|
48
66
|
def self.new(
|
|
49
67
|
type:,
|
|
68
|
+
# Server-set on episodic layers: the agent this layer belongs to. Unset for
|
|
69
|
+
# non-episodic layers.
|
|
70
|
+
agent_id: nil,
|
|
50
71
|
# Human-readable description of the layer's purpose. Encouraged for user-created
|
|
51
72
|
# layers; system-managed layers may have a generated description.
|
|
52
73
|
description: nil,
|
|
74
|
+
# Server-set on episodic layers: the caller-supplied episodic key the layer was
|
|
75
|
+
# created for. Unset for non-episodic layers.
|
|
76
|
+
episodic_key: nil,
|
|
53
77
|
# For layers with a finite lifetime (e.g., episodic), the time at which the layer
|
|
54
78
|
# becomes eligible for cleanup. Set by the system; unset for persistent layers.
|
|
55
79
|
expires_at: nil,
|
|
56
80
|
# Server-set. True for layers managed by the system (e.g., episodic layers created
|
|
57
81
|
# automatically when an objective uses an episodic_key). System-managed layers
|
|
58
|
-
# cannot be assigned to objective
|
|
82
|
+
# cannot be assigned to objective cascades via the API and cannot be mutated by
|
|
59
83
|
# clients — their lifecycle is controlled entirely by the runtime.
|
|
60
84
|
system_managed: nil
|
|
61
85
|
)
|
|
@@ -65,7 +89,9 @@ module Cadenya
|
|
|
65
89
|
override.returns(
|
|
66
90
|
{
|
|
67
91
|
type: Cadenya::MemoryLayerSpec::Type::OrSymbol,
|
|
92
|
+
agent_id: String,
|
|
68
93
|
description: String,
|
|
94
|
+
episodic_key: String,
|
|
69
95
|
expires_at: Time,
|
|
70
96
|
system_managed: T::Boolean
|
|
71
97
|
}
|
|
@@ -41,8 +41,8 @@ module Cadenya
|
|
|
41
41
|
# MemoryEntry is a single keyed value within a MemoryLayer. Entries are addressed
|
|
42
42
|
# by their key, which follows the S3 object key safe-character convention (see
|
|
43
43
|
# MemoryEntrySpec.key for the full rule). Keys are unique within a single layer;
|
|
44
|
-
# the same key may appear in multiple layers, in which case the
|
|
45
|
-
# determines which one wins for a given objective.
|
|
44
|
+
# the same key may appear in multiple layers, in which case the cascade walk
|
|
45
|
+
# determines which one wins for a given objective (most specific layer first).
|
|
46
46
|
#
|
|
47
47
|
# MemoryEntry is the summary shape, returned by ListMemoryEntries. It does not
|
|
48
48
|
# carry the entry body — callers that need the body must fetch the entry
|