config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 8 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

Overview

Package config loads Verdict's YAML configuration and turns it into engine options.

Every behaviour DMN specifies a default for uses that default. Every behaviour outside the spec has a documented Verdict default here, and can be overridden. The zero value of Config is the documented default configuration, so a program that never reads a file gets the same behaviour as one that reads an empty one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(c Config) error

Validate reports configuration that cannot be honoured.

Types

type Agent

type Agent struct {
	// Bridge names the bridge to use: "nexus", "http", "mock", or a name
	// registered by the host application. An empty value means the host wires
	// the bridge in code, which is the library-first path.
	Bridge string `yaml:"bridge"`
	// HTTP configures the generic HTTP bridge.
	HTTP AgentHTTP `yaml:"http"`
	// Nexus configures the Nexus-backed bridge. The Verdict core never imports
	// Nexus; these settings are read by the separate verdict/nexus module.
	Nexus AgentNexus `yaml:"nexus"`
}

Agent configures agentDecision evaluation.

type AgentHTTP

type AgentHTTP struct {
	Endpoint string            `yaml:"endpoint"`
	Headers  map[string]string `yaml:"headers"`
	Timeout  Duration          `yaml:"timeout"`
}

AgentHTTP configures the generic HTTP/JSON bridge.

type AgentNexus

type AgentNexus struct {
	// SessionStrategy is "per-decision" (the default), "per-evaluation" or
	// "shared". Per-decision gives each agent node its own isolated session;
	// per-evaluation shares one session across an evaluation, trading isolation
	// for shared context; shared reuses a single long-lived session.
	SessionStrategy string `yaml:"session_strategy"`
	// SessionRetention is how long a session's workspace is kept for forensic
	// replay. Empty means the host's own retention policy applies.
	SessionRetention Duration `yaml:"session_retention"`
	// Channel is the event-bus channel prefix Verdict publishes trace events on.
	Channel string `yaml:"channel"`
}

AgentNexus configures the Nexus-backed bridge.

type Config

type Config struct {
	FEEL       FEEL       `yaml:"feel"`
	Evaluation Evaluation `yaml:"evaluation"`
	Tracing    Tracing    `yaml:"tracing"`
	Agent      Agent      `yaml:"agent"`
	Models     Models     `yaml:"models"`
	Server     Server     `yaml:"server"`
}

Config is the Verdict configuration block.

func Default

func Default() Config

Default returns the documented default configuration.

func Load

func Load(path string) (Config, error)

Load reads a YAML file and merges it over the defaults.

func Parse

func Parse(raw []byte) (Config, error)

Parse merges a YAML document over the defaults.

A document may either nest its settings under a `verdict:` key or supply them at the top level. Both are accepted because a standalone server config file has no reason to nest, while a block embedded in a host application's config does.

func (Config) Options

func (c Config) Options() []verdict.Option

Options turns a configuration into engine options. The agent bridge is not among them: bridges are constructed by the host, because the library must not depend on any particular one.

func (Config) Validate

func (c Config) Validate() error

Validate reports configuration that cannot be honoured.

type Duration

type Duration time.Duration

Duration is a time.Duration that unmarshals from a Go duration string ("30s", "5m") or from a plain number of seconds.

func (Duration) Duration

func (d Duration) Duration() time.Duration

Duration returns the value as a time.Duration.

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (any, error)

MarshalYAML implements yaml.Marshaler.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

The node's YAML tag, not a trial decode, decides how to read it: a scalar `45` decodes into a Go string just as happily as into a float, so trying string first would reject every numeric duration.

type Evaluation

type Evaluation struct {
	// StrictMode refuses to load a model whose static analysis reports an
	// error: an ambiguous hit policy, an uncovered gap under a non-defaulted
	// policy, an expression that does not compile.
	StrictMode bool `yaml:"strict_mode"`
	// DefaultMaxLatency bounds an agent decision that declares no policy of its
	// own. Defaults to 30s; zero in the file means unbounded.
	DefaultMaxLatency Duration `yaml:"default_max_latency"`
	// ParallelIndependentDecisions evaluates independent decisions in the same
	// dependency layer concurrently. Defaults to true.
	ParallelIndependentDecisions *bool `yaml:"parallel_independent_decisions"`
	// Memoize caches referentially transparent nodes within one evaluation.
	// Agent decisions are never memoised.
	Memoize bool `yaml:"memoize"`
	// MaxDepth bounds recursion through decision services. Defaults to 32.
	MaxDepth int `yaml:"max_depth"`
}

Evaluation configures the evaluator.

type FEEL

type FEEL struct {
	// Dialect is "feel" (Conformance Level 3, the default) or "s-feel"
	// (Conformance Level 2). A model that declares its own conformance level
	// overrides this for itself.
	Dialect string `yaml:"dialect"`
	// Timezone is the location `now()`, `today()` and date arithmetic resolve
	// against. Defaults to UTC, because a decision that means something
	// different depending on where it ran is not auditable.
	Timezone string `yaml:"timezone"`
	// MaxIterations is the iteration budget of one request: the total
	// number of elements every `for`, `some` and `every` iteration context
	// of every expression the request evaluates may produce — every decision
	// in the slice, every business knowledge model, boxed function and
	// decision service invocation, every unary test — ranges and lists alike,
	// nested products counted in full. Exceeding it fails the evaluation
	// (VERDICT_EVAL_005), an integer range before anything is allocated.
	// Defaults to 1,000,000. Zero (or omitting
	// the key) means the default; negative is rejected.
	MaxIterations int64 `yaml:"max_iterations"`
}

FEEL configures the expression language.

type File

type File struct {
	Verdict Config `yaml:"verdict"`
}

File is the top-level YAML document. Configuration is nested under a `verdict:` key so a Verdict block can live inside a host application's own configuration file without collision.

type Models

type Models struct {
	// Paths are files or directories to load at startup. Directories are
	// scanned non-recursively for *.dmn, *.xml, *.json and *.vdj.
	//
	// There is deliberately no hot-reload option. Loading is content-addressed
	// and idempotent, so a host that wants reloading can watch files and call
	// LoadModel itself — and a decision model changing under a running service
	// is a deploy event that should go through whatever gate deploys go
	// through, not a convenience the engine grants silently.
	Paths []string `yaml:"paths"`
}

Models configures model loading.

type Server

type Server struct {
	Listen     string `yaml:"listen"`
	TwirpPath  string `yaml:"twirp_path"`
	MCPEnabled *bool  `yaml:"mcp_enabled"`
	// ReadTimeout and WriteTimeout bound a single HTTP request.
	ReadTimeout  Duration `yaml:"read_timeout"`
	WriteTimeout Duration `yaml:"write_timeout"`
}

Server configures `verdict serve`. It is ignored by the library.

type Tracing

type Tracing struct {
	// Mode is "off", "summary" or "full". Defaults to full: the trace is the
	// deliverable, so recording it is the default rather than an opt-in.
	Mode string `yaml:"mode"`
	// RedactInputs names bindings whose values are replaced with a marker in
	// the trace.
	RedactInputs []string `yaml:"redact_inputs"`
}

Tracing configures the execution record.

Jump to

Keyboard shortcuts

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