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
@@ -125,6 +125,8 @@ module Cadenya
125
125
 
126
126
  CallableTool = Cadenya::Models::CallableTool
127
127
 
128
+ ContextLengths = Cadenya::Models::ContextLengths
129
+
128
130
  ContextWindowCompacted = Cadenya::Models::ContextWindowCompacted
129
131
 
130
132
  CreateOperationMetadata = Cadenya::Models::CreateOperationMetadata
@@ -183,6 +185,8 @@ module Cadenya
183
185
 
184
186
  ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
185
187
 
188
+ ObjectiveDiagnostics = Cadenya::Models::ObjectiveDiagnostics
189
+
186
190
  ObjectiveError = Cadenya::Models::ObjectiveError
187
191
 
188
192
  ObjectiveEvent = Cadenya::Models::ObjectiveEvent
@@ -201,6 +205,8 @@ module Cadenya
201
205
 
202
206
  ObjectiveListParams = Cadenya::Models::ObjectiveListParams
203
207
 
208
+ ObjectiveRetrieveDiagnosticsParams = Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
209
+
204
210
  ObjectiveRetrieveParams = Cadenya::Models::ObjectiveRetrieveParams
205
211
 
206
212
  Objectives = Cadenya::Models::Objectives
@@ -20,17 +20,19 @@ module Cadenya
20
20
  #
21
21
  # Creates a new objective in the workspace
22
22
  #
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: {})
23
+ # @overload create(workspace_id, agent_id:, system_prompt_data:, episodic_memory: nil, first_user_message: nil, first_user_message_data: nil, memory_cascade: 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 [Hash{Symbol=>Object}] Arbitrary data for the objective. May be used in liquid templates for prompts co
29
+ # @param system_prompt_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's system_prompt_template
30
30
  #
31
31
  # @param episodic_memory [Cadenya::Models::ObjectiveCreateParams::EpisodicMemory] Episodic is used to configure the episodic memory for the objective
32
32
  #
33
- # @param initial_message [String] Optional override for the initial message sent to the agent. This becomes the fi
33
+ # @param first_user_message [String] Optional explicit first user message for the LLM chat history. When not set,
34
+ #
35
+ # @param first_user_message_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's first_user_message_templat
34
36
  #
35
37
  # @param memory_cascade [Array<Cadenya::Models::MemoryReference>] Memory layers/entries layered over the baseline cascade inherited
36
38
  #
@@ -38,8 +40,6 @@ module Cadenya
38
40
  #
39
41
  # @param secrets [Array<Cadenya::Models::ObjectiveCreateParams::Secret>] Secrets that can be used in the headers for tool calls using the secret interpol
40
42
  #
41
- # @param user_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's user_message_template
42
- #
43
43
  # @param variation_id [String] Optional explicit variation selection. Overrides the agent's variation_selection
44
44
  #
45
45
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -322,6 +322,36 @@ module Cadenya
322
322
  )
323
323
  end
324
324
 
325
+ # Returns the context-usage breakdown measured for the objective's most recent
326
+ # iteration: character lengths per context component (system prompt, memory
327
+ # appendices, tool definitions, messages by role) alongside the iteration's input
328
+ # token counts.
329
+ #
330
+ # @overload retrieve_diagnostics(objective_id, workspace_id:, request_options: {})
331
+ #
332
+ # @param objective_id [String] The ID of the objective. Supports "external_id:" prefix for external IDs.
333
+ #
334
+ # @param workspace_id [String]
335
+ #
336
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
337
+ #
338
+ # @return [Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse]
339
+ #
340
+ # @see Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
341
+ def retrieve_diagnostics(objective_id, params)
342
+ parsed, options = Cadenya::ObjectiveRetrieveDiagnosticsParams.dump_request(params)
343
+ workspace_id =
344
+ parsed.delete(:workspace_id) do
345
+ raise ArgumentError.new("missing required path argument #{_1}")
346
+ end
347
+ @client.request(
348
+ method: :get,
349
+ path: ["v1/workspaces/%1$s/objectives/%2$s/diagnostics", workspace_id, objective_id],
350
+ model: Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse,
351
+ options: options
352
+ )
353
+ end
354
+
325
355
  # Streams events for an objective in real-time using server-sent events (SSE)
326
356
  #
327
357
  # @overload stream_events_streaming(objective_id, workspace_id:, request_options: {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.27.0"
4
+ VERSION = "0.29.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -140,6 +140,7 @@ require_relative "cadenya/models/assistant_tool_call"
140
140
  require_relative "cadenya/models/attribute_filter"
141
141
  require_relative "cadenya/models/bare_metadata"
142
142
  require_relative "cadenya/models/callable_tool"
143
+ require_relative "cadenya/models/context_lengths"
143
144
  require_relative "cadenya/models/context_window_compacted"
144
145
  require_relative "cadenya/models/create_operation_metadata"
145
146
  require_relative "cadenya/models/create_resource_metadata"
@@ -181,6 +182,7 @@ require_relative "cadenya/models/objective_context_window"
181
182
  require_relative "cadenya/models/objective_context_window_data"
182
183
  require_relative "cadenya/models/objective_continue_params"
183
184
  require_relative "cadenya/models/objective_create_params"
185
+ require_relative "cadenya/models/objective_diagnostics"
184
186
  require_relative "cadenya/models/objective_error"
185
187
  require_relative "cadenya/models/objective_event"
186
188
  require_relative "cadenya/models/objective_event_data"
@@ -190,6 +192,8 @@ require_relative "cadenya/models/objective_info"
190
192
  require_relative "cadenya/models/objective_list_context_windows_params"
191
193
  require_relative "cadenya/models/objective_list_events_params"
192
194
  require_relative "cadenya/models/objective_list_params"
195
+ require_relative "cadenya/models/objective_retrieve_diagnostics_params"
196
+ require_relative "cadenya/models/objective_retrieve_diagnostics_response"
193
197
  require_relative "cadenya/models/objective_retrieve_params"
194
198
  require_relative "cadenya/models/objectives/feedback_create_params"
195
199
  require_relative "cadenya/models/objectives/feedback_list_params"
@@ -38,17 +38,6 @@ module Cadenya
38
38
  sig { params(episodic_memory_ttl: Integer).void }
39
39
  attr_writer :episodic_memory_ttl
40
40
 
41
- # InputDataSchema is used for enforcing a data input when objectives are created.
42
- # This is valuable when using liquid formatting in agent variation prompts. Input
43
- # data schema is also valuable when using an agent as a sub-agent, as the schema
44
- # is used as the tool's input parameter schema. If omitted, the sub-agent schema
45
- # will be loaded with a simple "prompt" free text string as its schema.
46
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
47
- attr_reader :input_data_schema
48
-
49
- sig { params(input_data_schema: T::Hash[Symbol, T.anything]).void }
50
- attr_writer :input_data_schema
51
-
52
41
  # Optional output definition for objectives created for this agent. When provided,
53
42
  # Cadenya will append a tool to that will be called by the LLM in use by the
54
43
  # variant to extract information in the format provided here. Use this option when
@@ -59,6 +48,20 @@ module Cadenya
59
48
  sig { params(output_definition: T::Hash[Symbol, T.anything]).void }
60
49
  attr_writer :output_definition
61
50
 
51
+ # SystemPromptDataSchema enforces the shape of system_prompt_data when objectives
52
+ # are created. This is valuable when using liquid formatting in agent variation
53
+ # system prompt templates. The schema is also used when the agent is attached as a
54
+ # sub-agent, as it becomes the tool's input parameter schema. If omitted, the
55
+ # sub-agent schema will be loaded with a simple "prompt" free text string as its
56
+ # schema.
57
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
58
+ attr_reader :system_prompt_data_schema
59
+
60
+ sig do
61
+ params(system_prompt_data_schema: T::Hash[Symbol, T.anything]).void
62
+ end
63
+ attr_writer :system_prompt_data_schema
64
+
62
65
  # The URL that Cadenya will send events for any objective assigned to the agent.
63
66
  sig { returns(T.nilable(String)) }
64
67
  attr_reader :webhook_events_url
@@ -74,8 +77,8 @@ module Cadenya
74
77
  description: String,
75
78
  enable_episodic_memory: T::Boolean,
76
79
  episodic_memory_ttl: Integer,
77
- input_data_schema: T::Hash[Symbol, T.anything],
78
80
  output_definition: T::Hash[Symbol, T.anything],
81
+ system_prompt_data_schema: T::Hash[Symbol, T.anything],
79
82
  webhook_events_url: String
80
83
  ).returns(T.attached_class)
81
84
  end
@@ -95,17 +98,18 @@ module Cadenya
95
98
  # layer's expiry forward by this duration, and stored entries expire this long
96
99
  # after they are written. If not set, episodic memories are retained indefinitely.
97
100
  episodic_memory_ttl: nil,
98
- # InputDataSchema is used for enforcing a data input when objectives are created.
99
- # This is valuable when using liquid formatting in agent variation prompts. Input
100
- # data schema is also valuable when using an agent as a sub-agent, as the schema
101
- # is used as the tool's input parameter schema. If omitted, the sub-agent schema
102
- # will be loaded with a simple "prompt" free text string as its schema.
103
- input_data_schema: nil,
104
101
  # Optional output definition for objectives created for this agent. When provided,
105
102
  # Cadenya will append a tool to that will be called by the LLM in use by the
106
103
  # variant to extract information in the format provided here. Use this option when
107
104
  # you want structured data to be created by your objectives.
108
105
  output_definition: nil,
106
+ # SystemPromptDataSchema enforces the shape of system_prompt_data when objectives
107
+ # are created. This is valuable when using liquid formatting in agent variation
108
+ # system prompt templates. The schema is also used when the agent is attached as a
109
+ # sub-agent, as it becomes the tool's input parameter schema. If omitted, the
110
+ # sub-agent schema will be loaded with a simple "prompt" free text string as its
111
+ # schema.
112
+ system_prompt_data_schema: nil,
109
113
  # The URL that Cadenya will send events for any objective assigned to the agent.
110
114
  webhook_events_url: nil
111
115
  )
@@ -119,8 +123,8 @@ module Cadenya
119
123
  description: String,
120
124
  enable_episodic_memory: T::Boolean,
121
125
  episodic_memory_ttl: Integer,
122
- input_data_schema: T::Hash[Symbol, T.anything],
123
126
  output_definition: T::Hash[Symbol, T.anything],
127
+ system_prompt_data_schema: T::Hash[Symbol, T.anything],
124
128
  webhook_events_url: String
125
129
  }
126
130
  )
@@ -27,22 +27,23 @@ module Cadenya
27
27
  end
28
28
  attr_writer :schedule
29
29
 
30
- # Optional input data passed to the objective. If the agent has an
31
- # input_data_schema, this must satisfy it.
32
- sig { returns(T.nilable(T.anything)) }
33
- attr_reader :data
30
+ # Optional explicit first user message passed to CreateObjective on each fire.
31
+ # Becomes the first user message in the objective's chat history. When unset, the
32
+ # fired objective defers to the selected variation's first_user_message_template.
33
+ sig { returns(T.nilable(String)) }
34
+ attr_reader :first_user_message
34
35
 
35
- sig { params(data: T.anything).void }
36
- attr_writer :data
36
+ sig { params(first_user_message: String).void }
37
+ attr_writer :first_user_message
37
38
 
38
- # Optional initial message passed to CreateObjective on each fire. Becomes the
39
- # first user message in the objective's chat history. When unset, the fired
40
- # objective defers to the selected variation's user_message_template.
41
- sig { returns(T.nilable(String)) }
42
- attr_reader :initial_message
39
+ # Optional data rendered into the variation's first_user_message_template when
40
+ # each fired objective is created. Separate from `system_prompt_data`, which
41
+ # renders the system prompt template.
42
+ sig { returns(T.nilable(T.anything)) }
43
+ attr_reader :first_user_message_data
43
44
 
44
- sig { params(initial_message: String).void }
45
- attr_writer :initial_message
45
+ sig { params(first_user_message_data: T.anything).void }
46
+ attr_writer :first_user_message_data
46
47
 
