Skip to content

runSingleShot

runSingleShot(source, _preamble, content, config, resolvers?, command?, agentFactory?): Promise<SingleShotResult>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/runtime/singleShot.ts:56

Ask a question and get an answer from the LLM.

This is the shared, non-interactive single-shot runtime behind both the conversational ask command and the scripted exec command (prompt-as-script). The command argument is forwarded to the agent so it can pick the right mode prompt (e.g. exec-mode for exec).

string

The source of the question (used for file naming)

string

Deprecated/ignored (BATCH-13): the agent composes the system prompt itself; see the body comment. Retained positionally so existing callers need no change.

string

The content of the question

GthConfig

The resolved config

AgentResolvers

Optional agent resolvers (tools/middleware)

GthCommand = 'ask'

The originating command (defaults to ask); selects the agent mode prompt

GthAgentFactory

Optional backend factory (B5). When omitted the runner uses its built-in lean GthLangChainAgent default (unchanged behavior for existing callers). The app layer passes resolveAgentFactory(config, 'lean') so an explicit agent.backend is honored.

Promise<SingleShotResult>

A SingleShotResult: ok is true when the run completed without error, false when it failed (so callers such as exec can set a non-zero exit code); answer/tokensInput/ tokensOutput/tools carry the SUT’s answer text and run stats for callers that need them (e.g. gth batch/gth eval).