Class: Cadenya::Resources::Objectives::ToolCalls
- Inherits:
-
Object
- Object
- Cadenya::Resources::Objectives::ToolCalls
- Defined in:
- lib/cadenya/resources/objectives/tool_calls.rb,
sig/cadenya/resources/objectives/tool_calls.rbs
Instance Method Summary collapse
-
#approve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved.
-
#deny(tool_call_id, workspace_id:, objective_id:, memo: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallDenyParams for more details.
-
#initialize(client:) ⇒ ToolCalls
constructor
private
A new instance of ToolCalls.
-
#list(objective_id, workspace_id:, cursor: nil, execution_status: nil, include_info: nil, limit: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveToolCall>
Some parameter documentations has been truncated, see Models::Objectives::ToolCallListParams for more details.
-
#retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCallWithResult
Retrieves a single tool call, including the content the tool returned.
-
#set_content(tool_call_id, workspace_id:, objective_id:, content:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallSetContentParams for more details.
Constructor Details
#initialize(client:) ⇒ ToolCalls
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ToolCalls.
223 224 225 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 223 def initialize(client:) @client = client end |
Instance Method Details
#approve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 105 def approve(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallApproveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s:approve", workspace_id, objective_id, tool_call_id ], model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#deny(tool_call_id, workspace_id:, objective_id:, memo: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallDenyParams for more details.
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as denied. Use a memo to steer the LLM to a different decision or usage of the tool.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 150 def deny(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallDenyParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s:deny", workspace_id, objective_id, tool_call_id ], body: parsed, model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#list(objective_id, workspace_id:, cursor: nil, execution_status: nil, include_info: nil, limit: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveToolCall>
Some parameter documentations has been truncated, see Models::Objectives::ToolCallListParams for more details.
Lists all tool calls for an objective
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 72 def list(objective_id, params) parsed, = Cadenya::Objectives::ToolCallListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/workspaces/%1$s/objectives/%2$s/tool_calls", workspace_id, objective_id], query: query.transform_keys(execution_status: "executionStatus", include_info: "includeInfo"), page: Cadenya::Internal::CursorPagination, model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCallWithResult
Retrieves a single tool call, including the content the tool returned. Media content (images, audio) is served as short-lived signed URLs.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 23 def retrieve(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s", workspace_id, objective_id, tool_call_id ], model: Cadenya::Objectives::ObjectiveToolCallWithResult, options: ) end |
#set_content(tool_call_id, workspace_id:, objective_id:, content:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallSetContentParams for more details.
For bare tool calls (tool sets with no execution adapter), sets the content an external API consumer supplies for the call — used for human-in-the-loop tools and reverse harnesses that execute tools locally and report results back.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 196 def set_content(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallSetContentParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s:setContent", workspace_id, objective_id, tool_call_id ], body: parsed, model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |