Docs
Loop DSL Documentation
Learn how to use the LoopCraft DSL to define AI agent loops.
.loop.json Specification v1.0
Loop Definition Schema
A JSON document describing the complete structure of an AI agent loop.
Node Types
llm - Agent — runs prompt with tools
tool - Tool - External tool execution
condition - Condition - Branching
human-review - Human Review - Pause for approval
sub-loop - Sub Loop - Nested loop
Loop Engineering Concepts
Loop Engineering designs the control flow AI agents use to plan, act, observe, and iterate. Six core dimensions:
Stages — Discrete steps the agent executes.
Transitions — Rules for moving between stages: sequential, conditional, or parallel.
Tools — External capabilities: web search, code execution, media, memory, custom functions.
Memory — How the agent retains context: full history, sliding window, summarized, stateless.
Guardrails — Safety constraints: PII detection, content filtering, output validation.
Termination — End conditions: max iterations, quality threshold, human approval, stop signal.
Loop Definition Format (.loop.md)
Human-readable Markdown with YAML frontmatter. Export from the Builder or hand-write. Import via drag-and-drop. Use the CLI to scaffold from a template.
AI Generation & Dry Run
Describe your loop in natural language and AI generates the definition. Validate checks for structural errors. Dry Run simulates execution and reports path coverage.
CLI Toolkit
npx loopcraft init — Interactive template selection, generates .loop.md
npx loopcraft validate file.loop.md — Validate structure and detect dead-loops
npx loopcraft export file.loop.md --target langgraph — Export to LangGraph, OpenAI SDK, AutoGen, or CrewAI