class LittleGhost::Harnesses::Tool

Lets an Agent delegate a coding task to an external coding-agent tool.

The application chooses which harnesses are available, where each executable lives, where its home directory is created, and placeholder settings. The model supplies only the task, the harness name, an optional session to resume, and a budget and timeout within the configured bounds.

class DelegateCodingTask < LittleGhost::Harnesses::Tool
  tool_name "delegate_coding_task"
  harnesses claude_code: {
    executable: "/opt/harnesses/bin/claude",
    home_root: :scratch,
    defaults: {base_url: "http://127.0.0.1:3130"}
  }
  budget default: 2, maximum: 10
  timeout default: 900, maximum: 3600
end

class SupportEngineerAgent < LittleGhost::Agent
  tools DelegateCodingTask
end

The tool runs the harness in the Run’s Sandbox, or on the host in :native_guards mode when the Tool has no Sandbox, and publishes each :harness StreamEvent to the Run while the harness works; by default tool-call inputs and tool outputs are left out (see harness_event_data). The harness’s tool calls also become :tool Instrumentation operations beneath this call, so traces show the harness’s work step by step. It returns a JSON object with the Result’s status, final text (shortened to 16,000 characters), session, cost, turns, and usage, plus the end of standard error when the task did not complete. Calls are exclusive, so two harnesses never edit the same workspace at once.

Each harness gets one private home directory per Run, created on first use beneath a Workspace path the Sandbox lets processes write and removed when the Run closes. The model may resume only sessions that an earlier call in the same Run started.

#serve_tools lets the harness call tools of the application’s own while it works, through a ToolServer that lives only for that call.

Override build_harness to choose settings per run, and build_request to add instructions, a working directory, or a turn limit.