cadenya 0.27.0 → 0.29.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 (39) 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 +16 -15
  5. data/lib/cadenya/models/agents/agent_schedule_spec.rb +21 -20
  6. data/lib/cadenya/models/agents/agent_variation_spec.rb +16 -14
  7. data/lib/cadenya/models/context_lengths.rb +87 -0
  8. data/lib/cadenya/models/objective.rb +18 -16
  9. data/lib/cadenya/models/objective_create_params.rb +28 -25
  10. data/lib/cadenya/models/objective_diagnostics.rb +50 -0
  11. data/lib/cadenya/models/objective_retrieve_diagnostics_params.rb +26 -0
  12. data/lib/cadenya/models/objective_retrieve_diagnostics_response.rb +25 -0
  13. data/lib/cadenya/models.rb +6 -0
  14. data/lib/cadenya/resources/objectives.rb +35 -5
  15. data/lib/cadenya/version.rb +1 -1
  16. data/lib/cadenya.rb +4 -0
  17. data/rbi/cadenya/models/agent_spec.rbi +23 -19
  18. data/rbi/cadenya/models/agents/agent_schedule_spec.rbi +38 -36
  19. data/rbi/cadenya/models/agents/agent_variation_spec.rbi +25 -21
  20. data/rbi/cadenya/models/context_lengths.rbi +103 -0
  21. data/rbi/cadenya/models/objective.rbi +24 -24
  22. data/rbi/cadenya/models/objective_create_params.rbi +39 -37
  23. data/rbi/cadenya/models/objective_diagnostics.rbi +76 -0
  24. data/rbi/cadenya/models/objective_retrieve_diagnostics_params.rbi +46 -0
  25. data/rbi/cadenya/models/objective_retrieve_diagnostics_response.rbi +43 -0
  26. data/rbi/cadenya/models.rbi +7 -0
  27. data/rbi/cadenya/resources/objectives.rbi +35 -15
  28. data/sig/cadenya/models/agent_spec.rbs +9 -7
  29. data/sig/cadenya/models/agents/agent_schedule_spec.rbs +15 -15
  30. data/sig/cadenya/models/agents/agent_variation_spec.rbs +7 -7
  31. data/sig/cadenya/models/context_lengths.rbs +55 -0
  32. data/sig/cadenya/models/objective.rbs +14 -14
  33. data/sig/cadenya/models/objective_create_params.rbs +16 -16
  34. data/sig/cadenya/models/objective_diagnostics.rbs +30 -0
  35. data/sig/cadenya/models/objective_retrieve_diagnostics_params.rbs +28 -0
  36. data/sig/cadenya/models/objective_retrieve_diagnostics_response.rbs +14 -0
  37. data/sig/cadenya/models.rbs +6 -0
  38. data/sig/cadenya/resources/objectives.rbs +9 -3
  39. metadata +14 -2
@@ -6,10 +6,10 @@ module Cadenya
6
6
  OrHash =
7
7
  T.type_alias { T.any(Cadenya::Objective, Cadenya::Internal::AnyHash) }
8
8
 
9
- # The initial message sent to the agent. This becomes the first user message in
10
- # the LLM chat history.
9
+ # The first user message in the LLM chat history, either provided explicitly at
10
+ # creation or rendered from the variation's first_user_message_template.
11
11
  sig { returns(String) }
12
- attr_accessor :initial_message
12
+ attr_accessor :first_user_message
13
13
 
14
14
  # Metadata for ephemeral operations and activities (e.g., objectives, executions,
15
15
  # runs)
@@ -75,12 +75,12 @@ module Cadenya
75
75
  sig { returns(String) }
76
76
  attr_accessor :system_prompt
77
77
 
78
- # Arbitrary data for the objective
78
+ # Arbitrary data rendered into the variation's first_user_message_template
79
79
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
80
- attr_reader :data
80
+ attr_reader :first_user_message_data
81
81
 
82
- sig { params(data: T::Hash[Symbol, T.anything]).void }
83
- attr_writer :data
82
+ sig { params(first_user_message_data: T::Hash[Symbol, T.anything]).void }
83
+ attr_writer :first_user_message_data
84
84
 
85
85
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
86
86
  # execution
@@ -114,12 +114,12 @@ module Cadenya
114
114
  sig { params(state_message: String).void }
115
115
  attr_writer :state_message
