eval

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRuntime

type AgentRuntime struct {
	Model   string
	Version string
}

AgentRuntime holds the model and version of the agent making the request.

type Consequence

type Consequence struct {
	Type value.ConsequenceType

	// Monetary variant
	Amount   float64
	Currency string

	// Risk rating variant
	RiskRating value.RiskRating

	// Reversibility
	Reversible            bool
	ReversalWindowSeconds int
}

Consequence represents the submitted impact of a decision request. Only one variant should be populated depending on Type.

type DecisionRequest

type DecisionRequest struct {
	// Idempotency scoping (schema v2.1)
	RequestSource string // Source system identifier (e.g., "loan-origination", "payments-api")
	RequestID     string // Idempotent request ID within the source

	SurfaceID   string
	AgentID     string
	Confidence  float64
	Consequence *Consequence
	Context     map[string]any

	// Governance metadata
	ActionType string
	ActionDesc string
	AgentKind  string
	ExpiresAt  string
	Runtime    *AgentRuntime
	Delegation *Delegation
	Subject    *Subject
}

DecisionRequest represents the input to the authority evaluation engine.

type Delegation

type Delegation struct {
	InitiatedBy     string
	SessionID       string
	Chain           []string
	Scope           []string
	AuthorizedAt    string
	AuthorizedUntil string
}

Delegation holds delegation chain claims submitted with the request.

type Outcome

type Outcome string

Outcome is the top-level result of an authority evaluation.

const (
	OutcomeAccept               Outcome = "accept"
	OutcomeEscalate             Outcome = "escalate"
	OutcomeReject               Outcome = "reject"
	OutcomeRequestClarification Outcome = "request_clarification"
)

type ReasonCode

type ReasonCode string

ReasonCode explains why a particular outcome was reached. These values form part of the evaluation contract.

const (
	// Accept reasons
	ReasonWithinAuthority ReasonCode = "WITHIN_AUTHORITY"

	// Escalation reasons
	ReasonConfidenceBelowThreshold ReasonCode = "CONFIDENCE_BELOW_THRESHOLD"
	ReasonConsequenceExceedsLimit  ReasonCode = "CONSEQUENCE_EXCEEDS_LIMIT"
	ReasonPolicyDeny               ReasonCode = "POLICY_DENY"
	ReasonPolicyError              ReasonCode = "POLICY_ERROR"

	// Reject reasons
	ReasonAgentNotFound               ReasonCode = "AGENT_NOT_FOUND"
	ReasonSurfaceNotFound             ReasonCode = "SURFACE_NOT_FOUND"
	ReasonSurfaceInactive             ReasonCode = "SURFACE_INACTIVE"
	ReasonNoActiveGrant               ReasonCode = "NO_ACTIVE_GRANT"
	ReasonProfileNotFound             ReasonCode = "PROFILE_NOT_FOUND"
	ReasonGrantProfileSurfaceMismatch ReasonCode = "GRANT_PROFILE_SURFACE_MISMATCH"

	// Request clarification reasons
	ReasonInsufficientContext ReasonCode = "INSUFFICIENT_CONTEXT"
)

type Subject

type Subject struct {
	Type         string
	ID           string
	SecondaryIDs map[string]string
}

Subject identifies the entity the governed action acts upon.

Jump to

Keyboard shortcuts

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