cadenya 0.11.0 → 0.13.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/models/agent_spec.rb +23 -1
  5. data/lib/cadenya/models/agents/agent_variation_spec.rb +1 -22
  6. data/lib/cadenya/models/memory_layer_list_params.rb +22 -1
  7. data/lib/cadenya/models/memory_layer_spec.rb +19 -1
  8. data/lib/cadenya/models/objective.rb +38 -1
  9. data/lib/cadenya/models/objective_create_params.rb +28 -1
  10. data/lib/cadenya/models/objectives/objective_tool_call_data.rb +1 -9
  11. data/lib/cadenya/models/objectives/objective_tool_call_result.rb +27 -0
  12. data/lib/cadenya/models/objectives/objective_tool_call_result_audio_block.rb +46 -0
  13. data/lib/cadenya/models/objectives/objective_tool_call_result_content_block.rb +34 -0
  14. data/lib/cadenya/models/objectives/objective_tool_call_result_image_block.rb +46 -0
  15. data/lib/cadenya/models/objectives/objective_tool_call_result_text_block.rb +21 -0
  16. data/lib/cadenya/models/objectives/objective_tool_call_with_result.rb +102 -0
  17. data/lib/cadenya/models/objectives/tool_call_retrieve_params.rb +34 -0
  18. data/lib/cadenya/models/tool_result.rb +15 -7
  19. data/lib/cadenya/resources/memory_layers.rb +10 -1
  20. data/lib/cadenya/resources/objectives/tool_calls.rb +39 -0
  21. data/lib/cadenya/resources/objectives.rb +3 -1
  22. data/lib/cadenya/version.rb +1 -1
  23. data/lib/cadenya.rb +7 -0
  24. data/rbi/cadenya/models/agent_spec.rbi +34 -0
  25. data/rbi/cadenya/models/agents/agent_variation_spec.rbi +0 -32
  26. data/rbi/cadenya/models/memory_layer_list_params.rbi +26 -0
  27. data/rbi/cadenya/models/memory_layer_spec.rbi +26 -0
  28. data/rbi/cadenya/models/objective.rbi +57 -0
  29. data/rbi/cadenya/models/objective_create_params.rbi +48 -0
  30. data/rbi/cadenya/models/objectives/objective_tool_call_data.rbi +0 -11
  31. data/rbi/cadenya/models/objectives/objective_tool_call_result.rbi +54 -0
  32. data/rbi/cadenya/models/objectives/objective_tool_call_result_audio_block.rbi +69 -0
  33. data/rbi/cadenya/models/objectives/objective_tool_call_result_content_block.rbi +90 -0
  34. data/rbi/cadenya/models/objectives/objective_tool_call_result_image_block.rbi +69 -0
  35. data/rbi/cadenya/models/objectives/objective_tool_call_result_text_block.rbi +31 -0
  36. data/rbi/cadenya/models/objectives/objective_tool_call_with_result.rbi +219 -0
  37. data/rbi/cadenya/models/objectives/tool_call_retrieve_params.rbi +58 -0
  38. data/rbi/cadenya/models/tool_result.rbi +34 -12
  39. data/rbi/cadenya/resources/memory_layers.rbi +8 -0
  40. data/rbi/cadenya/resources/objectives/tool_calls.rbi +20 -0
  41. data/rbi/cadenya/resources/objectives.rbi +4 -0
  42. data/sig/cadenya/models/agent_spec.rbs +14 -0
  43. data/sig/cadenya/models/agents/agent_variation_spec.rbs +0 -14
  44. data/sig/cadenya/models/memory_layer_list_params.rbs +14 -0
  45. data/sig/cadenya/models/memory_layer_spec.rbs +14 -0
  46. data/sig/cadenya/models/objective.rbs +25 -0
  47. data/sig/cadenya/models/objective_create_params.rbs +21 -0
  48. data/sig/cadenya/models/objectives/objective_tool_call_data.rbs +0 -7
  49. data/sig/cadenya/models/objectives/objective_tool_call_result.rbs +24 -0
  50. data/sig/cadenya/models/objectives/objective_tool_call_result_audio_block.rbs +34 -0
  51. data/sig/cadenya/models/objectives/objective_tool_call_result_content_block.rbs +46 -0
  52. data/sig/cadenya/models/objectives/objective_tool_call_result_image_block.rbs +34 -0
  53. data/sig/cadenya/models/objectives/objective_tool_call_result_text_block.rbs +17 -0
  54. data/sig/cadenya/models/objectives/objective_tool_call_with_result.rbs +91 -0
  55. data/sig/cadenya/models/objectives/tool_call_retrieve_params.rbs +34 -0
  56. data/sig/cadenya/models/tool_result.rbs +15 -9
  57. data/sig/cadenya/resources/memory_layers.rbs +2 -0
  58. data/sig/cadenya/resources/objectives/tool_calls.rbs +7 -0
  59. data/sig/cadenya/resources/objectives.rbs +1 -0
  60. metadata +23 -2
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ module Objectives
6
+ # @see Cadenya::Resources::Objectives::ToolCalls#retrieve
7
+ class ToolCallRetrieveParams < Cadenya::Internal::Type::BaseModel
8
+ extend Cadenya::Internal::Type::RequestParameters::Converter
9
+ include Cadenya::Internal::Type::RequestParameters
10
+
11
+ # @!attribute workspace_id
12
+ #
13
+ # @return [String]
14
+ required :workspace_id, String
15
+
16
+ # @!attribute objective_id
17
+ #
18
+ # @return [String]
19
+ required :objective_id, String
20
+
21
+ # @!attribute tool_call_id
22
+ #
23
+ # @return [String]
24
+ required :tool_call_id, String
25
+
26
+ # @!method initialize(workspace_id:, objective_id:, tool_call_id:, request_options: {})
27
+ # @param workspace_id [String]
28
+ # @param objective_id [String]
29
+ # @param tool_call_id [String]
30
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -3,18 +3,26 @@
3
3
  module Cadenya
