cadenya 0.8.0 → 0.9.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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/models/objective.rb +116 -18
  5. data/lib/cadenya/models/objective_config_snapshot.rb +39 -0
  6. data/lib/cadenya/models/objective_create_params.rb +65 -4
  7. data/lib/cadenya/models/objective_info.rb +45 -29
  8. data/lib/cadenya/models/objective_secret.rb +15 -0
  9. data/lib/cadenya/models/objectives/objective_tool_call.rb +19 -19
  10. data/lib/cadenya/models.rb +3 -5
  11. data/lib/cadenya/resources/objectives/tool_calls.rb +4 -4
  12. data/lib/cadenya/resources/objectives.rb +11 -5
  13. data/lib/cadenya/version.rb +1 -1
  14. data/lib/cadenya.rb +2 -3
  15. data/rbi/cadenya/models/objective.rbi +172 -32
  16. data/rbi/cadenya/models/objective_config_snapshot.rbi +70 -0
  17. data/rbi/cadenya/models/objective_create_params.rbi +112 -6
  18. data/rbi/cadenya/models/objective_info.rbi +50 -56
  19. data/rbi/cadenya/models/objective_secret.rbi +26 -0
  20. data/rbi/cadenya/models/objectives/objective_tool_call.rbi +47 -57
  21. data/rbi/cadenya/models/profile_spec.rbi +2 -2
  22. data/rbi/cadenya/models.rbi +3 -5
  23. data/rbi/cadenya/resources/objectives.rbi +29 -1
  24. data/sig/cadenya/models/objective.rbs +85 -15
  25. data/sig/cadenya/models/objective_config_snapshot.rbs +40 -0
  26. data/sig/cadenya/models/objective_create_params.rbs +45 -4
  27. data/sig/cadenya/models/objective_info.rbs +26 -38
  28. data/sig/cadenya/models/objective_secret.rbs +15 -0
  29. data/sig/cadenya/models/objectives/objective_tool_call.rbs +23 -27
  30. data/sig/cadenya/models.rbs +3 -5
  31. data/sig/cadenya/resources/objectives.rbs +4 -1
  32. metadata +8 -11
  33. data/lib/cadenya/models/objective_data.rb +0 -127
  34. data/lib/cadenya/models/objective_data_secret.rb +0 -21
  35. data/lib/cadenya/models/objective_status.rb +0 -37
  36. data/rbi/cadenya/models/objective_data.rbi +0 -198
  37. data/rbi/cadenya/models/objective_data_secret.rbi +0 -32
  38. data/rbi/cadenya/models/objective_status.rbi +0 -75
  39. data/sig/cadenya/models/objective_data.rbs +0 -98
  40. data/sig/cadenya/models/objective_data_secret.rbs +0 -19
  41. data/sig/cadenya/models/objective_status.rbs +0 -47
@@ -20,16 +20,22 @@ module Cadenya
20
20
  #
21
21
  # Creates a new objective in the workspace
22
22
  #
23
- # @overload create(workspace_id, agent_id:, data:, metadata: nil, variation_id: nil, request_options: {})
23
+ # @overload create(workspace_id, agent_id:, data:, initial_message: nil, memory_stack: nil, metadata: nil, secrets: nil, variation_id: nil, request_options: {})
24
24
  #
25
25
  # @param workspace_id [String]
26
26
  #
27
27
  # @param agent_id [String]
28
28
  #
29
- # @param data [Cadenya::Models::ObjectiveData]
29
+ # @param data [Hash{Symbol=>Object}] Arbitrary data for the objective. May be used in liquid templates for prompts co
30
+ #
31
+ # @param initial_message [String] Optional override for initial message sent to the agent. This becomes the first
32
+ #
33
+ # @param memory_stack [Array<Cadenya::Models::MemoryReference>] Memory layers/entries to push onto this objective's memory stack on
30
34
  #
31
35
  # @param metadata [Cadenya::Models::CreateOperationMetadata] CreateOperationMetadata contains the user-provided fields for creating