116
116
 
117
- # Arbitrary data used to render the variation's user_message_template
117
+ # Arbitrary data rendered into the variation's system_prompt_template
118
118
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
119
- attr_reader :user_data
119
+ attr_reader :system_prompt_data
120
120
 
121
- sig { params(user_data: T::Hash[Symbol, T.anything]).void }
122
- attr_writer :user_data
121
+ sig { params(system_prompt_data: T::Hash[Symbol, T.anything]).void }
122
+ attr_writer :system_prompt_data
123
123
 
124
124
  # Objective is the data for an objective. It contains the snapshotted fields for
125
125
  # the selected agent and variation. Secrets are returned only with their names,
@@ -127,28 +127,28 @@ module Cadenya
127
127
  sig do
128
128
  params(
129
129
  config_snapshot: Cadenya::ObjectiveConfigSnapshot::OrHash,
130
- initial_message: String,
130
+ first_user_message: String,
131
131
  metadata: Cadenya::OperationMetadata::OrHash,
132
132
  state: Cadenya::Objective::State::OrSymbol,
133
133
  system_prompt: String,
134
- data: T::Hash[Symbol, T.anything],
135
134
  episodic_memory: Cadenya::Objective::EpisodicMemory::OrHash,
135
+ first_user_message_data: T::Hash[Symbol, T.anything],
136
136
  info: Cadenya::ObjectiveInfo::OrHash,
137
137
  memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
138
138
  output: T::Hash[Symbol, T.anything],
139
139
  parent_objective_id: String,
140
140
  secrets: T::Array[Cadenya::ObjectiveSecret::OrHash],
141
141
  state_message: String,
142
- user_data: T::Hash[Symbol, T.anything]
142
+ system_prompt_data: T::Hash[Symbol, T.anything]
143
143
  ).returns(T.attached_class)
144
144
  end
145
145
  def self.new(
146
146
  # ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
147
147
  # and (when applicable) schedule that an objective was started with.
148
148
  config_snapshot:,
149
- # The initial message sent to the agent. This becomes the first user message in
150
- # the LLM chat history.
151
- initial_message:,
149
+ # The first user message in the LLM chat history, either provided explicitly at
150
+ # creation or rendered from the variation's first_user_message_template.
151
+ first_user_message:,
152
152
  # Metadata for ephemeral operations and activities (e.g., objectives, executions,
153
153
  # runs)
154
154
  metadata:,
@@ -156,10 +156,10 @@ module Cadenya
156
156
  state:,
157
157
  # system_prompt is read-only, derived from the selected variation's prompt
158
158
  system_prompt:,
159
- # Arbitrary data for the objective
160
- data: nil,
161
159
  # Episodic is used to configure the episodic memory for the objective
162
160
  episodic_memory: nil,
161
+ # Arbitrary data rendered into the variation's first_user_message_template
162
+ first_user_message_data: nil,
163
163
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
164
164
  # execution
165
165
  info: nil,
@@ -189,8 +189,8 @@ module Cadenya
189
189
  secrets: nil,
190
190
  # Optional human-readable detail about the current state (e.g. a failure reason).
191
191
  state_message: nil,
192
- # Arbitrary data used to render the variation's user_message_template
193
- user_data: nil
192
+ # Arbitrary data rendered into the variation's system_prompt_template
193
+ system_prompt_data: nil
194
194
  )
195
195
  end
196
196
 
@@ -198,19 +198,19 @@ module Cadenya
198
198
  override.returns(
199
199
  {
200
200
  config_snapshot: Cadenya::ObjectiveConfigSnapshot,
201
- initial_message: String,
201
+ first_user_message: String,
202
202
  metadata: Cadenya::OperationMetadata,
203
203
  state: Cadenya::Objective::State::TaggedSymbol,
204
204
  system_prompt: String,
205
- data: T::Hash[Symbol, T.anything],
206
205
  episodic_memory: Cadenya::Objective::EpisodicMemory,
206
+ first_user_message_data: T::Hash[Symbol, T.anything],
207
207
  info: Cadenya::ObjectiveInfo,
208
208
  memory_cascade: T::Array[Cadenya::MemoryReference],
209
209
  output: T::Hash[Symbol, T.anything],
210
210
  parent_objective_id: String,
211
211
  secrets: T::Array[Cadenya::ObjectiveSecret],
212
212
  state_message: String,
213
- user_data: T::Hash[Symbol, T.anything]
213
+ system_prompt_data: T::Hash[Symbol, T.anything]
214
214
  }
215
215
  )
216
216
  end
@@ -17,10 +17,11 @@ module Cadenya
17
17
  sig { returns(String) }
18
18
  attr_accessor :agent_id
19
19
 
20
- # Arbitrary data for the objective. May be used in liquid templates for prompts
21
- # configured on the agent variation
20
+ # Arbitrary data rendered into the selected variation's system_prompt_template
21
+ # (liquid) to produce the objective's system prompt. If the agent has a
22
+ # system_prompt_data_schema, this must satisfy it.
22
23
  sig { returns(T::Hash[Symbol, T.anything]) }
23
- attr_accessor :data
24
+ attr_accessor :system_prompt_data
24
25
 
25
26
  # Episodic is used to configure the episodic memory for the objective
26
27
  sig { returns(T.nilable(Cadenya::ObjectiveCreateParams::EpisodicMemory)) }
@@ -34,16 +35,25 @@ module Cadenya
34
35
  end
35
36
  attr_writer :episodic_memory
36
37
 
37
- # Optional override for the initial message sent to the agent. This becomes the
38
- # first user message in the LLM chat history. When not set, the selected
39
- # variation's user_message_template is rendered with user_data instead. If neither
40
- # this field nor a user_message_template is present, the request is rejected with
38
+ # Optional explicit first user message for the LLM chat history. When not set, the
39
+ # selected variation's first_user_message_template is rendered with
40
+ # first_user_message_data instead. If neither this field nor a
41
+ # first_user_message_template is present, the request is rejected with
41
42
  # InvalidArgument.
42
43
  sig { returns(T.nilable(String)) }
43
- attr_reader :initial_message
44
+ attr_reader :first_user_message
44
45
 
45
- sig { params(initial_message: String).void }
46
- attr_writer :initial_message
46
+ sig { params(first_user_message: String).void }
47
+ attr_writer :first_user_message
48
+
49
+ # Arbitrary data rendered into the selected variation's
50
+ # first_user_message_template (liquid) to produce the first user message. Separate
51
+ # from `system_prompt_data`, which renders the system prompt template.
52
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
53
+ attr_reader :first_user_message_data
54
+
55
+ sig { params(first_user_message_data: T::Hash[Symbol, T.anything]).void }
56
+ attr_writer :first_user_message_data
47
57
 
48
58
  # Memory layers/entries layered over the baseline cascade inherited from the
49
59
  # selected variation — element-level rules over inherited styles, in CSS terms.
@@ -89,15 +99,6 @@ module Cadenya
89
99
  end
90
100
  attr_writer :secrets
91
101
 
92
- # Arbitrary data rendered into the selected variation's user_message_template
93
- # (liquid) to produce the initial user message. Separate from `data`, which
94
- # renders the system prompt template.
95
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
96
- attr_reader :user_data
97
-
98
- sig { params(user_data: T::Hash[Symbol, T.anything]).void }
99
- attr_writer :user_data
100
-
101
102
  # Optional explicit variation selection. Overrides the agent's
102
103
  # variation_selection_mode.
103
104
  sig { returns(T.nilable(String)) }
@@ -110,14 +111,14 @@ module Cadenya
110
111
  params(
111
112
  workspace_id: String,
112
113
  agent_id: String,
113
- data: T::Hash[Symbol, T.anything],
114
+ system_prompt_data: T::Hash[Symbol, T.anything],
114
115
  episodic_memory:
115
116
  Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash,
116
- initial_message: String,
117
+ first_user_message: String,
118
+ first_user_message_data: T::Hash[Symbol, T.anything],
117
119
  memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
118
120
  metadata: Cadenya::CreateOperationMetadata::OrHash,
119
121
  secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
120
- user_data: T::Hash[Symbol, T.anything],
121
122
  variation_id: String,
122
123
  request_options: Cadenya::RequestOptions::OrHash
123
124
  ).returns(T.attached_class)
@@ -125,17 +126,22 @@ module Cadenya
125
126
  def self.new(
126
127
  workspace_id:,
127
128
  agent_id:,
128
- # Arbitrary data for the objective. May be used in liquid templates for prompts
129
- # configured on the agent variation
130
- data:,
129
+ # Arbitrary data rendered into the selected variation's system_prompt_template
130
+ # (liquid) to produce the objective's system prompt. If the agent has a
131
+ # system_prompt_data_schema, this must satisfy it.
132
+ system_prompt_data:,
131
133
  # Episodic is used to configure the episodic memory for the objective
132
134
  episodic_memory: nil,
133
- # Optional override for the initial message sent to the agent. This becomes the
134
- # first user message in the LLM chat history. When not set, the selected
135
- # variation's user_message_template is rendered with user_data instead. If neither
136
- # this field nor a user_message_template is present, the request is rejected with
135
+ # Optional explicit first user message for the LLM chat history. When not set, the
136
+ # selected variation's first_user_message_template is rendered with
137
+ # first_user_message_data instead. If neither this field nor a
138
+ # first_user_message_template is present, the request is rejected with
137
139
  # InvalidArgument.
138
- initial_message: nil,
140
+ first_user_message: nil,
141
+ # Arbitrary data rendered into the selected variation's
142
+ # first_user_message_template (liquid) to produce the first user message. Separate
143
+ # from `system_prompt_data`, which renders the system prompt template.
144
+ first_user_message_data: nil,
139
145
  # Memory layers/entries layered over the baseline cascade inherited from the
140
146
  # selected variation — element-level rules over inherited styles, in CSS terms.
141
147
  #
@@ -157,10 +163,6 @@ module Cadenya
157
163
  # Secrets that can be used in the headers for tool calls using the secret
158
164
  # interpolation format.
159
165
  secrets: nil,
160
- # Arbitrary data rendered into the selected variation's user_message_template
161
- # (liquid) to produce the initial user message. Separate from `data`, which
162
- # renders the system prompt template.
163
- user_data: nil,
164
166
  # Optional explicit variation selection. Overrides the agent's
165
167
  # variation_selection_mode.
166
168
  variation_id: nil,
@@ -173,13 +175,13 @@ module Cadenya
173
175
  {
174
176
  workspace_id: String,
175
177
  agent_id: String,
176
- data: T::Hash[Symbol, T.anything],
178
+ system_prompt_data: T::Hash[Symbol, T.anything],
177
179
  episodic_memory: Cadenya::ObjectiveCreateParams::EpisodicMemory,
178
- initial_message: String,
180
+ first_user_message: String,
181
+ first_user_message_data: T::Hash[Symbol, T.anything],
179
182
  memory_cascade: T::Array[Cadenya::MemoryReference],
180
183
  metadata: Cadenya::CreateOperationMetadata,
181
184
  secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret],
182
- user_data: T::Hash[Symbol, T.anything],
183
185
  variation_id: String,
184
186
  request_options: Cadenya::RequestOptions
185
187
  }
