agent

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinTools map[string]api.ToolSpec = map[string]api.ToolSpec{
	"Read":   toolbox.ReadFileTool,
	"Edit":   toolbox.ModifyFile,
	"Write":  toolbox.WriteFileTool,
	"Grep":   toolbox.GrepTool,
	"Glob":   toolbox.GlobTool,
	"Bash":   toolbox.BashTool,
	"Python": toolbox.PythonTool,
}

Functions

func ExecuteToolCalls

func ExecuteToolCalls(calls []api.ToolCall, available []api.ToolSpec, sandboxCfg *sandbox.ToolSandboxConfig) ([]api.ToolResult, error)

ExecuteToolCalls executes each of the provided api.ToolCalls by shelling out to `lmcli tool <name> <json>`, returning api.ToolResults. When sandboxCfg is non-nil and enabled, each invocation is wrapped in bwrap.

func ExecuteWithConfirmations added in v0.6.0

func ExecuteWithConfirmations(
	toolCalls []api.ToolCall,
	confirmations []api.ToolConfirmation,
	toolbox []api.ToolSpec,
	sandboxCfg *sandbox.ToolSandboxConfig,
) ([]api.ToolResult, bool, error)

ExecuteWithConfirmations executes approved tool calls and builds rejection results for unapproved ones, returning results in original tool call order. Returns true if all tools were rejected.

func RequestCompletion added in v0.6.0

func RequestCompletion(
	ctx context.Context,
	params api.RequestParameters,
	messages []api.Message,
	events chan<- api.Event,
)

RequestCompletion runs a single completion step: one LLM call, streaming chunks and delivering the final response (which may contain tool calls) on the events channel. The events channel is closed when the step ends. Cancelling ctx stops the step at the earliest opportunity.

Tool execution and iteration are handled by the caller.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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