Class: Lemans::Agents::Miniswen

Inherits:
Lemans::Agent 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"
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 Lemans::Agent

#model, #profile

Instance Method Summary collapse

Methods inherited from Lemans::Agent

#initialize, #install, #name

Constructor Details

This class inherits a constructor from Lemans::Agent

Instance Method Details

#run(task, environment) ⇒ Object



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

def run(task, environment)
  run_result = obtain_result(task, environment)
  trajectory = trajectory_for(run_result)

  # A failed model call is still an answer: the trial saves the
  # trajectory as evidence before failing.
  return Response.new(trajectory:, raw_result:, error: run_result.error) if run_result.status == :error

  Response.new(
    outcome: Result::Outcome.new(OUTCOME_FOR_STATUS.fetch(run_result.status), detail_for(run_result)),
    usage: usage_for(run_result),
    trajectory:,
    raw_result:
  )
end