4
4
  module Models
5
5
  class ToolResult < Cadenya::Internal::Type::BaseModel
6
- # @!attribute content
6
+ # @!attribute result
7
+ # ObjectiveToolCallResult is the content a tool returned after execution. Tools
8
+ # can return multiple content blocks, and blocks can be multi-modal (text, image,
9
+ # audio). Media blocks are stored by Cadenya and served as short-lived signed URLs
10
+ # rather than inline bytes.
7
11
  #
8
- # @return [String, nil]
9
- optional :content, String
12
+ # @return [Cadenya::Models::Objectives::ObjectiveToolCallResult]
13
+ required :result, -> { Cadenya::Objectives::ObjectiveToolCallResult }
10
14
 
11
15
  # @!attribute tool_call_id
12
16
  #
13
- # @return [String, nil]
14
- optional :tool_call_id, String, api_name: :toolCallId
17
+ # @return [String]
18
+ required :tool_call_id, String, api_name: :toolCallId
15
19
 
16
- # @!method initialize(content: nil, tool_call_id: nil)
17
- # @param content [String]
20
+ # @!method initialize(result:, tool_call_id:)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Cadenya::Models::ToolResult} for more details.
23
+ #
24
+ # @param result [Cadenya::Models::Objectives::ObjectiveToolCallResult] ObjectiveToolCallResult is the content a tool returned after execution.
25
+ #
18
26
  # @param tool_call_id [String]
19
27
  end
20
28
  end
@@ -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
  ),
@@ -4,6 +4,45 @@ module Cadenya
4
4
  module Resources
5
5
  class Objectives
6
6
  class ToolCalls