47
48
  # What to do when the previous run is still in flight. Defaults to SKIP.
48
49
  sig do
@@ -62,14 +63,14 @@ module Cadenya
62
63
  end
63
64
  attr_writer :overlap_policy
64
65
 
65
- # Optional data rendered into the variation's user_message_template when each
66
- # fired objective is created. Separate from `data`, which renders the system
67
- # prompt template.
66
+ # Optional data rendered into the variation's system_prompt_template when each
67
+ # fired objective is created. If the agent has a system_prompt_data_schema, this
68
+ # must satisfy it.
68
69
  sig { returns(T.nilable(T.anything)) }
69
- attr_reader :user_data
70
+ attr_reader :system_prompt_data
70
71
 
71
- sig { params(user_data: T.anything).void }
72
- attr_writer :user_data
72
+ sig { params(system_prompt_data: T.anything).void }
73
+ attr_writer :system_prompt_data
73
74
 
74
75
  # Optional explicit variation. When unset, the agent's variation_selection_mode
75
76
  # chooses per fire.
@@ -83,11 +84,11 @@ module Cadenya
83
84
  sig do
84
85
  params(
85
86
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule::OrHash,
86
- data: T.anything,
87
- initial_message: String,
87
+ first_user_message: String,
88
+ first_user_message_data: T.anything,
88
89
  overlap_policy:
89
90
  Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
90
- user_data: T.anything,
91
+ system_prompt_data: T.anything,
91
92
  variation_id: String
92
93
  ).returns(T.attached_class)
93
94
  end
@@ -96,19 +97,20 @@ module Cadenya
96
97
  # of calendar rules (wall-clock) and/or interval rules (duration), OR'd together.
97
98
  # At least one rule is required.
98
99
  schedule:,
99
- # Optional input data passed to the objective. If the agent has an
100
- # input_data_schema, this must satisfy it.
101
- data: nil,
102
- # Optional initial message passed to CreateObjective on each fire. Becomes the
103
- # first user message in the objective's chat history. When unset, the fired
104
- # objective defers to the selected variation's user_message_template.
105
- initial_message: nil,
100
+ # Optional explicit first user message passed to CreateObjective on each fire.
101
+ # Becomes the first user message in the objective's chat history. When unset, the
102
+ # fired objective defers to the selected variation's first_user_message_template.
103
+ first_user_message: nil,
104
+ # Optional data rendered into the variation's first_user_message_template when
105
+ # each fired objective is created. Separate from `system_prompt_data`, which
106
+ # renders the system prompt template.
107
+ first_user_message_data: nil,
106
108
  # What to do when the previous run is still in flight. Defaults to SKIP.
107
109
  overlap_policy: nil,
108
- # Optional data rendered into the variation's user_message_template when each
109
- # fired objective is created. Separate from `data`, which renders the system
110
- # prompt template.
111
- user_data: nil,
110
+ # Optional data rendered into the variation's system_prompt_template when each
111
+ # fired objective is created. If the agent has a system_prompt_data_schema, this
112
+ # must satisfy it.
113
+ system_prompt_data: nil,
112
114
  # Optional explicit variation. When unset, the agent's variation_selection_mode
113
115
  # chooses per fire.
114
116
  variation_id: nil
@@ -119,11 +121,11 @@ module Cadenya
119
121
  override.returns(
120
122
  {
121
123
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
122
- data: T.anything,
123
- initial_message: String,
124
+ first_user_message: String,
125
+ first_user_message_data: T.anything,
124
126
  overlap_policy:
125
127
  Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
126
- user_data: T.anything,
128
+ system_prompt_data: T.anything,
127
129
  variation_id: String
128
130
  }
129
131
  )
@@ -51,6 +51,18 @@ module Cadenya
51
51
  sig { params(description: String).void }
52
52
  attr_writer :description
53
53
 
