Class: Lemans::Agents::Miniswen

Inherits:
Base
  • Object
show all
Defined in:
lib/lemans/agents/miniswen.rb

Overview

The harness adapter for Miniswen::Agent. The loop runs harness-side, so there is nothing to install and no model API in the sandbox allowlist.

Direct Known Subclasses

MiniswenInstalled

Constant Summary collapse

NAME =
"miniswen"
TRAJECTORY_FILENAME =
"trajectory.json"
OUTCOME_FOR_STATUS =
{
  submitted: :completed,
  # A model that never produced a runnable command failed the task; the
  # verifier verifies whatever tree it left behind.
  format_error: :completed,
  content_filter: :completed,
  step_limit: :step_limit_reached,
  time_limit: :agent_timeout,
  cost_limit: :cost_ceiling_reached
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#model, #profile

Instance Method Summary collapse

Methods inherited from Base

#initialize, #install, #name

Constructor Details

This class inherits a constructor from Lemans::Agents::Base

Instance Method Details

#call(environment, task:, logs_dir:) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lemans/agents/miniswen.rb', line 25

def call(environment, task:, logs_dir:)
  result = obtain_result(environment, task: task, logs_dir: logs_dir)
  trajectory_path = write_trajectory(logs_dir, result)

  raise ::Miniswen::InfrastructureError, result.error if result.status == :error

  Result.new(
    outcome: Results::Outcome.new(OUTCOME_FOR_STATUS.fetch(result.status), detail: detail_for(result)),
    usage: usage_for(result),
    trajectory: trajectory_path
  )
end