Class: Telnyx::Resources::AI::Missions::Runs::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/missions/runs/plan.rb,
sig/telnyx/resources/ai/missions/runs/plan.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Plan

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 Plan.

Parameters:



176
177
178
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 176

def initialize(client:)
  @client = client
end

Instance Method Details

#add_steps_to_plan(run_id, mission_id:, steps:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::Runs::PlanStepsCreatedResponse

Add one or more steps to an existing plan

Parameters:

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 85

def add_steps_to_plan(run_id, params)
  parsed, options = Telnyx::AI::Missions::Runs::PlanAddStepsToPlanParams.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/plan/steps", mission_id, run_id],
    body: parsed,
    model: Telnyx::AI::Missions::Runs::PlanStepsCreatedResponse,
    options: options
  )
end

#create(run_id, mission_id:, steps:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::Runs::PlanStepsCreatedResponse

Creates the initial plan for the specified run from the provided steps and returns the created plan steps. Progress is subsequently reported by updating individual steps.

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 26

def create(run_id, params)
  parsed, options = Telnyx::AI::Missions::Runs::PlanCreateParams.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/plan", mission_id, run_id],
    body: parsed,
    model: Telnyx::AI::Missions::Runs::PlanStepsCreatedResponse,
    options: options
  )
end

#get_step_details(step_id, mission_id:, run_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::Runs::PlanStepResponse

Returns the details of a single plan step within a run's plan, including its status.

Parameters:

  • step_id (String)

    Unique identifier of the step.

  • mission_id (String)

    Unique identifier of the mission.

  • run_id (String)

    Unique identifier of the run.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 116

def get_step_details(step_id, params)
  parsed, options = Telnyx::AI::Missions::Runs::PlanGetStepDetailsParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  run_id =
    parsed.delete(:run_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["ai/missions/%1$s/runs/%2$s/plan/steps/%3$s", mission_id, run_id, step_id],
    model: Telnyx::AI::Missions::Runs::PlanStepResponse,
    options: options
  )
end

#retrieve(run_id, mission_id:, request_options: {}) ⇒ Telnyx::Models::AI::Missions::Runs::PlanRetrieveResponse

Returns the plan for the specified run, including all plan steps and their statuses, so you can see how the mission was decomposed and how far execution has progressed.

Parameters:

  • run_id (String)

    Unique identifier of the run.

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 56

def retrieve(run_id, params)
  parsed, options = Telnyx::AI::Missions::Runs::PlanRetrieveParams.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/plan", mission_id, run_id],
    model: Telnyx::Models::AI::Missions::Runs::PlanRetrieveResponse,
    options: options
  )
end

#update_step(step_id, mission_id:, run_id:, metadata: nil, status: nil, request_options: {}) ⇒ Telnyx::Models::AI::Missions::Runs::PlanStepResponse

Updates the status of a single plan step and returns the updated step. Typically called by the executing agent as it works through the plan.

Parameters:

  • step_id (String)

    Path param: Unique identifier of the step.

  • mission_id (String)

    Path param: Unique identifier of the mission.

  • run_id (String)

    Path param: Unique identifier of the run.

  • metadata (Hash{Symbol=>Object})

    Body param

  • status (Symbol, Telnyx::Models::AI::Missions::Runs::StepStatus)

    Body param

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/telnyx/resources/ai/missions/runs/plan.rb', line 154

def update_step(step_id, params)
  parsed, options = Telnyx::AI::Missions::Runs::PlanUpdateStepParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  run_id =
    parsed.delete(:run_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["ai/missions/%1$s/runs/%2$s/plan/steps/%3$s", mission_id, run_id, step_id],
    body: parsed,
    model: Telnyx::AI::Missions::Runs::PlanStepResponse,
    options: options
  )
end