54
+ # Liquid template for the first user message of objectives using this variation.
55
+ # Rendered with CreateObjectiveRequest.first_user_message_data into
56
+ # Objective.first_user_message, the first user message in the LLM chat history.
57
+ # CreateObjectiveRequest.first_user_message, when set, overrides the rendered
58
+ # result. If neither this template nor first_user_message is present, objective
59
+ # creation is rejected with InvalidArgument.
60
+ sig { returns(T.nilable(String)) }
61
+ attr_reader :first_user_message_template
62
+
63
+ sig { params(first_user_message_template: String).void }
64
+ attr_writer :first_user_message_template
65
+
54
66
  # ModelConfig defines the model configuration for a variation
55
67
  sig do
56
68
  returns(T.nilable(Cadenya::Agents::AgentVariationSpecModelConfig))
@@ -85,24 +97,14 @@ module Cadenya
85
97
  attr_writer :progressive_discovery
86
98
 
87
99
  # Liquid template for the system prompt of objectives using this variation.
88
- # Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
100
+ # Rendered with CreateObjectiveRequest.system_prompt_data into
101
+ # Objective.system_prompt.
89
102
  sig { returns(T.nilable(String)) }
90
103
  attr_reader :system_prompt_template
91
104
 
92
105
  sig { params(system_prompt_template: String).void }
93
106
  attr_writer :system_prompt_template
94
107
 
95
- # Liquid template for the initial user message of objectives using this variation.
96
- # Rendered with CreateObjectiveRequest.user_data and becomes the first user
97
- # message in the LLM chat history. CreateObjectiveRequest.initial_message, when
98
- # set, overrides the rendered result. If neither this template nor initial_message
99
- # is present, objective creation is rejected with InvalidArgument.
100
- sig { returns(T.nilable(String)) }
101
- attr_reader :user_message_template
102
-
103
- sig { params(user_message_template: String).void }
104
- attr_writer :user_message_template
105
-
106
108
  # Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
107
109
  # Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
108
110
  # means never auto-selected, but can still be chosen explicitly via variation_id
@@ -120,12 +122,12 @@ module Cadenya
120
122
  Cadenya::Agents::AgentVariationSpecCompactionConfig::OrHash,
121
123
  constraints: Cadenya::Agents::AgentVariationSpecConstraints::OrHash,
122
124
  description: String,
125
+ first_user_message_template: String,
123
126
  model_config:
124
127
  Cadenya::Agents::AgentVariationSpecModelConfig::OrHash,
125
128
  progressive_discovery:
126
129
  Cadenya::Agents::AgentVariationSpecProgressiveDiscovery::OrHash,
127
130
  system_prompt_template: String,
128
- user_message_template: String,
129
131
  weight: Integer
130
132
  ).returns(T.attached_class)
131
133
  end
@@ -137,6 +139,13 @@ module Cadenya
137
139
  constraints: nil,
138
140
  # Human-readable description of what this variation does or when it should be used
139
141
  description: nil,
142
+ # Liquid template for the first user message of objectives using this variation.
143
+ # Rendered with CreateObjectiveRequest.first_user_message_data into
144
+ # Objective.first_user_message, the first user message in the LLM chat history.
145
+ # CreateObjectiveRequest.first_user_message, when set, overrides the rendered
146
+ # result. If neither this template nor first_user_message is present, objective
147
+ # creation is rejected with InvalidArgument.
148
+ first_user_message_template: nil,
140
149
  # ModelConfig defines the model configuration for a variation
141
150
  model_config: nil,
142
151
  # ProgressiveDiscovery is used to indicate that the agent should automatically
@@ -146,14 +155,9 @@ module Cadenya
146
155
  # and can help select the best tools for the task.
147
156
  progressive_discovery: nil,
148
157
  # Liquid template for the system prompt of objectives using this variation.
149
- # Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
158
+ # Rendered with CreateObjectiveRequest.system_prompt_data into
159
+ # Objective.system_prompt.
150
160
  system_prompt_template: nil,
151
- # Liquid template for the initial user message of objectives using this variation.
152
- # Rendered with CreateObjectiveRequest.user_data and becomes the first user
153
- # message in the LLM chat history. CreateObjectiveRequest.initial_message, when
154
- # set, overrides the rendered result. If neither this template nor initial_message
155
- # is present, objective creation is rejected with InvalidArgument.
156
- user_message_template: nil,
157
161
  # Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
