Help us shape the future of Go! Take the 2026 Go Developer Survey

harness

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package harness assembles middleware, context providers, and history defaults for provider-backed agents.

Pass AgentConfig's result to the normal provider constructor. The harness reuses the agent lifecycle and the provider's tool-invocation middleware. Tracing covers agent runs, function tools, and model calls made by supported model adapters.

Index

Constants

View Source
const DefaultInstructions = `` /* 561-byte string literal not displayed */

DefaultInstructions guides tool use and progress updates.

Variables

This section is empty.

Functions

func AgentConfig

func AgentConfig(settings Config, cfg agent.Config) (agent.Config, error)

AgentConfig adds harness defaults to cfg without modifying its input slices. Call it once for each agent configuration, before the provider constructor.

Caller middleware remains outermost; built-in context providers precede caller providers. Harness instructions precede caller run options. Existing history, message injection, tools and explicit history-conflict settings are retained. Per-service-call history persistence is enabled.

File memory uses a unique persisted working folder per session below WorkingDirectory/agent-file-memory. That subtree is excluded from default skill discovery and resource access. Its handles are cleaned up automatically when the provider is no longer reachable; filememory.Provider.Close can release them earlier.

Provider constructors remain responsible for tool-invocation configuration. Configuration errors from component constructors retain those constructors' panic contracts; filesystem setup failures return an error.

Types

type Config

type Config struct {
	// WorkingDirectory supplies default skills and the agent-file-memory
	// directory. Empty uses the current directory. Relative paths are resolved
	// when AgentConfig is called.
	WorkingDirectory string

	// Instructions replaces DefaultInstructions. Nil uses the defaults.
	// An empty or whitespace-only value omits harness instructions.
	Instructions *string

	DisableTodo       bool
	DisableAgentMode  bool
	DisableFileMemory bool
	DisableSkills     bool
	DisableWebSearch  bool

	// AgentMode configures the mode provider unless DisableAgentMode is true.
	AgentMode agentmode.Config

	// Skills configures the skills provider unless DisableSkills is true.
	// When both Skills.Skills and Skills.Sources are nil, skills are discovered
	// from WorkingDirectory. Non-nil collections replace that default source.
	Skills skills.ContextProviderOptions

	// DisableToolApproval omits standing-approval and auto-approval middleware.
	// It does not remove the provider's approval requirements from tools.
	DisableToolApproval bool
	ToolApproval        toolapproval.Config

	// DisableOpenTelemetry disables agent, tool, and model-call tracing, not
	// feature-usage tracking. When tracing is enabled, OpenTelemetry can
	// independently disable model-call instrumentation.
	DisableOpenTelemetry bool
	OpenTelemetry        otelprovider.MiddlewareConfig
}

Config selects harness components. Its zero value enables the defaults. Agent identity, history, additional tools and providers belong in the agent.Config passed to AgentConfig. Tool-invocation settings remain in the provider constructor's existing configuration.

Directories

Path Synopsis
Package agentmode provides a context provider that tracks the agent's operating mode (e.g.
Package agentmode provides a context provider that tracks the agent's operating mode (e.g.
Package filememory provides a context provider with tools for persistent file-based agent memory.
Package filememory provides a context provider with tools for persistent file-based agent memory.
Package loop provides middleware that re-invokes an agent until one of its evaluators decides no more work is needed.
Package loop provides middleware that re-invokes an agent until one of its evaluators decides no more work is needed.
Package todo provides a context provider that gives agents todo list management tools for tracking work items during long-running complex tasks.
Package todo provides a context provider that gives agents todo list management tools for tracking work items during long-running complex tasks.
Package toolapproval provides middleware that manages human-in-the-loop tool approval with support for "don't ask again" standing rules.
Package toolapproval provides middleware that manages human-in-the-loop tool approval with support for "don't ask again" standing rules.
Package toolautocall provides the middleware that automatically invokes the function tools a model calls and feeds their results back for the next turn.
Package toolautocall provides the middleware that automatically invokes the function tools a model calls and feeds their results back for the next turn.

Jump to

Keyboard shortcuts

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