governance

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDenied = errors.New("governance: denied")

Functions

func RedactEventPayload added in v0.1.4

func RedactEventPayload(ctx context.Context, redactor OutputRedactor, runID string, typ core.EventType, payload json.RawMessage) json.RawMessage

RedactEventPayload applies the configured output redactor to event payloads before they are emitted to sinks.

Types

type OutputRedaction

type OutputRedaction struct {
	RunID  string
	StepID string
	Kind   string
	Data   json.RawMessage
}

type OutputRedactor

type OutputRedactor interface {
	RedactOutput(ctx context.Context, output OutputRedaction) (json.RawMessage, error)
}

func NewJSONFieldRedactor

func NewJSONFieldRedactor(fields ...string) OutputRedactor

type OutputRedactorFunc

type OutputRedactorFunc func(ctx context.Context, output OutputRedaction) (json.RawMessage, error)

func (OutputRedactorFunc) RedactOutput

func (fn OutputRedactorFunc) RedactOutput(ctx context.Context, output OutputRedaction) (json.RawMessage, error)

type ToolInvocation

type ToolInvocation struct {
	RunID      string
	Agent      string
	Tool       string
	SideEffect core.SideEffectLevel
	Input      json.RawMessage
	// CallCount is the number of prior successful invocations of this tool
	// name in the current autonomous tool loop (used by RateCap and per-tool budgets).
	CallCount int
	// SameInputCalls is the number of prior attempts (success, failure, or
	// governance denial) with the same tool name and canonical input in the
	// current autonomous tool loop. Loop-guard policies should use this field.
	SameInputCalls int
	TotalCalls     int
	Metadata       map[string]string
}

type ToolPolicy

type ToolPolicy interface {
	AuthorizeTool(ctx context.Context, invocation ToolInvocation) error
}

func ChainToolPolicies

func ChainToolPolicies(policies ...ToolPolicy) ToolPolicy

func NewMaxSideEffectPolicy

func NewMaxSideEffectPolicy(max core.SideEffectLevel) ToolPolicy

func NewToolBudgetPolicy

func NewToolBudgetPolicy(maxCalls int) ToolPolicy

type ToolPolicyFunc

type ToolPolicyFunc func(ctx context.Context, invocation ToolInvocation) error

func (ToolPolicyFunc) AuthorizeTool

func (fn ToolPolicyFunc) AuthorizeTool(ctx context.Context, invocation ToolInvocation) error

Jump to

Keyboard shortcuts

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