32
36
  #
37
+ # @param secrets [Array<Cadenya::Models::ObjectiveCreateParams::Secret>] Secrets that can be used in the headers for tool calls using the secret interpol
38
+ #
33
39
  # @param variation_id [String] Optional explicit variation selection. Overrides the agent's variation_selection
34
40
  #
35
41
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -152,7 +158,7 @@ module Cadenya
152
158
  end
153
159
  @client.request(
154
160
  method: :post,
155
- path: ["v1/workspaces/%1$s/objectives/%2$s/cancel", workspace_id, objective_id],
161
+ path: ["v1/workspaces/%1$s/objectives/%2$s:cancel", workspace_id, objective_id],
156
162
  body: parsed,
157
163
  model: Cadenya::Objective,
158
164
  options: options
@@ -186,7 +192,7 @@ module Cadenya
186
192
  end
187
193
  @client.request(
188
194
  method: :post,
189
- path: ["v1/workspaces/%1$s/objectives/%2$s/compact", workspace_id, objective_id],
195
+ path: ["v1/workspaces/%1$s/objectives/%2$s:compact", workspace_id, objective_id],
190
196
  body: parsed,
191
197
  model: Cadenya::Models::ObjectiveCompactResponse,
192
198
  options: options
@@ -223,7 +229,7 @@ module Cadenya
223
229
  end
224
230
  @client.request(
225
231
  method: :post,
226
- path: ["v1/workspaces/%1$s/objectives/%2$s/continue", workspace_id, objective_id],
232
+ path: ["v1/workspaces/%1$s/objectives/%2$s:continue", workspace_id, objective_id],
227
233
  body: parsed,
228
234
  model: Cadenya::Models::ObjectiveContinueResponse,
229
235
  options: options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -189,13 +189,12 @@ require_relative "cadenya/models/objective"
189
189
  require_relative "cadenya/models/objective_cancel_params"
190
190
  require_relative "cadenya/models/objective_compact_params"
191
191
  require_relative "cadenya/models/objective_compact_response"
192
+ require_relative "cadenya/models/objective_config_snapshot"
192
193
  require_relative "cadenya/models/objective_context_window"
193
194
  require_relative "cadenya/models/objective_context_window_data"
194
195
  require_relative "cadenya/models/objective_continue_params"
195
196
  require_relative "cadenya/models/objective_continue_response"
196
197
  require_relative "cadenya/models/objective_create_params"
197
- require_relative "cadenya/models/objective_data"
198
- require_relative "cadenya/models/objective_data_secret"
199
198
  require_relative "cadenya/models/objective_error"
200
199
  require_relative "cadenya/models/objective_event_data"
201
200
  require_relative "cadenya/models/objective_event_info"
@@ -223,7 +222,7 @@ require_relative "cadenya/models/objectives/tool_call_approve_params"
223
222
  require_relative "cadenya/models/objectives/tool_call_deny_params"
224
223
  require_relative "cadenya/models/objectives/tool_call_list_params"
225
224
  require_relative "cadenya/models/objectives/tool_list_params"
226
- require_relative "cadenya/models/objective_status"
225
+ require_relative "cadenya/models/objective_secret"
227
226
  require_relative "cadenya/models/operation_metadata"
228
227
  require_relative "cadenya/models/page"
229
228
  require_relative "cadenya/models/profile"
@@ -6,11 +6,10 @@ module Cadenya
6
6
  OrHash =
7
7
  T.type_alias { T.any(Cadenya::Objective, Cadenya::Internal::AnyHash) }
8
8
 
9
- sig { returns(Cadenya::ObjectiveData) }
10
- attr_reader :data
11
-
12
- sig { params(data: Cadenya::ObjectiveData::OrHash).void }
13
- attr_writer :data
9
+ # The initial message sent to the agent. This becomes the first user message in
10
+ # the LLM chat history.
11
+ sig { returns(String) }
12
+ attr_accessor :initial_message
14
13
 
15
14
  # Metadata for ephemeral operations and activities (e.g., objectives, executions,
16
15
  # runs)
@@ -20,11 +19,61 @@ module Cadenya
20
19
  sig { params(metadata: Cadenya::OperationMetadata::OrHash).void }
21
20
  attr_writer :metadata
22
21
 
23
- sig { returns(Cadenya::ObjectiveStatus) }
24
- attr_reader :status
22
+ # Memory layers/entries to push onto this objective's memory stack on top of the
23
+ # baseline stack inherited from the selected variation.
24
+ #
25
+ # Array order is push order: the first element sits lower in the objective's
26
+ # contribution to the stack; the LAST element ends up on top of the effective
27
+ # stack. Entries pinned via memory_entry_id behave as single-entry layers at their
28
+ # position.
29
+ #
30
+ # System-managed layers (e.g., episodic) cannot be referenced here; they attach
31
+ # themselves automatically based on episodic_key.
32
+ #
33
+ # Stack size cap: the TOTAL effective stack (variation's memory layers
34
+ #
35
+ # - this field) must not exceed 10 entries. A request that would produce an
36
+ # effective stack larger than 10 is rejected with InvalidArgument.
37
+ sig { returns(T.nilable(T::Array[Cadenya::MemoryReference])) }
38
+ attr_reader :memory_stack
39
+
40
+ sig do
41
+ params(memory_stack: T::Array[Cadenya::MemoryReference::OrHash]).void
42
+ end
43
+ attr_writer :memory_stack
44
+
45
+ # Secrets that can be used in the headers for tool calls using the secret
46
+ # interpolation format.
47
+ sig { returns(T.nilable(T::Array[Cadenya::ObjectiveSecret])) }
48
+ attr_reader :secrets
49
+
50
+ sig { params(secrets: T::Array[Cadenya::ObjectiveSecret::OrHash]).void }
51
+ attr_writer :secrets
25
52
 
26
- sig { params(status: Cadenya::ObjectiveStatus::OrHash).void }
27
- attr_writer :status
53
+ # ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
54
+ # and (when applicable) schedule that an objective was started with.
55
+ sig { returns(Cadenya::ObjectiveConfigSnapshot) }
56
+ attr_reader :config_snapshot
57
+
58
+ sig do
59
+ params(config_snapshot: Cadenya::ObjectiveConfigSnapshot::OrHash).void
60
+ end
61
+ attr_writer :config_snapshot
62
+
63
+ # The current lifecycle state of the objective.
64
+ sig { returns(Cadenya::Objective::State::TaggedSymbol) }
65
+ attr_accessor :state
66
+
67
+ # system_prompt is read-only, derived from the selected variation's prompt
68
+ sig { returns(String) }
69
+ attr_accessor :system_prompt
70
+
71
+ # Arbitrary data for the objective
72
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
73
+ attr_reader :data
74
+
75
+ sig { params(data: T::Hash[Symbol, T.anything]).void }
76
+ attr_writer :data
28
77
 
29
78
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
30
79
  # execution
@@ -34,57 +83,148 @@ module Cadenya
34
83
  sig { params(info: Cadenya::ObjectiveInfo::OrHash).void }
35
84
  attr_writer :info
36
85
 
37
- # Read-only list of the last five windows of execution for this objective, ordered
38
- # by most recent first. Is only included in singular RPC calls (GetObjective, for
39
- # example).
40
- sig { returns(T.nilable(T::Array[Cadenya::ObjectiveContextWindow])) }
41
- attr_reader :last_five_windows
86
+ # The output of the objective, populated when the objective completes. Will match
87
+ # the schema of output_json_schema or output_json_inferred. This will only be set
88
+ # if the state of the objective is set to STATE_FINALIZED
89
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
90
+ attr_reader :output
42
91
 
43
- sig do
44
- params(
45
- last_five_windows: T::Array[Cadenya::ObjectiveContextWindow::OrHash]
46
- ).void
47
- end
48
- attr_writer :last_five_windows
92
+ sig { params(output: T::Hash[Symbol, T.anything]).void }
93
+ attr_writer :output
94
+
95
+ # A parent objective means the objective was spawned off using a separate agent to
96
+ # complete an objective
97
+ sig { returns(T.nilable(String)) }
98
+ attr_reader :parent_objective_id
99
+
100
+ sig { params(parent_objective_id: String).void }
101
+ attr_writer :parent_objective_id
49
102
 
103
+ # Optional human-readable detail about the current state (e.g. a failure reason).
104
+ sig { returns(T.nilable(String)) }
105
+ attr_reader :state_message
106
+
107
+ sig { params(state_message: String).void }
108
+ attr_writer :state_message
109
+
110
+ # Objective is the data for an objective. It contains the snapshotted fields for
111
+ # the selected agent and variation. Secrets are returned only with their names,
112
+ # and the output definition is copied from the agent's configuration.
50
113
  sig do
51
114
  params(
52
- data: Cadenya::ObjectiveData::OrHash,
115
+ config_snapshot: Cadenya::ObjectiveConfigSnapshot::OrHash,
116
+ initial_message: String,
53
117
  metadata: Cadenya::OperationMetadata::OrHash,
54
- status: Cadenya::ObjectiveStatus::OrHash,
118
+ state: Cadenya::Objective::State::OrSymbol,
119
+ system_prompt: String,
120
+ data: T::Hash[Symbol, T.anything],
55
121
  info: Cadenya::ObjectiveInfo::OrHash,
56
- last_five_windows: T::Array[Cadenya::ObjectiveContextWindow::OrHash]
122
+ memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
123
+ output: T::Hash[Symbol, T.anything],
124
+ parent_objective_id: String,
125
+ secrets: T::Array[Cadenya::ObjectiveSecret::OrHash],
126
+ state_message: String
57
127
  ).returns(T.attached_class)
58
128
  end
59
129
  def self.new(
60
- data:,
130
+ # ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
131
+ # and (when applicable) schedule that an objective was started with.
132
+ config_snapshot:,
133
+ # The initial message sent to the agent. This becomes the first user message in
134
+ # the LLM chat history.
135
+ initial_message:,
61
136
  # Metadata for ephemeral operations and activities (e.g., objectives, executions,
62
137
  # runs)
63
138
  metadata:,
64
- status:,
139
+ # The current lifecycle state of the objective.
140
+ state:,
141
+ # system_prompt is read-only, derived from the selected variation's prompt
142
+ system_prompt:,
143
+ # Arbitrary data for the objective
144
+ data: nil,
65
145
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
66
146
  # execution
67
147
  info: nil,
68
- # Read-only list of the last five windows of execution for this objective, ordered
69
- # by most recent first. Is only included in singular RPC calls (GetObjective, for
70
- # example).
71
- last_five_windows: nil
148
+ # Memory layers/entries to push onto this objective's memory stack on top of the
149
+ # baseline stack inherited from the selected variation.
150
+ #
151
+ # Array order is push order: the first element sits lower in the objective's
152
+ # contribution to the stack; the LAST element ends up on top of the effective
153
+ # stack. Entries pinned via memory_entry_id behave as single-entry layers at their
154
+ # position.
155
+ #
156
+ # System-managed layers (e.g., episodic) cannot be referenced here; they attach
157
+ # themselves automatically based on episodic_key.
158
+ #
159
+ # Stack size cap: the TOTAL effective stack (variation's memory layers
160
+ #
161
+ # - this field) must not exceed 10 entries. A request that would produce an
162
+ # effective stack larger than 10 is rejected with InvalidArgument.
163
+ memory_stack: nil,
164
+ # The output of the objective, populated when the objective completes. Will match
165
+ # the schema of output_json_schema or output_json_inferred. This will only be set
166
+ # if the state of the objective is set to STATE_FINALIZED
167
+ output: nil,
168
+ # A parent objective means the objective was spawned off using a separate agent to
169
+ # complete an objective
170
+ parent_objective_id: nil,
171
+ # Secrets that can be used in the headers for tool calls using the secret
172
+ # interpolation format.
173
+ secrets: nil,
174
+ # Optional human-readable detail about the current state (e.g. a failure reason).
175
+ state_message: nil
72
176
  )
73
177
  end
74
178
 
75
179
  sig do
76
180
  override.returns(
77
181
  {
78
- data: Cadenya::ObjectiveData,
182
+ config_snapshot: Cadenya::ObjectiveConfigSnapshot,
183
+ initial_message: String,
79
184
  metadata: Cadenya::OperationMetadata,
80
- status: Cadenya::ObjectiveStatus,
185
+ state: Cadenya::Objective::State::TaggedSymbol,
186
+ system_prompt: String,
187
+ data: T::Hash[Symbol, T.anything],
81
188
  info: Cadenya::ObjectiveInfo,
82
- last_five_windows: T::Array[Cadenya::ObjectiveContextWindow]
189
+ memory_stack: T::Array[Cadenya::MemoryReference],
190
+ output: T::Hash[Symbol, T.anything],
191
+ parent_objective_id: String,
192
+ secrets: T::Array[Cadenya::ObjectiveSecret],
193
+ state_message: String
83
194
  }
84
195
  )
85
196
  end
86
197
  def to_hash
87
198
  end
199
+
200
+ # The current lifecycle state of the objective.
201
+ module State
202
+ extend Cadenya::Internal::Type::Enum
203
+
204
+ TaggedSymbol = T.type_alias { T.all(Symbol, Cadenya::Objective::State) }
205
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
206
+
207
+ STATE_UNSPECIFIED =
208
+ T.let(:STATE_UNSPECIFIED, Cadenya::Objective::State::TaggedSymbol)
209
+ STATE_PENDING =
210
+ T.let(:STATE_PENDING, Cadenya::Objective::State::TaggedSymbol)
211
+ STATE_RUNNING =
212
+ T.let(:STATE_RUNNING, Cadenya::Objective::State::TaggedSymbol)
213
+ STATE_WAITING =
214
+ T.let(:STATE_WAITING, Cadenya::Objective::State::TaggedSymbol)
215
+ STATE_FAILED =
216
+ T.let(:STATE_FAILED, Cadenya::Objective::State::TaggedSymbol)
217
+ STATE_CANCELLED =
218
+ T.let(:STATE_CANCELLED, Cadenya::Objective::State::TaggedSymbol)
219
+ STATE_FINALIZED =
220
+ T.let(:STATE_FINALIZED, Cadenya::Objective::State::TaggedSymbol)
221
+
222
+ sig do
223
+ override.returns(T::Array[Cadenya::Objective::State::TaggedSymbol])
224
+ end
225
+ def self.values
226
+ end
227
+ end
88
228
  end
89
229
  end
90
230
  end
@@ -0,0 +1,70 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveConfigSnapshot < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ObjectiveConfigSnapshot, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ # Agent resource
12
+ sig { returns(T.nilable(Cadenya::Agent)) }
13
+ attr_reader :agent
14
+
15
+ sig { params(agent: Cadenya::Agent::OrHash).void }
16
+ attr_writer :agent
17
+
18
+ # AgentSchedule resource — a recurring trigger attached to an agent that creates
19
+ # objectives on its cadence.
20
+ sig { returns(T.nilable(Cadenya::Agents::AgentSchedule)) }
21
+ attr_reader :agent_schedule
22
+
23
+ sig do
24
+ params(agent_schedule: Cadenya::Agents::AgentSchedule::OrHash).void
25
+ end
26
+ attr_writer :agent_schedule
27
+
28
+ # AgentVariation resource
29
+ sig { returns(T.nilable(Cadenya::Agents::AgentVariation)) }
30
+ attr_reader :agent_variation
31
+
32
+ sig do
33
+ params(agent_variation: Cadenya::Agents::AgentVariation::OrHash).void
34
+ end
35
+ attr_writer :agent_variation
36
+
37
+ # ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
38
+ # and (when applicable) schedule that an objective was started with.
39
+ sig do
40
+ params(
41
+ agent: Cadenya::Agent::OrHash,
42
+ agent_schedule: Cadenya::Agents::AgentSchedule::OrHash,
43
+ agent_variation: Cadenya::Agents::AgentVariation::OrHash
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # Agent resource
48
+ agent: nil,
49
+ # AgentSchedule resource — a recurring trigger attached to an agent that creates
50
+ # objectives on its cadence.
51
+ agent_schedule: nil,
52
+ # AgentVariation resource
53
+ agent_variation: nil
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ agent: Cadenya::Agent,
61
+ agent_schedule: Cadenya::Agents::AgentSchedule,
62
+ agent_variation: Cadenya::Agents::AgentVariation
63
+ }
64
+ )
65
+ end
66
+ def to_hash
67
+ end
68
+ end
69
+ end
70
+ end
@@ -17,11 +17,42 @@ module Cadenya
17
17
  sig { returns(String) }
18
18
  attr_accessor :agent_id
19
19
 
20
- sig { returns(Cadenya::ObjectiveData) }
21
- attr_reader :data
20
+ # Arbitrary data for the objective. May be used in liquid templates for prompts
21
+ # configured on the agent variation
22
+ sig { returns(T::Hash[Symbol, T.anything]) }
23
+ attr_accessor :data
22
24
 
23
- sig { params(data: Cadenya::ObjectiveData::OrHash).void }
24
- attr_writer :data
25
+ # Optional override for initial message sent to the agent. This becomes the first
26
+ # user message in the LLM chat history. The agent variation is used to set this if
27
+ # not present.
28
+ sig { returns(T.nilable(String)) }
29
+ attr_reader :initial_message
30
+
31
+ sig { params(initial_message: String).void }
32
+ attr_writer :initial_message
33
+
34
+ # Memory layers/entries to push onto this objective's memory stack on top of the
35
+ # baseline stack inherited from the selected variation.
36
+ #
37
+ # Array order is push order: the first element sits lower in the objective's
38
+ # contribution to the stack; the LAST element ends up on top of the effective
39
+ # stack. Entries pinned via memory_entry_id behave as single-entry layers at their
40
+ # position.
41
+ #
42
+ # System-managed layers (e.g., episodic) cannot be referenced here; they attach
43
+ # themselves automatically based on episodic_key.
44
+ #
45
+ # Stack size cap: the TOTAL effective stack (variation's memory layers
46
+ #
47
+ # - this field) must not exceed 10 entries. A request that would produce an
48
+ # effective stack larger than 10 is rejected with InvalidArgument.
49
+ sig { returns(T.nilable(T::Array[Cadenya::MemoryReference])) }
50
+ attr_reader :memory_stack
51
+
52
+ sig do
53
+ params(memory_stack: T::Array[Cadenya::MemoryReference::OrHash]).void
54
+ end
55
+ attr_writer :memory_stack
25
56
 
26
57
  # CreateOperationMetadata contains the user-provided fields for creating an
27
58
  # operation. Read-only fields (id, account_id, workspace_id, created_at,
@@ -32,6 +63,20 @@ module Cadenya
32
63
  sig { params(metadata: Cadenya::CreateOperationMetadata::OrHash).void }
33
64
  attr_writer :metadata
34
65
 
66
+ # Secrets that can be used in the headers for tool calls using the secret
67
+ # interpolation format.
68
+ sig do
69
+ returns(T.nilable(T::Array[Cadenya::ObjectiveCreateParams::Secret]))
70
+ end
71
+ attr_reader :secrets
72
+
73
+ sig do
74
+ params(
75
+ secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash]
76
+ ).void
77
+ end
78
+ attr_writer :secrets
79
+
35
80
  # Optional explicit variation selection. Overrides the agent's
36
81
  # variation_selection_mode.
37
82
  sig { returns(T.nilable(String)) }
@@ -44,8 +89,11 @@ module Cadenya
44
89
  params(
45
90
  workspace_id: String,
46
91
  agent_id: String,
47
- data: Cadenya::ObjectiveData::OrHash,
92
+ data: T::Hash[Symbol, T.anything],
93
+ initial_message: String,
94
+ memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
48
95
  metadata: Cadenya::CreateOperationMetadata::OrHash,
96
+ secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
49
97
  variation_id: String,
50
98
  request_options: Cadenya::RequestOptions::OrHash
51
99
  ).returns(T.attached_class)
@@ -53,11 +101,36 @@ module Cadenya
53
101
  def self.new(
54
102
  workspace_id:,
55
103
  agent_id:,
104
+ # Arbitrary data for the objective. May be used in liquid templates for prompts
105
+ # configured on the agent variation
56
106
  data:,
107
+ # Optional override for initial message sent to the agent. This becomes the first
108
+ # user message in the LLM chat history. The agent variation is used to set this if
109
+ # not present.
110
+ initial_message: nil,
111
+ # Memory layers/entries to push onto this objective's memory stack on top of the
112
+ # baseline stack inherited from the selected variation.
113
+ #
114
+ # Array order is push order: the first element sits lower in the objective's
115
+ # contribution to the stack; the LAST element ends up on top of the effective
116
+ # stack. Entries pinned via memory_entry_id behave as single-entry layers at their
117
+ # position.
118
+ #
119
+ # System-managed layers (e.g., episodic) cannot be referenced here; they attach
120
+ # themselves automatically based on episodic_key.
121
+ #
122
+ # Stack size cap: the TOTAL effective stack (variation's memory layers
123
+ #
124
+ # - this field) must not exceed 10 entries. A request that would produce an
125
+ # effective stack larger than 10 is rejected with InvalidArgument.
126
+ memory_stack: nil,
57
127
  # CreateOperationMetadata contains the user-provided fields for creating an
58
128
  # operation. Read-only fields (id, account_id, workspace_id, created_at,
59
129
  # profile_id) are excluded since they are set by the server.
60
130
  metadata: nil,
131
+ # Secrets that can be used in the headers for tool calls using the secret
132
+ # interpolation format.
133
+ secrets: nil,
61
134
  # Optional explicit variation selection. Overrides the agent's
62
135
  # variation_selection_mode.
63
136
  variation_id: nil,
@@ -70,8 +143,11 @@ module Cadenya
70
143
  {
71
144
  workspace_id: String,
72
145
  agent_id: String,
73
- data: Cadenya::ObjectiveData,
146
+ data: T::Hash[Symbol, T.anything],
147
+ initial_message: String,
148
+ memory_stack: T::Array[Cadenya::MemoryReference],
74
149
  metadata: Cadenya::CreateOperationMetadata,
150
+ secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret],
75
151
  variation_id: String,
76
152
  request_options: Cadenya::RequestOptions
77
153
  }
@@ -79,6 +155,36 @@ module Cadenya
79
155
  end
80
156
  def to_hash
81
157
  end
158
+
159
+ class Secret < Cadenya::Internal::Type::BaseModel
160
+ OrHash =
161
+ T.type_alias do
162
+ T.any(
163
+ Cadenya::ObjectiveCreateParams::Secret,
164
+ Cadenya::Internal::AnyHash
165
+ )
166
+ end
167
+
168
+ sig { returns(T.nilable(String)) }
169
+ attr_reader :name
170
+
171
+ sig { params(name: String).void }
172
+ attr_writer :name
173
+
174
+ sig { returns(T.nilable(String)) }
175
+ attr_reader :value
176
+
177
+ sig { params(value: String).void }
178
+ attr_writer :value
179
+
180
+ sig { params(name: String, value: String).returns(T.attached_class) }
181
+ def self.new(name: nil, value: nil)
182
+ end
183
+
184
+ sig { override.returns({ name: String, value: String }) }
185
+ def to_hash
186
+ end
187
+ end
82
188
  end
83
189
  end
84
190
  end