O-Lang Protocol Specification v1.1

Protocol: O-Lang/1.1
Status: Stable — Open for Review (Clarifications Only)
Audience: Runtime implementers, SDK authors, platform & systems engineers
License: Apache 2.0
⚠️ Note: This project is unrelated to the esoteric "O Language" used for code golf (hosted at o.readthedocs.io).
O-lang is an open protocol for governed AI and automation workflows across health, government, IoT, finance, and other regulated domains.

1. Purpose & Philosophy

1.1 The Autonomy Crisis in AI Systems

Current AI architectures grant unbounded autonomy to agents and LLMs. Developers construct workflows that:

  • execute arbitrary code with full system permissions
  • make decisions without audit trails or policy constraints
  • bypass governance through embedded orchestration logic
  • produce non-reproducible, non-deterministic outcomes

This creates unacceptable risk in regulated environments (healthcare, finance, government) where AI decisions impact human lives, compliance, and legal liability.

1.2 From Agents to Governance

The industry is transitioning from autonomous agents to governable systems. O-Lang enables this shift by establishing a runtime governance boundary that separates AI intent from execution authority:

  • Intent ≠ Execution — Workflows declare what should happen; the kernel governs whether and how it may execute
  • Policy Mediation — Every capability invocation is mediated by the kernel against explicit allow-lists, constraints, and resolver contracts — never trusted
  • Observable Meaning — Symbol validity, undefined references, and semantic violations are surfaced as structured, auditable events — never hidden or fabricated
  • Deterministic Auditability — Identical inputs produce identical execution traces across all compliant kernels, enabling regulatory verification and forensic replay

This boundary ensures that AI systems remain governable, certifiable, and institutionally trustworthy — even when using non-deterministic components like LLMs.

1.3 The Governance Gap

Existing orchestration frameworks (LangChain, LlamaIndex, etc.) operate inside application code, where:

  • developer authority = execution authority
  • tools inherit permissions implicitly
  • no runtime enforcement layer exists
  • compliance is retrofitted, not built-in

O-Lang closes this gap by providing a runtime-enforced governance boundary that exists outside application code.

1.4 What O-Lang Provides

O-Lang defines a portable protocol for:

  • Portable execution format — Workflows are language-agnostic, versionable, and human-readable
  • Runtime-enforced policy boundaryCapabilities are explicitly allowed, never trusted
  • Capability invocation contract — Standardized I/O, sandboxing, and error handling across all capabilities
  • Semantic enforcement of workflow meaning — Symbols must exist in reality, not just in intent

O-Lang does not execute business logic.
It governs how logic is invoked, constrained, observed, and audited — transforming AI from autonomous agents to governable, certifiable systems.

1.5 Trust vs Conformance

O-Lang distinguishes between conformance and trust:

  • Conformance validates that a resolver declaration adheres to the O-Lang Resolver Contract (inputs, outputs, steps, failures).
  • Trust is established by the runtime kernel, which enforces policy, validates capability behavior, and mediates all external interactions.

A resolver may be conformant but not trusted — certification of entire packages (including runtime behavior) is a separate governance layer beyond static conformance.

1.6 Key Definitions

The following terms have specific meanings in the context of the O-Lang Protocol:

  • Kernel: A semantic runtime that parses workflows, enforces policy, validates capabilities, and emits auditable execution traces. It is not an executor of business logic.
  • Workflow: A declarative, human-readable document that defines a sequence of steps, inputs, outputs, and failure modes. It is a semantic contract, not a script.
  • Capability: An external, executable component (e.g., @o-lang/notify-telegram) that performs side effects (e.g., HTTP calls, LLM inference). Capabilities are explicitly allowed but never trusted by the kernel.
  • Resolver (Conformance Context): A conformant workflow that adheres to the O-Lang Resolver Contract (Section 14). It is a static declaration with defined inputs, outputs, steps, and failures. This is what is validated by the official test harness.
  • Symbol: A named value referenced in a workflow. Symbols include inputs, step outputs (Save as), emitted values, and persisted data. A symbol is either defined (exists in reality) or undefined (referenced but not produced) — never null or empty.

These definitions supersede colloquial or implementation-specific usage.

2. Core Concepts

2.1 Kernel (Normative)

The Kernel is a semantic runtime, not an executor.

