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(objective_id, tool_call_id, workspace_id: nil, 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(objective_id, tool_call_id, workspace_id: nil, 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: nil, cursor: nil, execution_status: nil, include_info: nil, labels: 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(objective_id, tool_call_id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCallWithResult
Retrieves a single tool call, including the content the tool returned.
-
#set_content(objective_id, tool_call_id, content:, workspace_id: nil, 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.
209 210 211 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 209 def initialize(client:) @client = client end |
Instance Method Details
#approve(objective_id, tool_call_id, workspace_id: nil, 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.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 103 def approve(objective_id, tool_call_id, params = {}) parsed, = Cadenya::Objectives::ToolCallApproveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id 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(objective_id, tool_call_id, workspace_id: nil, 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.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 144 def deny(objective_id, tool_call_id, params = {}) parsed, = Cadenya::Objectives::ToolCallDenyParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id 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: nil, cursor: nil, execution_status: nil, include_info: nil, labels: 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
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 70 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 @client.workspace_id 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(objective_id, tool_call_id, workspace_id: nil, 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 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 23 def retrieve(objective_id, tool_call_id, params = {}) parsed, = Cadenya::Objectives::ToolCallRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id 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(objective_id, tool_call_id, content:, workspace_id: nil, 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.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 186 def set_content(objective_id, tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallSetContentParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id 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 |