agent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 3 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 agent defines the boundary between Verdict's deterministic evaluator and whatever answers an agentDecision node.

A bridge is deliberately thin. It receives a rendered prompt, the bound and FEEL-evaluated inputs, and the declared output type; it returns a value. It does not know it is inside a decision graph, does not see the model context, and does not enforce latency or retry — the engine owns all of that, so every bridge gets identical guarantees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge interface {
	// Invoke answers one agent decision. Implementations should respect
	// ctx cancellation; the engine cancels the context when the decision's
	// latency budget expires.
	Invoke(ctx context.Context, req Request) (Response, error)
}

Bridge evaluates an agent decision.

type BridgeFunc

type BridgeFunc func(ctx context.Context, req Request) (Response, error)

BridgeFunc adapts a function to the Bridge interface.

func (BridgeFunc) Invoke

func (f BridgeFunc) Invoke(ctx context.Context, req Request) (Response, error)

Invoke implements Bridge.

type Request

type Request struct {
	// DecisionID is the DRG element the request belongs to, for correlation.
	DecisionID string
	// DecisionName is the human-readable decision name.
	DecisionName string
	// Prompt is the rendered prompt template.
	Prompt string
	// Inputs are the bound, FEEL-evaluated inputs, converted to plain Go values.
	Inputs map[string]any
	// OutputType is the shape the response must conform to.
	OutputType model.TypeSpec
	// Trace lets the bridge record its own steps as children of the agent node.
	Trace trace.Writer
	// SessionHint is the model's optional request to reuse a session. A bridge
	// that has no session concept ignores it.
	SessionHint string
	// Attempt is the zero-based retry attempt. A bridge may use it to vary
	// temperature or to widen its instructions on a retry.
	Attempt int
}

Request is one agent decision's call site, fully bound.

type Response

type Response struct {
	// Value must conform to Request.OutputType. Plain Go values are expected;
	// the engine coerces and validates before binding.
	Value any
	// SessionRef identifies the agent run in the bridge's own world — a Nexus
	// session ID, a provider request ID — and is recorded in the trace so the
	// run stays forensically available after the fact.
	SessionRef string
	// Tokens is optional cost telemetry.
	Tokens TokenAccounting
}

Response is a bridge's answer.

type TokenAccounting

type TokenAccounting struct {
	Input  int `json:"input,omitempty"`
	Output int `json:"output,omitempty"`
	Total  int `json:"total,omitempty"`
	// Model names the model that answered, when the bridge knows it.
	Model string `json:"model,omitempty"`
}

TokenAccounting is optional per-invocation cost telemetry.

Directories

Path Synopsis
Package http provides a generic HTTP/JSON agent bridge, so an agentDecision can be answered by any service that speaks a small, documented envelope — an internal classifier, a model gateway, or a colleague's Python service.
Package http provides a generic HTTP/JSON agent bridge, so an agentDecision can be answered by any service that speaks a small, documented envelope — an internal classifier, a model gateway, or a colleague's Python service.
Package mock provides a deterministic in-memory agent bridge for tests and for running agent-bearing models in CI without an LLM.
Package mock provides a deterministic in-memory agent bridge for tests and for running agent-bearing models in CI without an LLM.

Jump to

Keyboard shortcuts

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