agentcli

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package agentcli implements the LLM gateway by shelling out to a coding-agent CLI in print mode, so every model call is billed to the operator's existing subscription rather than requiring an API key.

Every flag the CLI needs lives in this file. CLI churn is a known risk, and the fake-binary test in this package is what pins the flag set.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCLI = errors.New("agentcli: no supported agent CLI found on PATH")

ErrNoCLI is returned when no supported agent CLI is on PATH.

Functions

func Detect

func Detect() (string, error)

Detect finds a supported agent CLI on PATH.

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is a subscription-backed LLM gateway.

func New

func New(o Options) (*Gateway, error)

New returns a gateway backed by the given CLI.

func (*Gateway) Complete

func (g *Gateway) Complete(ctx context.Context, r llm.Req) (llm.Res, error)

Complete implements llm.Gateway.

func (*Gateway) ModelFor

func (g *Gateway) ModelFor(c llm.ModelClass) string

ModelFor implements llm.Gateway. When StrongModel/FastModel were left unset, run passes no --model flag (see run) and the CLI picks its own default — this gateway never observes what that default resolved to, so it returns "" rather than guess. It only reports a model when the operator configured one explicitly.

type Options

type Options struct {
	Binary      string
	StrongModel string
	FastModel   string
	Cache       llm.Cache
	Timeout     time.Duration
	// MaxRetries bounds retries of transient API errors. Transient upstream
	// overload is common enough that zero retries will lose a long eval.
	MaxRetries int
	// Sleep is the backoff hook, overridden in tests so they do not wait.
	Sleep func(time.Duration)
}

Options configures the gateway.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL