cadenya 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 223bf6181a9de37bd24bf02abb889e1473bb6ed030913e6bde182a41d2fa8e68
4
- data.tar.gz: e57f24e581cb8015bccb16a788c9693f93c8c64cd8b1c501016e559033a0b711
3
+ metadata.gz: f5648f64510c4220cdd7bbe9ad1c9d1f05b49640af22106da25282673c37510d
4
+ data.tar.gz: 288d867f32173e26da0c449830fc32f48eaa8e610ba825439a26dc8c4cc3e60e
5
5
  SHA512:
6
- metadata.gz: 3bd3b1fd7aa13a95d4d77b2e1d75328b181e4d5bb9001b32422c5737ca48335cb222817a5ebae7205573b71537ca2e88282c05ad775c5d150d9cb60418d23fbb
7
- data.tar.gz: 71e1e7f8e34ec480611fa8eda3a27fc623b83d5857d2d4110750905f4fa47974dda6cf5a8d9f9f2f1bc3c5abbef7328730ea696fb545ce53786cf67c51a86499
6
+ metadata.gz: b77e5f294970813230c90859e0e0efbd5b6ff056c30b0a56ef56f5f77fe10d6e33038ec7bf780e6b8d8afa719271333a07e16d7ef588ba7df59944524c4d5ed4
7
+ data.tar.gz: 21d63e6814ad922be197ebf9e198f320eadd93f412f0a6c3127e81b7ef0040c8f20a573bacc54cd70dde1a69db69f42361ca4e19c8f9e32190d27a2772c33ffc
data/api.md CHANGED
@@ -136,7 +136,7 @@ client.workspace_admin.remove_member(profile_id, workspace_id: nil) # => nil
136
136
  Retrieves the profile for the credentials accessing the API
137
137
 
138
138
  ```ruby
139
- client.profiles.whoami() # => Cadenya::Types::Profile
139
+ client.profiles.whoami() # => Cadenya::Types::WhoamiResponse
140
140
  ```
141
141
 
142
142
  ## client.workspaces
@@ -147,6 +147,54 @@ List workspaces
147
147
  client.workspaces.list(limit: nil, cursor: nil, sort_order: nil, include_info: nil, labels: nil) # => Cadenya::Page of Cadenya::Types::Workspace
148
148
  ```
149
149
 
150
+ ## client.agent_pools
151
+
152
+ List agent pools
153
+
154
+ ```ruby
155
+ client.agent_pools.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, state: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::AgentPool
156
+ ```
157
+ Create a new agent pool
158
+
159
+ ```ruby
160
+ client.agent_pools.create(metadata:, spec:, workspace_id: nil) # => Cadenya::Types::AgentPool
161
+ ```
162
+ Get an agent pool by ID
163
+
164
+ ```ruby
165
+ client.agent_pools.retrieve(id, workspace_id: nil) # => Cadenya::Types::AgentPool
166
+ ```
167
+ Delete an agent pool
168
+
169
+ ```ruby
170
+ client.agent_pools.delete(id, workspace_id: nil) # => nil
171
+ ```
172
+ Update an agent pool
173
+
174
+ ```ruby
175
+ client.agent_pools.update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::AgentPool
176
+ ```
177
+ Activate an agent pool
178
+
179
+ ```ruby
180
+ client.agent_pools.activate(id, workspace_id: nil) # => Cadenya::Types::AgentPool
181
+ ```
182
+ Archive an agent pool
183
+
184
+ ```ruby
185
+ client.agent_pools.archive(id, workspace_id: nil) # => Cadenya::Types::AgentPool
186
+ ```
187
+ Deactivate an agent pool
188
+
189
+ ```ruby
190
+ client.agent_pools.deactivate(id, workspace_id: nil) # => Cadenya::Types::AgentPool
191
+ ```
192
+ Unarchive an agent pool
193
+
194
+ ```ruby
195
+ client.agent_pools.unarchive(id, workspace_id: nil) # => Cadenya::Types::AgentPool
196
+ ```
197
+
150
198
  ## client.agents
151
199
 
152
200
  List agents
@@ -433,7 +481,7 @@ client.objectives.list(workspace_id: nil, limit: nil, cursor: nil, agent_id: nil
433
481
  Create a new objective
434
482
 
435
483
  ```ruby
436
- client.objectives.create(agent_id:, system_prompt_data:, workspace_id: nil, variation_id: nil, metadata: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil) # => Cadenya::Types::Objective
484
+ client.objectives.create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil) # => Cadenya::Types::Objective
437
485
  ```
438
486
  Get an objective by ID
439
487
 
@@ -470,6 +518,16 @@ Submit feedback for an objective
470
518
  ```ruby
471
519
  client.objectives.create_feedback(objective_id, metadata:, data:, workspace_id: nil) # => Cadenya::Types::ObjectiveFeedback
472
520
  ```
521
+ List objective queued actions
522
+
523
+ ```ruby
524
+ client.objectives.list_queued_actions(objective_id, workspace_id: nil, limit: nil, cursor: nil, state: nil) # => Cadenya::Page of Cadenya::Types::ObjectiveQueuedAction
525
+ ```
526
+ Remove a queued action
527
+
528
+ ```ruby
529
+ client.objectives.remove_queued_action(objective_id, queued_action_id:, workspace_id: nil) # => Cadenya::Types::ObjectiveQueuedAction
530
+ ```
473
531
  List objective tool calls
474
532
 
475
533
  ```ruby
@@ -508,12 +566,22 @@ client.objectives.cancel(objective_id, workspace_id: nil, reason: nil) # => Cade
508
566
  Compact an objective
509
567
 
510
568
  ```ruby
511
- client.objectives.compact(objective_id, workspace_id: nil, compaction_config: nil) # => Cadenya::Types::CompactObjectiveResponse
569
+ client.objectives.compact(objective_id, workspace_id: nil, compaction_config: nil) # => Cadenya::Types::ObjectiveQueuedAction
512
570
  ```
513
571
  Continue an objective
514
572
 
515
573
  ```ruby
516
- client.objectives.continue(objective_id, message:, workspace_id: nil, enqueue: nil) # => Cadenya::Types::ObjectiveEvent
574
+ client.objectives.continue(objective_id, message:, workspace_id: nil, enqueue: nil) # => Cadenya::Types::ContinueObjectiveResponse
575
+ ```
576
+ Interrupt an objective
577
+
578
+ ```ruby
579
+ client.objectives.interrupt(objective_id, workspace_id: nil) # => Cadenya::Types::ObjectiveEvent
580
+ ```
581
+ Create an objective and stream its events
582
+
583
+ ```ruby
584
+ client.objectives.create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil) # => Cadenya::Stream
517
585
  ```
518
586
 
519
587
  ## client.tool_search
@@ -8,7 +8,7 @@ module Cadenya
8
8
  # The Cadenya API client. Resource groups are readers; unset options are
9
9
  # read from the environment.
10
10
  class Client
11
- attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
11
+ attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
12
12
 
13
13
  def initialize(api_key: nil, base_url: nil, webhook_secret: nil, max_retries: 0, connection: nil, stream_transport: nil, workspace_id: nil)
14
14
  if !api_key.nil? && api_key.to_s.strip.empty?
@@ -37,7 +37,7 @@ module Cadenya
37
37
  auth_header: ["Authorization", "Bearer #{api_key}"],
38
38
  max_retries: max_retries,
39
39
  defaults: defaults,
40
- user_agent: "cadenya-ruby/1.3.0 (api 1.0)",
40
+ user_agent: "cadenya-ruby/1.5.0 (api 1.0)",
41
41
  connection: connection,
42
42
  stream_transport: stream_transport
43
43
  )
@@ -46,6 +46,7 @@ module Cadenya
46
46
  @workspace_admin = Resources::WorkspaceAdmin.new(core)
47
47
  @profiles = Resources::Profiles.new(core)
48
48
  @workspaces = Resources::Workspaces.new(core)
49
+ @agent_pools = Resources::AgentPools.new(core)
49
50
  @agents = Resources::Agents.new(core)
50
51
  @ai_provider_keys = Resources::AiProviderKeys.new(core)