158
162
  # Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
159
163
  # means never auto-selected, but can still be chosen explicitly via variation_id
@@ -169,11 +173,11 @@ module Cadenya
169
173
  Cadenya::Agents::AgentVariationSpecCompactionConfig,
170
174
  constraints: Cadenya::Agents::AgentVariationSpecConstraints,
171
175
  description: String,
176
+ first_user_message_template: String,
172
177
  model_config: Cadenya::Agents::AgentVariationSpecModelConfig,
173
178
  progressive_discovery:
174
179
  Cadenya::Agents::AgentVariationSpecProgressiveDiscovery,
175
180
  system_prompt_template: String,
176
- user_message_template: String,
177
181
  weight: Integer
178
182
  }
179
183
  )
@@ -0,0 +1,103 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ContextLengths < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ContextLengths, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ # Chat history messages with the assistant role.
12
+ sig { returns(Integer) }
13
+ attr_accessor :assistant_messages
14
+
15
+ # The discoverable/available-tools appendix attached to the system prompt.
16
+ sig { returns(Integer) }
17
+ attr_accessor :available_tools
18
+
19
+ # The episodic memory appendix attached to the system prompt.
20
+ sig { returns(Integer) }
21
+ attr_accessor :episodic_memory
22
+
23
+ # The skills memory appendix attached to the system prompt.
24
+ sig { returns(Integer) }
25
+ attr_accessor :skills_memory
26
+
27
+ # The objective's base system prompt (rendered variation template).
28
+ sig { returns(Integer) }
29
+ attr_accessor :system_prompt
30
+
31
+ # Serialized tool definitions sent with the completion request (names,
32
+ # descriptions, and JSON-schema parameters).
33
+ sig { returns(Integer) }
34
+ attr_accessor :tool_definitions
35
+
36
+ # Tool results present in the chat history.
37
+ sig { returns(Integer) }
38
+ attr_accessor :tool_results
39
+
40
+ # Chat history messages with the user role.
41
+ sig { returns(Integer) }
42
+ attr_accessor :user_messages
43
+
44
+ # ContextLengths is the measured character length of each distinct component of an
45
+ # iteration's assembled context window. Values are raw character lengths of the
46
+ # component as assembled into the request — token estimates are derived by the
47
+ # client against input_tokens (component share = component length / sum of all
48
+ # lengths).
49
+ #
50
+ # New components are added as new fields — wire-compatible; absent components read
51
+ # as 0.
52
+ sig do
53
+ params(
54
+ assistant_messages: Integer,
55
+ available_tools: Integer,
56
+ episodic_memory: Integer,
57
+ skills_memory: Integer,
58
+ system_prompt: Integer,
59
+ tool_definitions: Integer,
60
+ tool_results: Integer,
61
+ user_messages: Integer
62
+ ).returns(T.attached_class)
63
+ end
64
+ def self.new(
65
+ # Chat history messages with the assistant role.
66
+ assistant_messages:,
67
+ # The discoverable/available-tools appendix attached to the system prompt.
68
+ available_tools:,
69
+ # The episodic memory appendix attached to the system prompt.
70
+ episodic_memory:,
71
+ # The skills memory appendix attached to the system prompt.
72
+ skills_memory:,
73
+ # The objective's base system prompt (rendered variation template).
74
+ system_prompt:,
75
+ # Serialized tool definitions sent with the completion request (names,
76
+ # descriptions, and JSON-schema parameters).
77
+ tool_definitions:,
78
+ # Tool results present in the chat history.
79
+ tool_results:,
80
+ # Chat history messages with the user role.
81
+ user_messages:
82
+ )
83
+ end
84
+
85
+ sig do
86
+ override.returns(
87
+ {
88
+ assistant_messages: Integer,
89
+ available_tools: Integer,
90
+ episodic_memory: Integer,
91
+ skills_memory: Integer,
92
+ system_prompt: Integer,
93
+ tool_definitions: Integer,
94
+ tool_results: Integer,
95
+ user_messages: Integer
96
+ }
97
+ )
98
+ end
99
+ def to_hash
100
+ end
101
+ end
102
+ end
103
+ end