It is responsible for:

  • parsing workflows
  • validating capability eligibility
  • enforcing execution policy
  • tracking symbol lifecycles
  • detecting semantic violations
  • producing auditable outputs
A kernel MUST NOT:
  • embed domain logic
  • infer missing values
  • silently ignore failures
  • bypass capability restrictions

2.2 Workflow

A Workflow is a semantic contract, not a script.

Characteristics:

  • deterministic step order
  • immutable inputs
  • symbol-tracked outputs
  • stateless execution
  • observable failure modes

Example:

Workflow "HR Summary" with policy_query, user_id
Allow resolvers:
- doc-search
- llm-groq
- notify-telegram
Step 1: Ask doc-search "{policy_query}" Save as doc
Step 2: Ask llm-groq "Summarize for staff:
{doc.text}" Save as summary
Step 3: Notify {user_id} using Telegram Save as notification
Return summary

This workflow demonstrates:

  • Deterministic order: Steps execute sequentially
  • Immutable inputs: policy_query and user_id are read-only
  • Symbol-tracked outputs: doc, summary, and notification are explicitly declared via Save as
  • Observable failure: If llm-groq fails, summary remains undefined — the kernel surfaces this as a semantic violation
  • Stateless execution: No global state; all context flows through symbols

Note on typing: Input types are inferred from usage context or declared in the compiled resolver contract. The workflow syntax prioritizes readability; type safety is enforced at conformance time.

2.3 Capability

A Capability is an external executable boundary.

Capabilities may be:

  • HTTP services
  • local binaries
  • containers
  • edge services
  • IoT hardware interfaces

Capabilities are never trusted.
All capability results are validated by the kernel, not assumed correct.

2.4 Concrete Domain Example: Healthcare Resource Allocation

Scenario: An AI triage system proposes allocating ICU beds during a public health emergency.

Step Action Kernel Enforcement Audit Trace
1 AI proposes: AllocateICU(patient_id="P789", urgency="critical") Kernel checks: Is AllocateICU in Allow resolvers? {"step":1, "action":"AllocateICU", "policy":"allowed"}
2 Resolver executes: Validates patient exists, ICU capacity > 0 Kernel validates output structure: { approved: boolean, reason?: string } {"step":2, "symbols_produced":["allocation"], "output":{"approved":false,"reason":"NO_CAPACITY"}}
3 Workflow attempts: Notify family: "ICU approved" Kernel detects: ${allocation.approved} == false → blocks notification {"step":3, "error":"UNRESOLVED_PLACEHOLDERS", "symbol":"allocation.approved"}

Outcome: Non-compliant action (notification without approval) is blocked. Full audit trail generated. No silent failure.

This example demonstrates O-Lang’s core value: runtime governance separates AI intent from execution authority. The AI may propose actions, but the kernel enforces policy before any real-world effect occurs.

3. Syntax Grammar and Keywords (Normative)

O-Lang workflows MUST conform to the Linear Declarative Workflow Form (LDWF): a line-oriented, human-readable, machine-strict format.

3.1 General Syntax Rules

  • Whitespace is insignificant except within quoted strings
  • All keywords are case-insensitive but conventionally capitalized
  • Blank lines MUST separate logical sections and steps
  • Indentation is semantic-neutral and MUST NOT affect parsing
  • One intent per line (e.g., Save as x, not Save as x and notify)
Normative Language:

The keywords MUST, MUST NOT, SHOULD, MAY, and OPTIONAL are interpreted per RFC 2119.

3.2 Workflow Declaration

Workflow "<name>" [with <input>[, <input>]*]
  • <name>: quoted string
  • <input>: workflow input symbol (alphanumeric)
  • Inputs are immutable and available in initial context

3.3 Allowed Resolvers Block

Allow resolvers:
- <capability-name>
[ - <capability-name> ]*
  • MUST appear once, after Workflow
  • Only listed capabilities may be invoked
  • Capability names are normalized identifiers

3.4 Step Declaration

Steps are declared sequentially. Step numbers are optional but, if used, MUST be monotonically increasing positive integers.

[Step <n>:] <action> [Save as <symbol>]
  • Blank lines MUST separate steps
  • <symbol> is normalized to alphanumeric + underscore

Action Types

Kernels MUST support the following action forms:

FormDescription
Ask <target> "<prompt>"Natural-language capability invocation
Use <resolver> [with <json-object>]Structured capability call
Debrief <agent> with "<message>"Human-in-the-loop escalation
Evolve <resolver> using feedback: "<text>"Capability self-improvement directive
Prompt user to "<question>"Interactive user input request
Persist <symbol> to "<path>"Declarative persistence
Emit "<event>" with <payload>Event emission

3.5 Control Flow

Conditional Blocks

If <condition>:
<step-or-action>+
[Else:
<step-or-action>+]
EndIf
  • <condition>: comparison involving system-provided symbols only (e.g., {score} > 80)
  • User-defined symbols MAY be used in conditions (updated from v1.0)
  • Blocks MUST be explicitly closed with EndIf

Parallel Execution

Run in parallel [for <duration>]:
<step-or-action>+
End
  • <duration>: number + unit (s, m, h, d)
  • Context is snapshotted before block entry

Escalation Chains

Run in parallel with escalation:
Level 1: [Immediately | Within <duration>]
<step-or-action>+
Level 2: Within <duration>
<step-or-action>+
End
  • Reserved for multi-level timeout escalation
  • Kernels MUST parse but MAY treat as standard parallel blocks in v1.1

3.6 Constraints

Global or per-step constraints define execution parameters:

Constraint: max_generations = <number>
# Within a step:
Step 1: Ask LLM "..."
Constraint: temperature=0.7
Constraint: tools=["search", "calc"]
  • Constraints are key-value pairs
  • Values may be strings, numbers, or JSON arrays

3.7 Return Statement

Return <symbol>[, <symbol>]*
  • Declares workflow outputs
  • Referenced symbols MUST be produced by steps

3.8 Formatting & Linting (Normative)

  • Step numbers, if present, MUST be monotonically increasing
  • Blank lines MUST separate steps and logical sections
  • Workflows violating structural rules MUST be rejected by kernels
  • Style violations (e.g., inconsistent resolver naming) SHOULD warn but not fail

4. Semantic Execution Model (Normative)

4.1 Symbols

A symbol is any named value referenced in a workflow:

  • inputs
  • step outputs (Save as)
  • emitted values
  • persisted values

Symbols are tracked explicitly by the kernel.

4.2 Symbol Lifecycle

Declared / Referenced
↓
Produced by Capability
↓
Available in Context
↓
Consumed or Persisted
↓
Observed or Missing

4.3 Semantic Enforcement Rules

The kernel MUST:
  • detect when a symbol is referenced but undefined
  • prevent persistence of undefined symbols
  • halt execution with UNRESOLVED_PLACEHOLDERS if a placeholder references an undefined symbol
  • never fabricate missing values

Undefined ≠ null ≠ empty.

4.4 Fail-Fast Execution Semantics (Normative)

O-Lang enforces fail-fast semantics by default. If a step fails to produce a required symbol, any subsequent step that references that symbol will halt with a UNRESOLVED_PLACEHOLDERS error.

Example:

  • Step A succeeds → produces account_info
  • Step B fails → account_info remains undefined
  • Step C references ${account_info.balance} → kernel halts with UNRESOLVED_PLACEHOLDERS

This ensures workflows never proceed with corrupted or incomplete state.

4.5 Explicit Partial Success (Normative)

Workflows may implement explicit partial success using conditional guards:

If account_info.exists:
  Step 2: Ask llm "Balance is ${account_info.balance}"
Else:
  Step 3: Notify admin "Account not found"
EndIf

In this pattern:

  • Step 1 always executes
  • Step 2 executes only if account_info.exists is truthy
  • Step 3 executes only if the condition fails
The kernel MUST:
  • evaluate conditions against current context
  • skip steps whose conditions fail
  • execute only one branch of an If/Else block

All execution paths are explicit, auditable, and policy-governed — never implicit or hidden.

4.6 Determinism Boundary (Normative)

Determinism in O-Lang is defined as follows: Given identical:

  • workflow definition (including step order, conditions, and Allow resolvers list),
  • initial context (input symbols and values),
  • resolver implementations (same versions, same behavior on same inputs),

all compliant kernels MUST produce:

  • identical symbol lifecycles (defined vs. undefined),
  • equivalent execution traces (step outcomes, policy decisions, error codes),
  • identical final output structure.

Content-level non-determinism (e.g., LLM-generated text) is permitted, but structural determinism (which symbols exist, where failures occur, which resolvers run) MUST be preserved. Resolvers that are non-deterministic MUST declare deterministic: false in their metadata.

4.7 Kernel Execution Invariant: Canonical Action Form (Normative)

The kernel MUST canonicalize surface syntax (Ask, Use) into execution form (Action) BEFORE dispatching to resolvers.

The kernel MUST:
  • Transform Ask <resolver> ...Action <resolver> ...
  • Transform Use <resolver> ...Action <resolver> ...
  • Preserve resolver boundary integrity (exactly one space after Action)
  • Reject non-canonical actions with explicit error BEFORE resolver dispatch
The kernel MUST NOT:
  • Pass surface syntax (Ask ...) directly to resolvers
  • Allow resolver name bleed (e.g., "resolver-a resolver-b")
  • Silently recover from malformed actions

Rationale: Resolvers are implementation details that should not parse workflow syntax. Canonical form enables deterministic execution traces, prevents resolver coupling to evolving DSL syntax, and enables safe external resolver protocols (HTTP endpoints expect Action prefix).

Violation: Kernel MUST throw [O-Lang INTERNAL] error before resolver dispatch if invariant broken. This indicates a kernel bug, not workflow authoring error.

4.8 State Transition Semantics (Normative)

O-Lang workflows execute as a discrete-state transition system:

  • State: A finite map S = { symbol₁ → value₁, ..., symbolₙ → valueₙ } representing the current context.
  • Transition function: δ : S × Step → S ∪ Error
    • Each step consumes the current state S and produces a new state S' by adding resolved symbols (via Save as) or halting on error.
    • No step mutates existing symbols; all updates are monotonic additions.
  • Initial state: S₀ = { input₁ → value₁, ..., inputₖ → valueₖ }
  • Final state: S_final after last step, filtered by Return clause.

Key properties:

  • Monotonicity: S ⊆ S' — symbols are never removed or overwritten.
  • Isolation: Parallel steps operate on snapshots of S, not shared mutable state.
  • Observability: Every transition is logged in the execution trace.

5. Parallel and Timed Execution Semantics (Normative)

5.1 Parallel Block Lifecycle

  1. Kernel snapshots current context
  2. Launches all steps in block concurrently
  3. Waits up to <duration> (if specified)
  4. Cancels any incomplete steps after timeout
  5. Merges only successfully resolved symbols into post-block context
  6. Sets timed_out = true if any step was cancelled

Concurrency model: Parallel steps execute logically simultaneously but physically asynchronously. The kernel guarantees:

  • No shared mutable state between steps (each receives an immutable snapshot of context),
  • Deterministic merge order (symbols merged in declaration order, not completion order),
  • Bounded execution (timeout enforces liveness).

Thus, parallel execution is deterministic if and only if all invoked resolvers are deterministic.

5.2 Symbol Merge Rules

  • Resolved symbol: included in final context
  • Unresolved symbol: discarded (not set to null or undefined)
  • Partially failed block: still progresses to next workflow step
  • No implicit error propagation: failure is observable but not exceptional

5.3 Escalation Chains (Reserved)

Syntax is reserved for multi-level timeout escalation. Not part of v1.1 core, but kernels MUST ignore unknown block types gracefully.

6. Capability Contract and Multi-Language Support

6.1 Capability Invocation

Capabilities are invoked via function-call syntax:

medical-api("{symptoms}") Save as diagnosis
  • Kernel resolves function name against Allow capabilities list
  • If not allowed, kernel skips step and logs policy violation

6.2 Input/Output Contract

  • Input: JSON-serializable context subset (only referenced symbols)
  • Output: Single JSON value or error
  • No side effects outside declared and kernel-permitted boundaries

6.3 Multi-Language Implementation

Capabilities may be implemented in any language that can:

  • Read JSON input from stdin or HTTP request
  • Write JSON output to stdout or HTTP response
  • Exit with code 0 (success) or non-zero (failure)

Examples:

  • Python: HTTP resolver with Flask/FastAPI
  • JavaScript: Node.js subprocess or HTTP endpoint
  • Rust: Native binary accepting JSON over stdin
  • Go: gRPC or REST service
  • Shell: Script that reads $1 as JSON and outputs result