7
+ # Retrieves a single tool call, including the content the tool returned. Media
8
+ # content (images, audio) is served as short-lived signed URLs.
9
+ #
10
+ # @overload retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {})
11
+ #
12
+ # @param tool_call_id [String] The ID of the tool call to retrieve
13
+ #
14
+ # @param workspace_id [String]
15
+ #
16
+ # @param objective_id [String] The ID of the objective. Supports "external_id:" prefix for external IDs.
17
+ #
18
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
19
+ #
20
+ # @return [Cadenya::Models::Objectives::ObjectiveToolCallWithResult]
21
+ #
22
+ # @see Cadenya::Models::Objectives::ToolCallRetrieveParams
23
+ def retrieve(tool_call_id, params)
24
+ parsed, options = Cadenya::Objectives::ToolCallRetrieveParams.dump_request(params)
25
+ workspace_id =
26
+ parsed.delete(:workspace_id) do
27
+ raise ArgumentError.new("missing required path argument #{_1}")
28
+ end
29
+ objective_id =
30
+ parsed.delete(:objective_id) do
31
+ raise ArgumentError.new("missing required path argument #{_1}")
32
+ end
33
+ @client.request(
34
+ method: :get,
35
+ path: [
36
+ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s",
37
+ workspace_id,
38
+ objective_id,
39
+ tool_call_id
40
+ ],
41
+ model: Cadenya::Objectives::ObjectiveToolCallWithResult,
42
+ options: options
43
+ )
44
+ end
45
+
7
46
  # Lists all tool calls for an objective
8
47
  #
9
48
  # @overload list(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, status: nil, request_options: {})
@@ -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, memory_stack: nil, metadata: nil, secrets: nil, user_data: nil, variation_id: nil, request_options: {})
23
+ # @overload create(workspace_id, agent_id:, data:, episodic_memory: nil, initial_message: nil, memory_stack: nil, metadata: nil, secrets: nil, user_data: nil, variation_id: nil, request_options: {})
24
24
  #
25
25
  # @param workspace_id [String]
26
26
  #
@@ -28,6 +28,8 @@ 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
35
  # @param memory_stack [Array<Cadenya::Models::MemoryReference>] Memory layers/entries to push onto this objective's memory stack on
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.11.0"
4
+ VERSION = "0.13.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -224,11 +224,18 @@ require_relative "cadenya/models/objectives/objective_tool"
224
224
  require_relative "cadenya/models/objectives/objective_tool_call"
225
225
  require_relative "cadenya/models/objectives/objective_tool_call_data"
226
226
  require_relative "cadenya/models/objectives/objective_tool_call_info"
227
+ require_relative "cadenya/models/objectives/objective_tool_call_result"
228
+ require_relative "cadenya/models/objectives/objective_tool_call_result_audio_block"
229
+ require_relative "cadenya/models/objectives/objective_tool_call_result_content_block"
230
+ require_relative "cadenya/models/objectives/objective_tool_call_result_image_block"
231
+ require_relative "cadenya/models/objectives/objective_tool_call_result_text_block"
232
+ require_relative "cadenya/models/objectives/objective_tool_call_with_result"
227
233
  require_relative "cadenya/models/objectives/task_list_params"
228
234
  require_relative "cadenya/models/objectives/task_retrieve_params"
229
235
  require_relative "cadenya/models/objectives/tool_call_approve_params"
230
236
  require_relative "cadenya/models/objectives/tool_call_deny_params"
231
237
  require_relative "cadenya/models/objectives/tool_call_list_params"
238
+ require_relative "cadenya/models/objectives/tool_call_retrieve_params"
232
239
  require_relative "cadenya/models/objectives/tool_list_params"
233
240
  require_relative "cadenya/models/objective_secret"
234
241
  require_relative "cadenya/models/operation_metadata"
@@ -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
@@ -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,
@@ -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)) }
@@ -40,16 +56,24 @@ 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,
@@ -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
  }
