harness

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package harness orchestrates agent runs with hooks, tools, and session persistence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Harness

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

Harness orchestrates agent loop, session tree, tools, and lifecycle hooks.

func New

func New(opts Options) *Harness

New creates a harness with optional session and router dependencies.

func (*Harness) Agent

func (h *Harness) Agent() *agent.Agent

Agent exposes the underlying stateful agent.

func (*Harness) ContextManager

func (h *Harness) ContextManager() *ctxmgr.Manager

ContextManager exposes the optional context budget manager.

func (*Harness) Hooks

func (h *Harness) Hooks() *hooks.Registry

Hooks exposes the typed hook registry for this harness instance.

func (*Harness) LastRunResult

func (h *Harness) LastRunResult() agentevent.Result

LastRunResult returns the final outcome after Prompt completes, including overflow retries.

func (*Harness) MoveTo

func (h *Harness) MoveTo(ctx context.Context, entryID, summary string) error

MoveTo switches the session leaf, auto-summarizing abandoned branches when configured.

func (*Harness) Prompt

func (h *Harness) Prompt(ctx context.Context, prompts ...agent.AgentMessage) (*agentevent.Stream, error)

Prompt starts an agent run with optional session persistence.

func (*Harness) RegisterTool

func (h *Harness) RegisterTool(t tool.Tool) error

RegisterTool adds a tool to the harness registry.

func (*Harness) Session

func (h *Harness) Session() *session.Session

Session exposes the optional session manager.

func (*Harness) SetActiveTools

func (h *Harness) SetActiveTools(names []string)

SetActiveTools restricts exposed tools for the next run.

func (*Harness) SetModel

func (h *Harness) SetModel(llmModel llms.Model, modelName string)

SetModel updates the active model name.

func (*Harness) SetRunStartedAt added in v0.95.0

func (h *Harness) SetRunStartedAt(start time.Time)

SetRunStartedAt records the wall-clock start of the current run for RunDurationMs persistence.

func (*Harness) SetSystemPrompt

func (h *Harness) SetSystemPrompt(systemPrompt string)

SetSystemPrompt replaces the harness system prompt used on subsequent runs.

func (*Harness) WaitIdle

func (h *Harness) WaitIdle(ctx context.Context) error

WaitIdle blocks until the harness returns to idle after a Prompt run finishes persisting.

type Options

type Options struct {
	AgentOptions   agent.Options
	Session        *session.Session
	Router         *model.Router
	SystemPrompt   string
	ModelName      string
	ContextManager *ctxmgr.Manager
	Hooks          *hooks.Registry
}

Options configures a harness instance.

type Phase

type Phase string

Phase represents the harness lifecycle state.

const (
	// PhaseIdle means no structural or loop operation is running.
	PhaseIdle Phase = "idle"
	// PhaseBusy means an agent loop is in progress.
	PhaseBusy Phase = "busy"
)

Jump to

Keyboard shortcuts

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