Skip to main content

Introduction

AXON is a domain-specific language designed for AI agent orchestration. Unlike traditional programming languages, AXON uses cognitive primitives rather than mechanical constructs—there are no loops, variables, or assignments. Instead, you define personas, contexts, flows, and semantic constraints.

File Structure

An AXON program consists of top-level declarations:
// Import statements (optional)
import axon.anchors.{NoHallucination, NoBias}

// Declarations (in any order)
persona LegalExpert { ... }
context LegalReview { ... }
anchor NoHallucination { ... }
type Party { ... }
flow AnalyzeContract(...) { ... }

// Execution
run AnalyzeContract(myContract)
  as LegalExpert
  within LegalReview

Comments

AXON supports single-line comments using //:
// This is a comment
persona Analyst {  // inline comment
  domain: ["finance"]
}

Identifiers

Identifiers follow standard programming conventions:
  • Start with a letter or underscore
  • Contain letters, numbers, and underscores
  • Case-sensitive
  • Examples: MyPersona, legal_expert, _privateFlow

Literals

String Literals

Strings are enclosed in double quotes:
ask: "Extract all parties and obligations"
language: "en"

Numeric Literals

confidence_threshold: 0.85        // Float
max_tokens: 4096                  // Integer
temperature: 0.3                  // Float

Boolean Literals

cite_sources: true
show_work: false

Duration Literals

Durations use numeric values with suffixes:
timeout: 10s    // seconds
timeout: 500ms  // milliseconds
decay: 7d       // days
timeout: 2h     // hours
timeout: 30m    // minutes
Valid suffixes: ms, s, m, h, d

Collections

Lists

Lists are enclosed in square brackets:
// String lists
domain: ["contract law", "IP", "corporate"]

// Identifier lists
constrained_by: [NoHallucination, StrictFactual]
refuse_if: [offensive, harmful]

Structured Types

Structured types use curly braces:
type Party {
  name: FactualClaim,
  role: FactualClaim
}

Operators and Symbols

Delimiters

  • { } — Block delimiters for definitions
  • ( ) — Parameter and argument lists
  • [ ] — List literals and collections

Punctuation

  • : — Field assignment separator
  • , — List and parameter separator
  • . — Dotted references (e.g., Extract.output)
  • ? — Optional type marker (e.g., Opinion?)

Special Operators

  • -> — Function return type or conditional action
  • .. — Range operator (e.g., 0.0..1.0)
  • <> — Generic type parameters (e.g., List<Party>)

Comparison Operators

Used in validation rules and conditionals:
confidence < 0.80      // less than
confidence > 0.90      // greater than
confidence <= 0.85     // less than or equal
confidence >= 0.75     // greater than or equal
value == expected      // equality
value != invalid       // inequality

Declaration Keywords

These keywords introduce top-level declarations:
KeywordPurpose
personaDefine an AI agent identity
contextDefine execution environment
anchorDefine hard constraints
memoryDefine semantic memory store
toolDefine external capability
typeDefine semantic type
flowDefine cognitive pipeline
intentDefine atomic semantic instruction
runExecute a flow
importImport declarations from modules

Flow Control Keywords

These keywords are used within flow definitions:
KeywordPurpose
stepNamed cognitive step
probeTargeted extraction
reasonChain-of-thought reasoning
validateValidation checkpoint
refineAdaptive retry logic
weaveSemantic synthesis
useInvoke external tool
rememberStore to memory
recallRetrieve from memory
if / elseConditional branching

Field Keywords

Common fields used in blocks:
KeywordUsage
givenInput specification
askInstruction or question
outputOutput type specification
forTarget specification (probe)
intoDestination (weave)
againstSchema reference (validate)
aboutTopic specification (reason)
fromSource specification (recall)
whereConstraint predicate

Run Modifiers

Modifiers for run statements:
run AnalyzeContract(myContract)
  as LegalExpert              // persona
  within LegalReview          // context
  constrained_by [...]        // anchors
  on_failure: retry(...)      // error handling
  output_to: "report.json"    // output destination
  effort: high                // effort level

Type Annotations

Basic Types

flow ProcessDoc(doc: Document) -> Summary

Generic Types

output: List<Party>

Optional Types

type Risk {
  score: RiskScore,
  mitigation: Opinion?     // Optional field
}

Range-Constrained Types

type RiskScore(0.0..1.0)

Refined Types

type HighConfidenceClaim where confidence >= 0.85

Dotted References

Reference outputs from previous steps:
step Assess {
  given: Extract.output        // Reference Extract step's output
  ask: "Identify risky clauses"
}

weave [Extract.output, Assess.output] into FinalReport

Expression Patterns

Single References

given: doc
given: previousStep.output

Multiple Inputs

given: [Extract.output, Assess.output]

Bracketed Lists

probe document for [parties, dates, obligations]
weave [EntityMap, RiskAnalysis] into Report

Common Patterns

Define and Execute

// Define the flow
flow Analyze(input: Document) -> Report {
  step Extract { ... }
  step Process { ... }
}

// Execute it
run Analyze(myDocument)
  as Analyst
  within Production

Multi-Step Processing

flow Pipeline(data: Input) -> Output {
  step First {
    given: data
    output: IntermediateA
  }
  
  step Second {
    given: First.output
    output: IntermediateB
  }
  
  step Final {
    given: Second.output
    output: Output
  }
}

Conditional Logic

if confidence < 0.5 -> step Retry { ... }
else -> step Accept { ... }

Style Conventions

Naming Conventions

  • Types and Personas: PascalCase (LegalExpert, RiskScore)
  • Flows and Steps: PascalCase (AnalyzeContract, Extract)
  • Fields and parameters: snake_case (confidence_threshold, max_tokens)
  • Identifiers in lists: lowercase when representing concepts (offensive, harmful)

Formatting

// Use clear indentation
persona Expert {
  domain: ["law"],
  tone: precise
}

// Break long lists across lines
constrained_by: [
  NoHallucination,
  StrictFactual,
  NoBias
]

// Separate logical sections
flow Analyze(doc: Document) -> Report {
  step Extract { ... }
  
  step Process { ... }
  
  step Synthesize { ... }
}

Next Steps

  • Persona — Define AI agent identities
  • Context — Configure execution environments
  • Flow — Build cognitive pipelines
  • Types — Understand AXON’s type system

Build docs developers (and LLMs) love