Agent Loop Engineering

Define loop logic once. Run it across any agent framework.

Cairn is the universal DSL and runtime for agent loop engineering. Write portable AI agent loops in .crn, validate them before execution, and run them across LangChain, LangGraph, CrewAI, AutoGen, and OpenAI without rewriting orchestration logic.

18
CLI commands for validate, run, trace, publish, studio, hub.
5
Built-in framework targets with one loop definition.
Phase 4
Visual editor, collaboration, hosted observability finished in repo.
Problem

Framework-specific loops create migration cost and operational drift.

Every agent stack encodes orchestration differently. That means teams rewrite state flow, validation, debugging, and budget controls whenever they change frameworks or mix vendors.

Loop logic trapped in framework code

State transitions, retries, and fan-out patterns get buried in implementation details instead of staying portable.

Validation happens too late

Missing transitions, bad conditions, and unsafe budgets often surface only after costly runtime failure.

Observability fragments by toolchain

Trace payloads, collaboration feedback, and registry discovery end up spread across custom scripts and ad hoc dashboards.

Solution

Cairn turns loop orchestration into portable product surface.

Define loops in a shared DSL, run them through a stable runtime, publish them into a hosted registry, trace them through CairnLens, and collaborate visually in CairnStudio.

01

Author in .crn

Describe states, transitions, sub-loops, budgets, guards, and outputs in one portable loop document.

02

Validate before runtime

Catch structural and semantic errors before they become execution failures or runaway cost.

03

Run on target framework

Use adapters for LangChain, LangGraph, CrewAI, AutoGen, and OpenAI without rewriting flow logic.

04

Publish, observe, collaborate

Ship loops to CairnHub, collect traces in CairnLens, and iterate through CairnStudio visual collaboration.

cairn architecture
# Core layers
CairnLang   -> DSL + schema + examples
CairnForge  -> parser + validator + runtime
CairnHub    -> registry + ratings + peer index
CairnLens   -> hosted traces + summary UI
CairnStudio -> visual editor + live collaboration

# Guard rails
- checkpoint / resume
- retry + circuit breaker
- parallel fan-out
- cost and duration metadata
Product Surface

Built as one system, not a loose bundle of scripts.

CairnForge runtime

Parser, validator, execution engine, checkpointing, retries, circuit breaker, and parallel execution.

CairnHub registry

Hosted publish, ratings, verified publishers, peer snapshot indexing, and remote source resolution.

CairnLens observability

Trace ingest endpoint, hosted summary UI, recent failures, success rate, loop volume, and peer coverage.

CairnStudio visual flow

Drag-and-drop editing, shared sessions, live presence, comments, activity feed, preview, and trace replay.

Portable framework targets

Run same loop definition across multiple agent stacks without converting orchestration semantics by hand.

Operational guard rails

Budget enforcement, retries, checkpoints, and trace publishing make loops safer to ship and debug.

Framework Targets

One loop definition. Multiple execution targets.

LangChainnative runnable path
LangGraphgraph-style adapter
CrewAItask pipeline adapter
AutoGenconversation loop adapter
OpenAIagents SDK adapter
Documentation

Start with docs built for implementation, not marketing only.

Getting started

First loop, first validation, first runtime execution.

Open guide

CLI reference

All 18 commands, including hosted hub and trace publishing flow.

Open reference

Plugin development

Extend Cairn to additional execution targets and runtime handlers.

Open plugin docs

Language spec

Working CairnLang specification for portable loop documents.

Open spec

Examples

Branching, retries, sub-loops, parallel fan-out, and studio-ready patterns.

Open examples
Start Building

Move loop design out of framework lock-in.

Start with one example loop, validate from CLI, publish traces to hosted CairnLens, and iterate in CairnStudio.