Skip to content

llm: add goose CLI provider - #1

Open
yskzalloc wants to merge 1 commit into
sashalevin:mainfrom
yskzalloc:support-goose
Open

yskzalloc wants to merge 1 commit into
sashalevin:mainfrom
yskzalloc:support-goose

Conversation

@yskzalloc

Copy link
Copy Markdown
Contributor

Add a provider that uses the goose CLI agent for inference. goose owns the model backend, so one provider covers every backend goose supports, including local and self-hosted servers such as vLLM and Ollama, without commit-classifier talking to them directly.

The provider runs goose run --no-session --quiet --output-format json --instructions -

feeds the prompt on stdin and collects the assistant text from the JSON transcript goose prints:

  • Text parts of all assistant messages are joined in order, so an agent that talks between tool calls still ends with its verdict.
  • Thinking parts are kept as blocks ahead of the text of their message. Reasoning models such as Qwen3 put the whole analysis there and leave only the verdict in the text part; verdict parsers already skip blocks and saved explanations stay useful. A thinking-only reply is an error.
  • goose error parts and status=error become LlmError::Api.
  • A missing binary is LlmError::Config and is not retried.

Timeouts and retries follow the kiro provider: each run is bounded by timeout_secs (default 600, agent runs with tools can be slow) and retried with exponential backoff from BaseLlmConfig.

All JSON config keys are optional: binary/executable_path, provider, model, builtins (--with-builtin), no_profile (default true, so the user's default goose extensions do not leak into classification), max_turns, cwd, mode (GOOSE_MODE), env and timeout_secs. temperature and max_tokens are forwarded as GOOSE_TEMPERATURE/GOOSE_MAX_TOKENS only when set explicitly, otherwise goose's own settings apply.

cargo test: 74 passed. cargo clippy --all-targets -- -D warnings is clean for the new code; the remaining error is the existing ollama_rs::Ollama::new deprecation.

Add a provider that uses the goose CLI agent for inference. goose
owns the model backend, so one provider covers every backend goose
supports, including local and self-hosted servers such as vLLM and
Ollama, without commit-classifier talking to them directly.

The provider runs

  goose run --no-session --quiet --output-format json --instructions -

feeds the prompt on stdin and collects the assistant text from the
JSON transcript goose prints:

  - Text parts of all assistant messages are joined in order, so an
    agent that talks between tool calls still ends with its verdict.
  - Thinking parts are kept as <think> blocks ahead of the text of
    their message. Reasoning models such as Qwen3 put the whole
    analysis there and leave only the verdict in the text part;
    verdict parsers already skip <think> blocks and saved
    explanations stay useful. A thinking-only reply is an error.
  - goose error parts and status=error become LlmError::Api.
  - A missing binary is LlmError::Config and is not retried.

Timeouts and retries follow the kiro provider: each run is bounded
by timeout_secs (default 600, agent runs with tools can be slow) and
retried with exponential backoff from BaseLlmConfig.

All JSON config keys are optional: binary/executable_path, provider,
model, builtins (--with-builtin), no_profile (default true, so the
user's default goose extensions do not leak into classification),
max_turns, cwd, mode (GOOSE_MODE), env and timeout_secs. temperature
and max_tokens are forwarded as GOOSE_TEMPERATURE/GOOSE_MAX_TOKENS
only when set explicitly, otherwise goose's own settings apply.

cargo test: 74 passed. cargo clippy --all-targets -- -D warnings is
clean for the new code; the remaining error is the existing
ollama_rs::Ollama::new deprecation.

Assisted-by: claude-opus-5.5
Signed-off-by: Yunseong Kim <yunseong.kim@est.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant