Class: Telnyx::Resources::AI::Missions::Runs
- Inherits:
-
Object
- Object
- Telnyx::Resources::AI::Missions::Runs
- Defined in:
- lib/telnyx/resources/ai/missions/runs.rb,
lib/telnyx/resources/ai/missions/runs/plan.rb,
lib/telnyx/resources/ai/missions/runs/events.rb,
lib/telnyx/resources/ai/missions/runs/telnyx_agents.rb,
sig/telnyx/resources/ai/missions/runs.rbs,
sig/telnyx/resources/ai/missions/runs/plan.rbs,
sig/telnyx/resources/ai/missions/runs/events.rbs,
sig/telnyx/resources/ai/missions/runs/telnyx_agents.rbs
Defined Under Namespace
Classes: Events, Plan, TelnyxAgents
Instance Attribute Summary collapse
- #events ⇒ Telnyx::Resources::AI::Missions::Runs::Events readonly
- #plan ⇒ Telnyx::Resources::AI::Missions::Runs::Plan readonly
- #telnyx_agents ⇒ Telnyx::Resources::AI::Missions::Runs::TelnyxAgents readonly
Instance Method Summary collapse
-
#cancel_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Cancels a running or paused run and returns the updated run object.
-
#create(mission_id, input: nil, metadata: nil, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Starts a new run of the specified mission and returns the created run object.
-
#initialize(client:) ⇒ Runs
constructor
private
A new instance of Runs.
-
#list(mission_id, page_number: nil, page_size: nil, status: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Missions::MissionRunData>
Returns a paginated list of runs for the specified mission, optionally filtered by run status, so you can track the mission's execution history over time.
-
#list_runs(page_number: nil, page_size: nil, status: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Missions::MissionRunData>
Returns a paginated list of recent runs across every mission in your organization, optionally filtered by run status.
-
#pause_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Pauses a currently running run and returns the updated run object.
-
#resume_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Resumes a previously paused run and returns the updated run object, letting execution continue from where it was paused.
-
#retrieve(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Returns the full details of a single run, including its current status.
-
#update(run_id, mission_id:, error: nil, metadata: nil, result_payload: nil, result_summary: nil, status: nil, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Updates a run's status and/or result and returns the updated run object.
Constructor Details
#initialize(client:) ⇒ Runs
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 Runs.
260 261 262 263 264 265 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 260 def initialize(client:) @client = client @events = Telnyx::Resources::AI::Missions::Runs::Events.new(client: client) @plan = Telnyx::Resources::AI::Missions::Runs::Plan.new(client: client) @telnyx_agents = Telnyx::Resources::AI::Missions::Runs::TelnyxAgents.new(client: client) end |
Instance Attribute Details
#events ⇒ Telnyx::Resources::AI::Missions::Runs::Events (readonly)
9 10 11 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 9 def events @events end |
#plan ⇒ Telnyx::Resources::AI::Missions::Runs::Plan (readonly)
12 13 14 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 12 def plan @plan end |
#telnyx_agents ⇒ Telnyx::Resources::AI::Missions::Runs::TelnyxAgents (readonly)
15 16 17 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 15 def telnyx_agents @telnyx_agents end |
Instance Method Details
#cancel_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Cancels a running or paused run and returns the updated run object. A cancelled run stops executing; start a new run to execute the mission again.
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 157 def cancel_run(run_id, params) parsed, = Telnyx::AI::Missions::RunCancelRunParams.dump_request(params) mission_id = parsed.delete(:mission_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["ai/missions/%1$s/runs/%2$s/cancel", mission_id, run_id], model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |
#create(mission_id, input: nil, metadata: nil, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Starts a new run of the specified mission and returns the created run object. Track its progress through the run detail, plan, and events endpoints.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 33 def create(mission_id, params = {}) parsed, = Telnyx::AI::Missions::RunCreateParams.dump_request(params) @client.request( method: :post, path: ["ai/missions/%1$s/runs", mission_id], body: parsed, model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |
#list(mission_id, page_number: nil, page_size: nil, status: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Missions::MissionRunData>
Returns a paginated list of runs for the specified mission, optionally filtered by run status, so you can track the mission's execution history over time.
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 130 def list(mission_id, params = {}) parsed, = Telnyx::AI::Missions::RunListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["ai/missions/%1$s/runs", mission_id], query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::AI::Missions::MissionRunData, options: ) end |
#list_runs(page_number: nil, page_size: nil, status: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Missions::MissionRunData>
Returns a paginated list of recent runs across every mission in your organization, optionally filtered by run status. Useful for monitoring overall mission activity without querying each mission individually.
188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 188 def list_runs(params = {}) parsed, = Telnyx::AI::Missions::RunListRunsParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "ai/missions/runs", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::AI::Missions::MissionRunData, options: ) end |
#pause_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Pauses a currently running run and returns the updated run object. Execution halts until the run is resumed.
215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 215 def pause_run(run_id, params) parsed, = Telnyx::AI::Missions::RunPauseRunParams.dump_request(params) mission_id = parsed.delete(:mission_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["ai/missions/%1$s/runs/%2$s/pause", mission_id, run_id], model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |
#resume_run(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Resumes a previously paused run and returns the updated run object, letting execution continue from where it was paused.
243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 243 def resume_run(run_id, params) parsed, = Telnyx::AI::Missions::RunResumeRunParams.dump_request(params) mission_id = parsed.delete(:mission_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["ai/missions/%1$s/runs/%2$s/resume", mission_id, run_id], model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |
#retrieve(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Returns the full details of a single run, including its current status. Use this to poll an in-flight run or inspect the outcome of a completed one.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 58 def retrieve(run_id, params) parsed, = Telnyx::AI::Missions::RunRetrieveParams.dump_request(params) mission_id = parsed.delete(:mission_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["ai/missions/%1$s/runs/%2$s", mission_id, run_id], model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |
#update(run_id, mission_id:, error: nil, metadata: nil, result_payload: nil, result_summary: nil, status: nil, request_options: {}) ⇒ Telnyx::Models::AI::Missions::MissionRunResponse
Updates a run's status and/or result and returns the updated run object. Typically used by executing agents to report progress or record the final outcome.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/telnyx/resources/ai/missions/runs.rb', line 97 def update(run_id, params) parsed, = Telnyx::AI::Missions::RunUpdateParams.dump_request(params) mission_id = parsed.delete(:mission_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["ai/missions/%1$s/runs/%2$s", mission_id, run_id], body: parsed, model: Telnyx::AI::Missions::MissionRunResponse, options: ) end |