@@ -0,0 +1,76 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveDiagnostics < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ObjectiveDiagnostics, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ # The portion of input_tokens served from the provider's prompt cache. Lets
12
+ # clients distinguish "big but cached" from "big and paid fresh every iteration".
13
+ sig { returns(Integer) }
14
+ attr_accessor :cached_input_tokens
15
+
16
+ # ContextLengths is the measured character length of each distinct component of an
17
+ # iteration's assembled context window. Values are raw character lengths of the
18
+ # component as assembled into the request — token estimates are derived by the
19
+ # client against input_tokens (component share = component length / sum of all
20
+ # lengths).
21
+ #
22
+ # New components are added as new fields — wire-compatible; absent components read
23
+ # as 0.
24
+ sig { returns(Cadenya::ContextLengths) }
25
+ attr_reader :context_lengths
26
+
27
+ sig { params(context_lengths: Cadenya::ContextLengths::OrHash).void }
28
+ attr_writer :context_lengths
29
+
30
+ # Input tokens reported by the LLM provider for the iteration's completion.
31
+ sig { returns(Integer) }
32
+ attr_accessor :input_tokens
33
+
34
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
35
+ # iteration at request-assembly time. It reports how much of the context window
36
+ # each component occupies so tool parameters, memory cascades, and prompts can be
37
+ # tuned against real token usage.
38
+ sig do
39
+ params(
40
+ cached_input_tokens: Integer,
41
+ context_lengths: Cadenya::ContextLengths::OrHash,
42
+ input_tokens: Integer
43
+ ).returns(T.attached_class)
44
+ end
45
+ def self.new(
46
+ # The portion of input_tokens served from the provider's prompt cache. Lets
47
+ # clients distinguish "big but cached" from "big and paid fresh every iteration".
48
+ cached_input_tokens:,
49
+ # ContextLengths is the measured character length of each distinct component of an
50
+ # iteration's assembled context window. Values are raw character lengths of the
51
+ # component as assembled into the request — token estimates are derived by the
52
+ # client against input_tokens (component share = component length / sum of all
53
+ # lengths).
54
+ #
55
+ # New components are added as new fields — wire-compatible; absent components read
56
+ # as 0.
57
+ context_lengths:,
58
+ # Input tokens reported by the LLM provider for the iteration's completion.
59
+ input_tokens:
60
+ )
61
+ end
62
+
63
+ sig do
64
+ override.returns(
65
+ {
66
+ cached_input_tokens: Integer,
67
+ context_lengths: Cadenya::ContextLengths,
68
+ input_tokens: Integer
69
+ }
70
+ )
71
+ end
72
+ def to_hash
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveRetrieveDiagnosticsParams < Cadenya::Internal::Type::BaseModel
6
+ extend Cadenya::Internal::Type::RequestParameters::Converter
7
+ include Cadenya::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Cadenya::ObjectiveRetrieveDiagnosticsParams,
13
+ Cadenya::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :workspace_id
19
+
20
+ sig { returns(String) }
21
+ attr_accessor :objective_id
22
+
23
+ sig do
24
+ params(
25
+ workspace_id: String,
26
+ objective_id: String,
27
+ request_options: Cadenya::RequestOptions::OrHash
28
+ ).returns(T.attached_class)
29
+ end
30
+ def self.new(workspace_id:, objective_id:, request_options: {})
31
+ end
32
+
33
+ sig do
34
+ override.returns(
35
+ {
36
+ workspace_id: String,
37
+ objective_id: String,
38
+ request_options: Cadenya::RequestOptions
39
+ }
40
+ )
41
+ end
42
+ def to_hash
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveRetrieveDiagnosticsResponse < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse,
10
+ Cadenya::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
15
+ # iteration at request-assembly time. It reports how much of the context window
16
+ # each component occupies so tool parameters, memory cascades, and prompts can be
17
+ # tuned against real token usage.
18
+ sig { returns(Cadenya::ObjectiveDiagnostics) }
19
+ attr_reader :diagnostics
20
+
21
+ sig { params(diagnostics: Cadenya::ObjectiveDiagnostics::OrHash).void }
22
+ attr_writer :diagnostics
23
+
24
+ sig do
25
+ params(diagnostics: Cadenya::ObjectiveDiagnostics::OrHash).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
31
+ # iteration at request-assembly time. It reports how much of the context window
32
+ # each component occupies so tool parameters, memory cascades, and prompts can be
33
+ # tuned against real token usage.
34
+ diagnostics:
35
+ )
36
+ end
37
+
38
+ sig { override.returns({ diagnostics: Cadenya::ObjectiveDiagnostics }) }
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end
@@ -89,6 +89,8 @@ module Cadenya
89
89
 
90
90
  CallableTool = Cadenya::Models::CallableTool
91
91
 
92
+ ContextLengths = Cadenya::Models::ContextLengths
93
+
92
94
  ContextWindowCompacted = Cadenya::Models::ContextWindowCompacted
93
95
 
94
96
  CreateOperationMetadata = Cadenya::Models::CreateOperationMetadata
@@ -147,6 +149,8 @@ module Cadenya
147
149
 
148
150
  ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
149
151
 
152
+ ObjectiveDiagnostics = Cadenya::Models::ObjectiveDiagnostics
153
+
150
154
  ObjectiveError = Cadenya::Models::ObjectiveError
151
155
 
152
156
  ObjectiveEvent = Cadenya::Models::ObjectiveEvent
@@ -166,6 +170,9 @@ module Cadenya
166
170
 
167
171
  ObjectiveListParams = Cadenya::Models::ObjectiveListParams
168
172
 
173
+ ObjectiveRetrieveDiagnosticsParams =
174
+ Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
175
+
169
176
  ObjectiveRetrieveParams = Cadenya::Models::ObjectiveRetrieveParams
170
177
 
171
178
  Objectives = Cadenya::Models::Objectives
@@ -20,14 +20,14 @@ module Cadenya
20
20
  params(
21
21
  workspace_id: String,
22
22
  agent_id: String,
23
- data: T::Hash[Symbol, T.anything],
23
+ system_prompt_data: T::Hash[Symbol, T.anything],
24
24
  episodic_memory:
25
25
  Cadenya::ObjectiveCreateParams::EpisodicMemory::OrHash,
26
- initial_message: String,
26
+ first_user_message: String,
27
+ first_user_message_data: T::Hash[Symbol, T.anything],
27
28
  memory_cascade: T::Array[Cadenya::MemoryReference::OrHash],
28
29
  metadata: Cadenya::CreateOperationMetadata::OrHash,
29
30
  secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
30
- user_data: T::Hash[Symbol, T.anything],
31
31
  variation_id: String,
32
32
  request_options: Cadenya::RequestOptions::OrHash
33
33
  ).returns(Cadenya::Objective)
@@ -35,17 +35,22 @@ module Cadenya
35
35
  def create(
36
36
  workspace_id,
37
37
  agent_id:,
38
- # Arbitrary data for the objective. May be used in liquid templates for prompts
39
- # configured on the agent variation
40
- data:,
38
+ # Arbitrary data rendered into the selected variation's system_prompt_template
39
+ # (liquid) to produce the objective's system prompt. If the agent has a
40
+ # system_prompt_data_schema, this must satisfy it.
41
+ system_prompt_data:,
41
42
  # Episodic is used to configure the episodic memory for the objective
42
43
  episodic_memory: nil,
43
- # Optional override for the initial message sent to the agent. This becomes the
44
- # first user message in the LLM chat history. When not set, the selected
45
- # variation's user_message_template is rendered with user_data instead. If neither
46
- # this field nor a user_message_template is present, the request is rejected with
44
+ # Optional explicit first user message for the LLM chat history. When not set, the
45
+ # selected variation's first_user_message_template is rendered with
46
+ # first_user_message_data instead. If neither this field nor a
47
+ # first_user_message_template is present, the request is rejected with
47
48
  # InvalidArgument.
48
- initial_message: nil,
49
+ first_user_message: nil,
50
+ # Arbitrary data rendered into the selected variation's
51
+ # first_user_message_template (liquid) to produce the first user message. Separate
52
+ # from `system_prompt_data`, which renders the system prompt template.
53
+ first_user_message_data: nil,
49
54
  # Memory layers/entries layered over the baseline cascade inherited from the
50
55
  # selected variation — element-level rules over inherited styles, in CSS terms.
51
56
  #
@@ -67,10 +72,6 @@ module Cadenya
67
72
  # Secrets that can be used in the headers for tool calls using the secret
68
73
  # interpolation format.
69
74
  secrets: nil,
70
- # Arbitrary data rendered into the selected variation's user_message_template
71
- # (liquid) to produce the initial user message. Separate from `data`, which
72
- # renders the system prompt template.
73
- user_data: nil,
74
75
  # Optional explicit variation selection. Overrides the agent's
75
76
  # variation_selection_mode.
76
77
  variation_id: nil,
@@ -266,6 +267,25 @@ module Cadenya
266
267
  )
267
268
  end
268
269
 
270
+ # Returns the context-usage breakdown measured for the objective's most recent
271
+ # iteration: character lengths per context component (system prompt, memory
272
+ # appendices, tool definitions, messages by role) alongside the iteration's input
273
+ # token counts.
274
+ sig do
275
+ params(
276
+ objective_id: String,
277
+ workspace_id: String,
278
+ request_options: Cadenya::RequestOptions::OrHash
279
+ ).returns(Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse)
280
+ end
281
+ def retrieve_diagnostics(
282
+ # The ID of the objective. Supports "external_id:" prefix for external IDs.
283
+ objective_id,
284
+ workspace_id:,
285
+ request_options: {}
286
+ )
287
+ end
288
+
269
289
  # Streams events for an objective in real-time using server-sent events (SSE)
270
290
  sig do
271
291
  params(
@@ -6,8 +6,8 @@ module Cadenya
6
6
  description: String,
7
7
  enable_episodic_memory: bool,
8
8
  episodic_memory_ttl: Integer,
9
- input_data_schema: ::Hash[Symbol, top],
10
9
  output_definition: ::Hash[Symbol, top],
10
+ system_prompt_data_schema: ::Hash[Symbol, top],
11
11
  webhook_events_url: String
12
12
  }