@@ -19,6 +19,15 @@ module Cadenya
19
19
  sig { params(metadata: Cadenya::OperationMetadata::OrHash).void }
20
20
  attr_writer :metadata
21
21
 
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
+
22
31
  # Memory layers/entries to push onto this objective's memory stack on top of the
23
32
  # baseline stack inherited from the selected variation.
24
33
  #
@@ -125,6 +134,7 @@ module Cadenya
125
134
  state: Cadenya::Objective::State::OrSymbol,
126
135
  system_prompt: String,
127
136
  data: T::Hash[Symbol, T.anything],
137
+ episodic_memory: Cadenya::Objective::EpisodicMemory::OrHash,
128
138
  info: Cadenya::ObjectiveInfo::OrHash,
129
139
  memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
130
140
  output: T::Hash[Symbol, T.anything],
@@ -150,6 +160,8 @@ module Cadenya
150
160
  system_prompt:,
151
161
  # Arbitrary data for the objective
152
162
  data: nil,
163
+ # Episodic is used to configure the episodic memory for the objective
164
+ episodic_memory: nil,
153
165
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
154
166
  # execution
155
167
  info: nil,
@@ -195,6 +207,7 @@ module Cadenya
195
207
  state: Cadenya::Objective::State::TaggedSymbol,
196
208
  system_prompt: String,
197
209
  data: T::Hash[Symbol, T.anything],
210
+ episodic_memory: Cadenya::Objective::EpisodicMemory,
198
211
  info: Cadenya::ObjectiveInfo,
199
212
  memory_stack: T::Array[Cadenya::MemoryReference],
200
213
  output: T::Hash[Symbol, T.anything],
@@ -236,6 +249,50 @@ module Cadenya
236
249
  def self.values
237
250
  end
238
251
  end
252
+
253
+ class EpisodicMemory < Cadenya::Internal::Type::BaseModel
254
+ OrHash =
255
+ T.type_alias do
256
+ T.any(
257
+ Cadenya::Objective::EpisodicMemory,
258
+ Cadenya::Internal::AnyHash
259
+ )
260
+ end
261
+
262
+ # The caller-supplied episodic key. Objectives created with the same key (for the
263
+ # same agent) share one episodic memory layer.
264
+ sig { returns(T.nilable(String)) }
265
+ attr_reader :key
266
+
267
+ sig { params(key: String).void }
268
+ attr_writer :key
269
+
270
+ # The episodic memory layer resolved (created or reused) for this objective's key.
271
+ # Populated by the system at objective creation.
272
+ sig { returns(T.nilable(String)) }
273
+ attr_reader :memory_layer_id
274
+
275
+ sig { params(memory_layer_id: String).void }
276
+ attr_writer :memory_layer_id
277
+
278
+ # Episodic is used to configure the episodic memory for the objective
279
+ sig do
280
+ params(key: String, memory_layer_id: String).returns(T.attached_class)
281
+ end
282
+ def self.new(
283
+ # The caller-supplied episodic key. Objectives created with the same key (for the
284
+ # same agent) share one episodic memory layer.
285
+ key: nil,
286
+ # The episodic memory layer resolved (created or reused) for this objective's key.
287
+ # Populated by the system at objective creation.
288
+ memory_layer_id: nil
289
+ )
290
+ end
291
+
292
+ sig { override.returns({ key: String, memory_layer_id: String }) }
293
+ def to_hash
294
+ end
295
+ end
239
296
  end
240
297
  end
241
298
  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
@@ -101,6 +113,8 @@ module Cadenya
101
113
  workspace_id: String,
102
114
  agent_id: String,
103
115
  data: T::Hash[Symbol, T.anything],
116
+ episodic_memory:
117
+ Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash,
104
118
  initial_message: String,
105
119
  memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
106
120
  metadata: Cadenya::CreateOperationMetadata::OrHash,
@@ -116,6 +130,8 @@ module Cadenya
116
130
  # Arbitrary data for the objective. May be used in liquid templates for prompts
