embed

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

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

Instance is an embedded Krew agent ready to be invoked in-process.

func New

func New(opts Options) (*Instance, error)

New creates and configures an embedded Krew AI agent instance.

func (*Instance) Agent

func (i *Instance) Agent() *agent.Agent

Agent returns the underlying core agent engine.

func (*Instance) Chat

func (i *Instance) Chat(ctx context.Context, message string) (*agent.Response, error)

Chat continues an existing conversation with a new user message.

func (*Instance) Memory

func (i *Instance) Memory() memory.Memory

Memory returns the agent's memory buffer.

func (*Instance) Registry

func (i *Instance) Registry() *tools.Registry

Registry returns the agent's tool registry.

func (*Instance) Run

func (i *Instance) Run(ctx context.Context, prompt string) (*agent.Response, error)

Run executes a single prompt to completion through the multi-turn reasoning loop.

func (*Instance) RunWithHandler

func (i *Instance) RunWithHandler(ctx context.Context, prompt string, h agent.EventHandler) (*agent.Response, error)

RunWithHandler executes a single prompt streaming events to a custom turn-specific handler.

type Options

type Options struct {
	// Workspace is the working root path for file tools and command execution.
	// Defaults to current working directory if empty.
	Workspace string

	// Persona provides system instructions and role definition.
	// Defaults to persona.CodingAssistant if nil.
	Persona *persona.Persona

	// SystemPrompt optionally overrides the persona instructions.
	SystemPrompt string

	// Provider is the LLM inference provider (Gemini, OpenAI, Anthropic, Ollama, etc.).
	// If nil, New() attempts auto-detection via environment variables.
	Provider ai.Provider

	// Model specifies the target model name (e.g. "gemini-2.5-flash", "gpt-4o", "claude-3-7-sonnet").
	Model string

	// MaxSteps is the safety limit on reasoning-action loops per turn. Default: 25.
	MaxSteps int

	// CustomTools allows adding extra tools beyond the standard workspace tool suite.
	CustomTools []tools.Tool

	// DisableDefaultTools prevents loading standard filesystem, execution, and web tools.
	DisableDefaultTools bool

	// Memory optionally overrides the default sliding-window memory buffer.
	Memory memory.Memory

	// Approver handles interactive approval gates for destructive operations.
	Approver agent.Approver

	// OnEvent receives streaming lifecycle events (thoughts, tool calls, results).
	OnEvent agent.EventHandler
}

Options holds configuration for embedding a Krew agent.

Jump to

Keyboard shortcuts

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