6.4 Kernel-Capability Interface

Kernels MUST support at least one of:

  • HTTP: POST /resolve with JSON payload
  • Subprocess: spawn binary with JSON arg
  • In-process: language-native function call (for embedded use)

Security note: Kernels operating in secure mode MUST restrict capability interfaces to sandboxed channels (e.g., HTTP-only). In-process execution is permitted only in development or trusted environments.

The choice of interface is implementation-defined — the protocol only specifies what is called, not how.

6.5 Capability Declaration (Normative)

Every capability MUST expose a static declaration document describing its behavior.

{
"id": "capability.health.triage",
"intents": ["diagnose"],
"input_schema": {
"symptoms": "string[]"
},
"output_schema": {
"risk_level": "string"
},
"constraints": {
"jurisdiction": ["NG"]
}
}
  • Declarations MUST be static and machine-readable
  • Kernels MUST validate capability behavior against its declaration
  • Undeclared behavior is a semantic violation

6.6 Resolver Safety Contract (Normative)

Context: A resolver is any external component (database, API, sensor, LLM, or custom service) that produces values for workflow symbols. In conventional systems, resolvers are called tools (LangChain), nodes (n8n), or functions (OpenAI). In O-lang, resolvers execute outside the kernel and must honor explicit failure semantics — never fabricating data or silently falling back to hardcoded values when inputs are invalid.

Resolvers MUST honor explicit failure semantics — never fabricating data or silently falling back to hardcoded values when inputs are invalid.

Resolvers MUST:
  • Fail explicitly with structured errors when inputs are missing/invalid
  • Include actionable diagnostics (paths, expected schema, working directory)
  • Preserve determinism: same inputs → same outputs (including errors)
  • Treat each invocation as atomic: Either return a valid output or a structured error — never partial success, silent fallbacks, or side effects on failure.
Resolvers MUST NOT:
  • Return fabricated/hardcoded data when databases/files are missing
  • Silently fall back to demo/test data without explicit opt-in
  • Mask infrastructure errors (missing files, schema mismatches) as business logic errors
  • Implement implicit/internal retry logic that conceals transient failures (timeouts, partial responses) before returning results or errors
  • Return fallback values after exhausting internal retries — retry policy belongs exclusively to the explicit workflow layer

Rationale: Silent fallbacks turn configuration errors into data corruption errors. They violate determinism, destroy auditability, and create unacceptable risk in safety-critical domains (finance, healthcare, government).

Example violation (implicit retry + fallback): Resolver receives valid customer_id: 12345 → DB times out → resolver internally retries 3× → still fails → returns hardcoded balance: 5000 with no error. Execution trace shows balance: DEFINED — failure is structurally invisible.

Compliant pattern (explicit workflow retry): Resolver fails immediately on first timeout → returns DATABASE_TIMEOUT → kernel halts with balance: UNDEFINED → workflow's explicit Loop count=3 directive commands retry → trace shows attempt_1: UNDEFINED, attempt_2: UNDEFINED, attempt_3: DEFINED (2500). All retry decisions are auditable and bounded.

See Appendix A for detailed execution trace comparison and cross-domain applicability.

7. Runtime Observability

This warning:
Cannot persist undefined value from "medical_summary"

Means:

  • The symbol existed in intent
  • It did NOT exist in reality
  • The kernel refused to lie

This is semantic truth enforcement.

In most frameworks:
this would silently write null, "", or crash later.

O-Lang makes meaning observable.

7.1 Execution Trace Contract (Normative)

Kernels MUST emit structured, machine-readable execution traces.

{
"workflow": "string",
"intent": "string",
"step": "number | null",
"capability": "string | null",
"symbols_produced": ["symbol"],
"symbols_missing": ["symbol"],
"policy_decision": "allowed | blocked | skipped",
"timestamp": "ISO-8601",
"trace_id": "opaque-string"
}
  • Trace fields MUST be semantically equivalent across kernels
  • Trace emission MUST NOT be optional
  • Traces MUST correspond to actual execution events

8. Security Model

O-Lang directly addresses the Confused Deputy Problem (Hardy, 1988).

Why orchestration-in-code fails:

  • execution authority == developer authority
  • tools inherit permissions implicitly
  • no runtime enforcement layer