13
13
 
@@ -26,14 +26,16 @@ module Cadenya
26
26
 
27
27
  def episodic_memory_ttl=: (Integer) -> Integer
28
28
 
29
- attr_reader input_data_schema: ::Hash[Symbol, top]?
30
-
31
- def input_data_schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
32
-
33
29
  attr_reader output_definition: ::Hash[Symbol, top]?
34
30
 
35
31
  def output_definition=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
36
32
 
33
+ attr_reader system_prompt_data_schema: ::Hash[Symbol, top]?
34
+
35
+ def system_prompt_data_schema=: (
36
+ ::Hash[Symbol, top]
37
+ ) -> ::Hash[Symbol, top]
38
+
37
39
  attr_reader webhook_events_url: String?
38
40
 
39
41
  def webhook_events_url=: (String) -> String
@@ -43,8 +45,8 @@ module Cadenya
43
45
  ?description: String,
44
46
  ?enable_episodic_memory: bool,
45
47
  ?episodic_memory_ttl: Integer,
46
- ?input_data_schema: ::Hash[Symbol, top],
47
48
  ?output_definition: ::Hash[Symbol, top],
49
+ ?system_prompt_data_schema: ::Hash[Symbol, top],
48
50
  ?webhook_events_url: String
49
51
  ) -> void
50
52
 
@@ -53,8 +55,8 @@ module Cadenya
53
55
  description: String,
54
56
  enable_episodic_memory: bool,
55
57
  episodic_memory_ttl: Integer,
56
- input_data_schema: ::Hash[Symbol, top],
57
58
  output_definition: ::Hash[Symbol, top],
59
+ system_prompt_data_schema: ::Hash[Symbol, top],
58
60
  webhook_events_url: String
59
61
  }
60
62
 
@@ -6,23 +6,23 @@ module Cadenya
6
6
  type agent_schedule_spec =
7
7
  {
8
8
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
9
- data: top,
10
- initial_message: String,
9
+ first_user_message: String,
10
+ first_user_message_data: top,
11
11
  overlap_policy: Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy,
12
- user_data: top,
12
+ system_prompt_data: top,
13
13
  variation_id: String
14
14
  }
15
15
 
16
16
  class AgentScheduleSpec < Cadenya::Internal::Type::BaseModel
17
17
  attr_accessor schedule: Cadenya::Agents::AgentScheduleSpecSchedule
18
18
 
19
- attr_reader data: top?
19
+ attr_reader first_user_message: String?
20
20
 
21
- def data=: (top) -> top
21
+ def first_user_message=: (String) -> String
22
22
 
23
- attr_reader initial_message: String?
23
+ attr_reader first_user_message_data: top?
24
24
 
25
- def initial_message=: (String) -> String
25
+ def first_user_message_data=: (top) -> top
26
26
 
27
27
  attr_reader overlap_policy: Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy?
28
28
 
@@ -30,9 +30,9 @@ module Cadenya
30
30
  Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy
31
31
  ) -> Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy
32
32
 
33
- attr_reader user_data: top?
33
+ attr_reader system_prompt_data: top?
34
34
 
35
- def user_data=: (top) -> top
35
+ def system_prompt_data=: (top) -> top
36
36
 
37
37
  attr_reader variation_id: String?
38
38
 
@@ -40,19 +40,19 @@ module Cadenya
40
40
 
41
41
  def initialize: (
42
42
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
43
- ?data: top,
44
- ?initial_message: String,
43
+ ?first_user_message: String,
44
+ ?first_user_message_data: top,
45
45
  ?overlap_policy: Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy,
46
- ?user_data: top,
46
+ ?system_prompt_data: top,
47
47
  ?variation_id: String
48
48
  ) -> void
49
49
 
50
50
  def to_hash: -> {
51
51
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
52
- data: top,
53
- initial_message: String,
52
+ first_user_message: String,
53
+ first_user_message_data: top,
54
54
  overlap_policy: Cadenya::Models::Agents::AgentScheduleSpec::overlap_policy,
55
- user_data: top,
55
+ system_prompt_data: top,
56
56
  variation_id: String
57
57
  }
58
58