Class: Oz::Resources::Runs

Inherits:
Base
  • Object
show all
Defined in:
lib/oz/resources/runs.rb

Overview

Operations on individual agent runs, reachable via client.agent.runs.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Oz::Resources::Base

Instance Method Details

#cancel(run_id) ⇒ String

Cancel a run that is in progress.

Parameters:

  • run_id (String)

Returns:

  • (String)

    confirmation message returned by the API



32
33
34
# File 'lib/oz/resources/runs.rb', line 32

def cancel(run_id)
  @client.post("/agent/runs/#{enc(run_id)}/cancel")
end

#list(**params) ⇒ Oz::CursorPage

List runs with optional filters. Returns a cursor-paginated page.

Supported filters include: ancestor_run_id, artifact_type, created_after, created_before, creator, cursor, environment_id, execution_location, executor, limit, model_id, name, q, schedule_id, skill, skill_spec, sort_by, sort_order, source, state (an Array of states), and updated_after.

Time-like filters accept either an ISO-8601 String or a Time/Date.

Returns:



24
25
26
27
# File 'lib/oz/resources/runs.rb', line 24

def list(**params)
  body = @client.get('/agent/runs', query: params)
  Oz::CursorPage.new(body, resource: self, params: params, items_key: 'runs')
end

#list_handoff_attachments(run_id) ⇒ Oz::Model

List the attachments produced by a run’s handoff.

Parameters:

  • run_id (String)

Returns:



39
40
41
# File 'lib/oz/resources/runs.rb', line 39

def list_handoff_attachments(run_id)
  model(@client.get("/agent/runs/#{enc(run_id)}/handoff/attachments"))
end

#retrieve(run_id) ⇒ Oz::Model

Retrieve a single run by id.

Parameters:

  • run_id (String)

Returns:



10
11
12
# File 'lib/oz/resources/runs.rb', line 10

def retrieve(run_id)
  model(@client.get("/agent/runs/#{enc(run_id)}"))
end

#submit_followup(run_id, message: nil, mode: nil) ⇒ Oz::Model

Send a follow-up message to a run (e.g. to answer a blocking question or continue the conversation).

Parameters:

  • run_id (String)
  • message (String, nil) (defaults to: nil)

    the follow-up message

  • mode (String, nil) (defaults to: nil)

    “normal”, “plan”, or “orchestrate”

Returns:



49
50
51
52
# File 'lib/oz/resources/runs.rb', line 49

def submit_followup(run_id, message: nil, mode: nil)
  body = compact(message: message, mode: mode)
  model(@client.post("/agent/runs/#{enc(run_id)}/followups", body: body))
end