O-Lang solution:

  • workflow intent ≠ execution authority
  • capabilities explicitly allowed
  • kernel mediates every invocation

Capabilities never gain power they weren't granted.

9. Error Semantics (Normative)

All errors emitted by the kernel MUST be structured and classified.

{
"code": "SYMBOL_UNDEFINED",
"message": "Symbol medical_summary was referenced but never produced",
"step": 4
}

9.1 Standard Error Codes

  • INVALID_OLANG
  • UNDECLARED_CAPABILITY
  • POLICY_VIOLATION
  • CAPABILITY_FAILURE
  • SYMBOL_UNDEFINED
  • TIMEOUT
  • SEMANTIC_VIOLATION
  • Error codes MUST NOT vary across implementations
  • Error messages MAY vary
  • Errors MUST be emitted at the semantic level, not as raw exceptions

10. IoT & Edge Architecture

[ Sensor / Actuator ]
↓
[ Edge Capability ]
↓
[ O-Lang Kernel ]
↓
[ Policy / Audit / Control Plane ]

Why O-Lang fits IoT better than code orchestration:

  • offline-safe
  • deterministic replay
  • hardware isolation
  • auditable decisions
  • no dynamic code execution

O-Lang governs when hardware is touched — not how.

11. LangChain Integration

11.1 LangChain as a Capability

LangChain is just another capability.

Step 2: Ask langchain-agent "{query}" Save as answer

11.2 Complementary Usage

LangChain builds the flow → O-Lang governs execution.

Rule:
LangChain may construct intent
O-Lang must enforce execution

12. Implementation Guidance

O-Lang is defined by its protocol semantics, not by any specific implementation. Multiple kernel implementations are expected and encouraged.

12.1 Reference Implementation

A reference implementation is provided to:

  • demonstrate protocol semantics
  • serve as a conformance baseline
  • enable rapid ecosystem adoption

The reference implementation is not normative — the specification takes precedence in all cases.

12.2 Conformance Requirements

All compliant implementations MUST:

  • implement all normative requirements in this specification
  • produce equivalent semantic execution traces for identical inputs
  • pass all required tests in the official O-Lang Conformance Test Suite (OCTS)
  • Passing conformance tests does not imply runtime trust or certification.

Implementation language, performance characteristics, and internal architecture are not constrained by this specification.

12.3 Ecosystem Interoperability

Kernels in different languages MUST interoperate at the protocol level:

  • identical workflows produce equivalent contexts
  • capability contracts are language-agnostic
  • audit trails are structurally consistent

This ensures portability across environments while preserving governance guarantees.

12.4 Feature Compliance Matrix

Feature Required
Parsing & ValidationYes
Symbol EnforcementYes
Audit TracesYes
Parallel ExecutionYes
Timeout HandlingYes
Escalation ChainsNo
Determinism TierNo

13. System Classification

O-Lang is not a developer framework, scripting language, or orchestration engine. It is a semantic governance protocol designed for systems-level integration in regulated domains.

13.1 What O-Lang Is Not

  • Not a DSL — O-Lang does not encode domain logic or business rules; it governs how such logic may be invoked.
  • Not an operational workflow engine — O-Lang does not manage queues, retries, or infrastructure; it validates semantic correctness before any execution occurs.
  • Not a LangChain alternative — It does not replace developer-facing composition tools; it governs their runtime behavior when used in regulated contexts.

13.2 What O-Lang Is

  • A runtime governance boundary — Enforces separation between AI intent and execution authority via kernel-mediated capability invocation.
  • A semantic execution layer — Validates symbol validity, placeholder resolution, and policy compliance before side effects occur.
  • An AI systems primitive — Provides the missing contract between application intent and infrastructure execution in healthcare, finance, and public-sector AI.
  • A minimal, verifiable runtime — The kernel is the enforcement boundary — not a wrapper around existing agent frameworks.

13.3 Non-Goals for v1.1

This specification intentionally does not define:

  • Capability handler certification processes
  • Package registry governance models
  • Economic trust or reputation mechanisms
  • Runtime sandboxing implementation details

These topics are reserved for future versions under O-Lang Foundation governance. This narrow scope ensures the protocol remains focused on its core mission: runtime-enforced separation of intent from execution.

14. Final Principle