117
131
  # configured on the agent variation
118
132
  data:,
133
+ # Episodic is used to configure the episodic memory for the objective
134
+ episodic_memory: nil,
119
135
  # Optional override for the initial message sent to the agent. This becomes the
120
136
  # first user message in the LLM chat history. When not set, the selected
121
137
  # variation's user_message_template is rendered with user_data instead. If neither
@@ -162,6 +178,7 @@ module Cadenya
162
178
  workspace_id: String,
163
179
  agent_id: String,
164
180
  data: T::Hash[Symbol, T.anything],
181
+ episodic_memory: Cadenya::ObjectiveCreateParams::EpisodicMemory,
165
182
  initial_message: String,
166
183
  memory_stack: T::Array[Cadenya::MemoryReference],
167
184
  metadata: Cadenya::CreateOperationMetadata,
@@ -175,6 +192,37 @@ module Cadenya
175
192
  def to_hash
176
193
  end
177
194
 
195
+ class EpisodicMemory < Cadenya::Internal::Type::BaseModel
196
+ OrHash =
197
+ T.type_alias do
198
+ T.any(
199
+ Cadenya::ObjectiveCreateParams::EpisodicMemory,
200
+ Cadenya::Internal::AnyHash
201
+ )
202
+ end
203
+
204
+ # The caller-supplied episodic key. Objectives created with the same key (for the
205
+ # same agent) share one episodic memory layer.
206
+ sig { returns(T.nilable(String)) }
207
+ attr_reader :key
208
+
209
+ sig { params(key: String).void }
210
+ attr_writer :key
211
+
212
+ # Episodic is used to configure the episodic memory for the objective
213
+ sig { params(key: String).returns(T.attached_class) }
214
+ def self.new(
215
+ # The caller-supplied episodic key. Objectives created with the same key (for the
216
+ # same agent) share one episodic memory layer.
217
+ key: nil
218
+ )
219
+ end
220
+
221
+ sig { override.returns({ key: String, memory_layer_id: String }) }
222
+ def to_hash
223
+ end
224
+ end
225
+
178
226
  class Secret < Cadenya::Internal::Type::BaseModel
179
227
  OrHash =
180
228
  T.type_alias do
@@ -38,13 +38,6 @@ module Cadenya
38
38
  sig { params(memo: String).void }
39
39
  attr_writer :memo
40
40
 
41
- # The result content returned by the tool after execution
42
- sig { returns(T.nilable(String)) }
43
- attr_reader :result
44
-
45
- sig { params(result: String).void }
46
- attr_writer :result
47
-
48
41
  # A profile identifies a user or non-human principal (such as an API key) at the
49
42
  # account level. Profiles are account-scoped and can be granted access to multiple
50
43
  # workspaces.
@@ -59,7 +52,6 @@ module Cadenya
59
52
  callable: Cadenya::CallableTool::OrHash,
60
53
  arguments: T::Hash[Symbol, T.anything],
61
54
  memo: String,
62
- result: String,
63
55
  status_changed_by: Cadenya::Profile::OrHash
64
56
  ).returns(T.attached_class)
65
57
  end
@@ -73,8 +65,6 @@ module Cadenya
73
65
  arguments: nil,
74
66
  # A memo supplied by the reviewer when denying the tool call
75
67
  memo: nil,
76
- # The result content returned by the tool after execution
77
- result: nil,
78
68
  # A profile identifies a user or non-human principal (such as an API key) at the
79
69
  # account level. Profiles are account-scoped and can be granted access to multiple
80
70
  # workspaces.
@@ -88,7 +78,6 @@ module Cadenya
88
78
  callable: Cadenya::CallableTool,
89
79
  arguments: T::Hash[Symbol, T.anything],
90
80
  memo: String,
91
- result: String,
92
81
  status_changed_by: Cadenya::Profile
93
82
  }
94
83
  )