51
52
  @models = Resources::Models.new(core)
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by redwood. DO NOT EDIT.
4
+
5
+ module Cadenya
6
+ module Resources
7
+ class AgentPools
8
+ def initialize(core)
9
+ @core = core
10
+ end
11
+
12
+ # List agent pools
13
+ def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, state: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
14
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
15
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools"
16
+ _query = {
17
+ "limit" => limit,
18
+ "cursor" => cursor,
19
+ "prefix" => prefix,
20
+ "query" => query,
21
+ "state" => state,
22
+ "labels" => labels,
23
+ "sortOrder" => sort_order,
24
+ "includeInfo" => include_info,
25
+ }
26
+ _data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
27
+ _items = (_data["items"] || []).map { |item| Types::AgentPool.from_json(item) }
28
+ _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
29
+ Page.new(_items, _next_cursor) do |_c|
30
+ list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, state: state, labels: labels, sort_order: sort_order, include_info: include_info, request_options: request_options)
31
+ end
32
+ end
33
+
34
+ # Create a new agent pool
35
+ def create(metadata:, spec:, workspace_id: nil, request_options: nil)
36
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
37
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools"
38
+ _body = {
39
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(metadata),
40
+ "spec" => spec.nil? ? nil : (->(_v) { Types.encode_AgentPoolSpec(_v) }).call(spec),
41
+ }.reject { |_k, v| v.nil? }
42
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
43
+ Types::AgentPool.from_json(_data)
44
+ end
45
+
46
+ # Get an agent pool by ID
47
+ def retrieve(id, workspace_id: nil, request_options: nil)
48
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
49
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}"
50
+ _data = @core.request(:get, _path, request_options: request_options)
51
+ Types::AgentPool.from_json(_data)
52
+ end
53
+
54
+ # Delete an agent pool
55
+ def delete(id, workspace_id: nil, request_options: nil)
56
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
57
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}"
58
+ @core.request(:delete, _path, expects_body: false, request_options: request_options)
59
+ nil
60
+ end
61
+
62
+ # Update an agent pool
63
+ def update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
64
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
65
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}"
66
+ _body = {
67
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateResourceMetadata(_v) }).call(metadata),
68
+ "spec" => spec.nil? ? nil : (->(_v) { Types.encode_AgentPoolUpdateSpec(_v) }).call(spec),
69
+ "updateMask" => update_mask,
70
+ }.reject { |_k, v| v.nil? }
71
+ _data = @core.request(:patch, _path, body: _body, request_options: request_options)
72
+ Types::AgentPool.from_json(_data)
73
+ end
74
+
75
+ # Activate an agent pool
76
+ def activate(id, workspace_id: nil, request_options: nil)
77
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
78
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}:activate"
79
+ _data = @core.request(:post, _path, request_options: request_options)
80
+ Types::AgentPool.from_json(_data)
81
+ end
82
+
83
+ # Archive an agent pool
84
+ def archive(id, workspace_id: nil, request_options: nil)
85
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
86
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}:archive"
87
+ _data = @core.request(:post, _path, request_options: request_options)
88
+ Types::AgentPool.from_json(_data)
89
+ end
90
+
91
+ # Deactivate an agent pool
92
+ def deactivate(id, workspace_id: nil, request_options: nil)
93
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
94
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}:deactivate"
95
+ _data = @core.request(:post, _path, request_options: request_options)
96
+ Types::AgentPool.from_json(_data)
97
+ end
98
+
99
+ # Unarchive an agent pool
100
+ def unarchive(id, workspace_id: nil, request_options: nil)
101
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
102
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agent_pools/#{Util.path_param('id', id)}:unarchive"
103
+ _data = @core.request(:post, _path, request_options: request_options)
104
+ Types::AgentPool.from_json(_data)
105
+ end
106
+ end
107
+ end
108
+ end
@@ -38,7 +38,7 @@ module Cadenya
38
38
  end
39
39
 
40
40
  # Create a new objective