If orchestration logic can bypass the runtime,
then orchestration does not exist.

15. Conformance Model (Normative)

15.1 Definition of Conformance

An implementation is considered O-Lang conformant if and only if it:

  • implements all normative requirements in this specification
  • produces equivalent semantic execution traces for identical workflows
  • passes all required tests in the official O-Lang Conformance Test Suite (OCTS)

15.2 Version Binding

Conformance is strictly version-bound. Certification for O-Lang/1.1 does not imply conformance with any other version.

15.3 Test Traceability

Every conformance test MUST reference one or more normative clauses in this specification. No test may assert behavior not explicitly defined herein.

16. Formal Semantics Summary (Informative)

O-Lang can be modeled as a guarded transition system:

  • States: Context ∈ Symbol ⇀ Value
  • Actions: Step ∈ { Action, Ask, Use, ... }
  • Transitions: Context → Context via resolver-mediated updates
  • Guards: If conditions, Allow resolvers, Constraint clauses
  • Final states: Defined by Return clause

This model ensures:

  • Safety: No transition occurs without explicit declaration.
  • Liveness: Timeouts prevent infinite hangs.
  • Auditability: Every transition is observable.

Unlike Turing-complete agent frameworks, O-Lang constrains expressivity to enforce governance — making it suitable for regulated domains.

Appendix A: Failure Handling Patterns — Explicit vs Implicit Retries (Informative)

Terminology bridge: In O-lang, a resolver is any external component that produces symbol values — equivalent to tools in LangChain, nodes in n8n, functions in OpenAI Assistants, or sensors/actuators in IoT systems. The critical distinction is not naming, but where failure handling occurs: conventional systems embed retry…enforces failure visibility outside tools at the kernel boundary (governance-level).

Domain applicability note: The examples below use a financial balance-check scenario for concrete illustration, but the safety principles apply universally across domains including healthcare diagnostics, IoT sensor fusion, government service delivery, agritech monitoring, and any system where transient infrastructure failures must not result in silent data fabrication.

A.1 Execution Trace Comparison: Explicit Workflow Retries Preserve Auditability

Step Kernel Action Symbol State (balance) Observable Outcome
1 Invoke resolver QueryDB("12345") PENDING System shows "Checking balance..."
2 Resolver returns DATABASE_TIMEOUT UNDEFINED (reason: timeout) Kernel halts — no hidden retry
3 Workflow evaluates Catch → Continue Still UNDEFINED Explicit retry decision logged in trace
4 Enforce backoff=2s wait UNDEFINED (waiting) User sees "Retrying in 2s..." (if UI exposes trace)
5 2nd resolver invocation PENDING (attempt 2) "Attempt 2/3..."
6 Resolver returns DATABASE_TIMEOUT UNDEFINED (reason: timeout #2) Kernel halts again — failure remains visible
7–9 Loop counter → backoff → 3rd attempt PENDING (attempt 3) "Attempt 3/3..."
10 Resolver returns 2500 (success) DEFINED → 2500 Balance displayed: "₦2,500"

Trace always shows: attempt_1: UNDEFINEDattempt_2: UNDEFINEDattempt_3: DEFINED (2500). No path exists for silent corruption.

A.2 Critical Distinctions: Where Retry Authority Resides

Dimension Conventional Orchestration (LangChain, n8n) O-Lang Governance Protocol
Retry authority Orchestrator (hidden middleware) Workflow author (explicit Loop/Try directives)
Failure visibility Masked by retries/fallbacks → "success" log hides root cause Propagated immediately → trace shows every failure attempt
Auditability Only final result logged; retry history lost Full trace: attempt_1 → attempt_2 → attempt_3
Determinism Broken (retry success depends on network timing) Preserved (fixed retry count/backoff → identical trace every run)
Safety property "System stays available" (even if wrong) "System stays truthful" (even if temporarily unavailable)
Mental model Car engine (optimize for motion) Traffic law (optimize for safety boundaries)

Why this matters in connectivity-constrained environments: In settings where network flakiness is the norm (not the exception) — Nigerian USSD banking, rural IoT deployments, edge healthcare diagnostics — conventional systems that "gracefully degrade" by fabricating values aren't graceful. They're structurally unsafe. O-Lang's explicit-retry model ensures temporary unavailability is preferable to permanent corruption.