Skip to main content

Overview

An anchor is a hard constraint that can never be violated during flow execution. Unlike soft preferences or validation checks, anchors are inviolable rules enforced by the runtime. Think of them as safety guardrails that the AI cannot cross.

Syntax

Core Concept

Anchors vs. Validation:
Anchors are preventive, validation is corrective.

Fields

require (optional)

Type: Identifier Specifies a required property that must be present in all outputs.
Common Requirements:
  • source_citation — Must cite sources
  • factual_claim — Must be factual (not opinion)
  • structured_output — Must follow schema
  • verified — Must be verified against ground truth
  • complete — Must be complete (no partial answers)

reject (optional)

Type: List of identifiers Conditions that must never appear in outputs.
Common Rejections:
  • speculation — Speculative statements
  • opinion — Subjective opinions
  • harmful — Harmful content
  • offensive — Offensive content
  • illegal — Illegal advice or content
  • private — Private information
  • guessing — Uncertain guesses
  • bias — Biased statements

enforce (optional)

Type: Identifier A policy to enforce throughout execution.

confidence_floor (optional)

Type: Float (range: 0.0 to 1.0) Minimum confidence level required. Below this threshold, the anchor’s unknown_response is returned.
Guidelines by Domain:

unknown_response (optional)

Type: String Response returned when confidence is below the floor or constraints cannot be met.
Best Practices:
  • Be specific about why the anchor prevented a response
  • Guide users toward appropriate alternatives
  • Maintain professional tone
  • Don’t apologize excessively

on_violation (optional)

Type: One of raise, warn, log, escalate, fallback Action to take when the anchor is violated.

Violation Actions

on_violation_target (internal)

For raise and fallback actions, specifies the error name or fallback message.

Complete Examples

No Hallucination Anchor

Use Case: Ensure all factual claims are backed by sources with high confidence.

Safe Content Anchor

Use Case: Prevent generation of harmful, offensive, illegal, or private content.

Medical Disclaimer Anchor

Use Case: Prevent medical diagnosis or prescription, require very high confidence.
Use Case: Provide legal information (not advice) with citations and high confidence.

No Bias Anchor

Use Case: Prevent biased or discriminatory outputs.

Factual Only Anchor

Use Case: Ensure outputs contain only verifiable facts.

Usage with Run Statements

Anchors are applied using the constrained_by modifier:

Multiple Anchors

You can apply multiple anchors to a single flow:
All anchors must be satisfied simultaneously.

Anchors vs. Validation

Example: Both Together

Best Practices

1. Use Anchors for Safety-Critical Constraints

2. Combine Multiple Constraints

3. Provide Helpful Unknown Responses

4. Match Severity to Violation Action

5. Domain-Specific Anchors

Create specialized anchors for different domains:

Common Patterns

Source Citation Requirement

Content Safety

Professional Disclaimer

Audit and Compliance

Type Checking

The AXON type checker validates: Confidence floor: Must be between 0.0 and 1.0
Violation actions: Must be valid actions
Raise targets: If using raise, must specify error name
Anchor references: Referenced anchors must exist
  • Types — Epistemic type system
  • Flow — Build cognitive pipelines
  • Persona — Agent identities
  • Context — Execution environments