41
- def create(agent_id:, system_prompt_data:, workspace_id: nil, variation_id: nil, metadata: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, request_options: nil)
41
+ def create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, request_options: nil)
42
42
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
43
43
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives"
44
44
  _body = {
@@ -155,6 +155,31 @@ module Cadenya
155
155
  Types::ObjectiveFeedback.from_json(_data)
156
156
  end
157
157
 
158
+ # List objective queued actions
159
+ def list_queued_actions(objective_id, workspace_id: nil, limit: nil, cursor: nil, state: nil, request_options: nil)
160
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
161
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/queued_actions"
162
+ _query = {
163
+ "limit" => limit,
164
+ "cursor" => cursor,
165
+ "state" => state,
166
+ }
167
+ _data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
168
+ _items = (_data["items"] || []).map { |item| Types::ObjectiveQueuedAction.from_json(item) }
169
+ _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
170
+ Page.new(_items, _next_cursor) do |_c|
171
+ list_queued_actions(objective_id, workspace_id: workspace_id, limit: limit, cursor: _c, state: state, request_options: request_options)
172
+ end
173
+ end
174
+
175
+ # Remove a queued action
176
+ def remove_queued_action(objective_id, queued_action_id:, workspace_id: nil, request_options: nil)
177
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
178
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/queued_actions/#{Util.path_param('queuedActionId', queued_action_id)}:remove"
179
+ _data = @core.request(:post, _path, request_options: request_options)
180
+ Types::ObjectiveQueuedAction.from_json(_data)
181
+ end
182
+
158
183
  # List objective tool calls
159
184
  def list_tool_calls(objective_id, workspace_id: nil, limit: nil, cursor: nil, status: nil, include_info: nil, execution_status: nil, labels: nil, request_options: nil)
160
185
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
@@ -248,7 +273,7 @@ module Cadenya
248
273
  "compactionConfig" => compaction_config.nil? ? nil : (->(_v) { Types.encode_AgentVariationSpec_CompactionConfig(_v) }).call(compaction_config),
249
274
  }.reject { |_k, v| v.nil? }
250
275
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
251
- Types::CompactObjectiveResponse.from_json(_data)
276
+ Types::ObjectiveQueuedAction.from_json(_data)
252
277
  end
253
278
 
254
279
  # Continue an objective
@@ -260,8 +285,42 @@ module Cadenya
260
285
  "enqueue" => enqueue,
261
286
  }.reject { |_k, v| v.nil? }
262
287
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
288
+ Types.decode_ContinueObjectiveResponse(_data)
289
+ end
290
+
291
+ # Interrupt an objective
292
+ def interrupt(objective_id, workspace_id: nil, request_options: nil)
293
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
294
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}:interrupt"
295
+ _data = @core.request(:post, _path, request_options: request_options)
263
296
  Types::ObjectiveEvent.from_json(_data)
264
297
  end
298
+
299
+ # Create an objective and stream its events
300
+ def create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil, request_options: nil)
301
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
302
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives:stream"
303
+ _body = {
304
+ "agentId" => agent_id,
305
+ "variationId" => variation_id,
306
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAndStreamObjectiveRequest_Metadata(_v) }).call(metadata),
307
+ "systemPromptData" => system_prompt_data,
308
+ "firstUserMessage" => first_user_message,
309
+ "secrets" => secrets.nil? ? nil : (->(_v) { _v.is_a?(Array) ? _v.map { |_i| (->(_v) { Types.encode_CreateObjectiveRequest_Secret(_v) }).call(_i) } : _v }).call(secrets),
310
+ "memoryCascade" => memory_cascade.nil? ? nil : (->(_v) { _v.is_a?(Array) ? _v.map { |_i| (->(_v) { Types.encode_MemoryReference(_v) }).call(_i) } : _v }).call(memory_cascade),
311
+ "firstUserMessageData" => first_user_message_data,
312
+ "episodicMemory" => episodic_memory.nil? ? nil : (->(_v) { Types.encode_ObjectiveEpisodicConfig(_v) }).call(episodic_memory),
313
+ "tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
314
+ "subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
315
+ "pinnedParameters" => pinned_parameters,
316
+ }.reject { |_k, v| v.nil? }
317
+ _headers = last_event_id ? { "Last-Event-ID" => last_event_id } : nil
318
+ _decoder = ->(event) { Types.decode_CreateAndStreamObjectiveResponse(event) }
319
+ _auto_reconnect = !(request_options && request_options[:reconnect] == false)
320
+ Stream.new(_decoder, last_event_id: last_event_id, skip_events: ["ping", "open"], auto_reconnect: _auto_reconnect) do |_cancel, _resume, &on_chunk|
321
+ @core.stream_request(:post, _path, body: _body, headers: (_resume ? { "Last-Event-ID" => _resume } : nil), request_options: request_options, cancel: _cancel, &on_chunk)
322
+ end
323
+ end
265
324
  end
266
325
  end
267
326
  end
@@ -13,7 +13,7 @@ module Cadenya
13
13
  def whoami(request_options: nil)
14
14
  _path = "/v1/whoami"
15
15
  _data = @core.request(:get, _path, request_options: request_options)
16
- Types::Profile.from_json(_data)
16
+ Types::WhoamiResponse.from_json(_data)
17
17
  end
18
18
  end
19
19
  end