class LittleGhost::Harnesses::Request
One unit of work for a harness: the task and the limits it runs under.
LittleGhost::Harnesses::Request.new( prompt: "Add a test for the refund policy lookup.", cwd: "repository", budget_usd: 2, max_turns: 40, timeout: 900 )
cwd is a Workspace path for the process’s working directory. session_id resumes an earlier session of the same harness. model, effort (a reasoning effort level such as medium, for harnesses that support one), and instructions (text added to the tool’s system prompt, or placed before the task when the tool has no such option) are optional. add_dirs lists extra absolute directories a tool may read. budget_usd and max_turns bound the work; timeout bounds wall-clock seconds. environment adds child-process variables and takes precedence over harness defaults. mcp_servers maps a server name to the HTTP URL of a Model Context Protocol server the tool may call, such as a ToolServer behind a relay; without it the tool starts with no MCP servers.
Values that reach the command line are checked so they cannot be read as options.
Attributes
Frozen Array of extra absolute directories the harness may read.
Maximum spend in US dollars, or nil.
Reasoning effort level passed to the harness, or nil for its default.
Frozen Hash of additional child-process variables.
Additional instructions for the harness, or nil.
Maximum agent turns, or nil.
Frozen Hash of MCP server names to HTTP URLs.
The task given to the harness.
Harness session to resume, or nil to start a new one.
Wall-clock limit in seconds.
Public Class Methods
# File lib/little_ghost/harnesses/request.rb, line 90 def initialize(prompt:, cwd: nil, session_id: nil, model: nil, effort: nil, instructions: nil, add_dirs: [], budget_usd: nil, max_turns: nil, timeout: DEFAULT_TIMEOUT, environment: {}, mcp_servers: {}) prompt = String(prompt) raise ArgumentError, "harness prompt must not be empty" if prompt.strip.empty? super( prompt: prompt.dup.freeze, cwd: cwd&.to_s&.dup&.freeze, session_id: identifier(session_id, "session_id"), model: identifier(model, "model"), effort: effort_level(effort), instructions: instructions && String(instructions).dup.freeze, add_dirs: Array(add_dirs).map { |path| directory(path) }.freeze, budget_usd: budget_usd && positive_number(budget_usd, "budget_usd"), max_turns: max_turns && positive_integer(max_turns, "max_turns"), timeout: positive_number(timeout, "timeout"), environment: environment.to_h { |name, value| [String(name).dup.freeze, String(value).dup.freeze] }.freeze, mcp_servers: mcp_servers.to_h { |name, url| [server_name(name), server_url(url)] }.freeze ) end
Builds a validated request. Raises ArgumentError for invalid values.