cd /news/ai-agents/i-m-a-photographer-i-built-a-dsl-for… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-19007] src=github.com pub= topic=ai-agents verified=true sentiment=↑ positive

I'm a photographer. I built a DSL for multi-agent workflows

A photographer has built AgentFlow, a declarative DSL that lets users define multi-agent AI workflows in simple `.aflow` files and compile them into MCP tools for Claude Code without writing any integration code. The system supports assigning different AI models to different agents, running iterative loops with structured output, and includes a CLI with validation, execution, and MCP configuration commands. This allows non-programmers to create complex, multi-model AI pipelines that are git-friendly and reviewable by anyone.

read4 min publishedMay 31, 2026

A declarative language for multi-agent AI workflows β€” compile to MCP tools, no code required.

Write complex multi-agent workflows in clean, readable .aflow

files. Each workflow becomes a tool in Claude Code via MCP β€” zero integration code. Assign different AI models to different agents, run iterative loops, and let agents collaborate with structured output.

workflow code_quality
  description: "Iterative code review with writer, tester, and critic"
  version: "1.0.0"

  agents:
    agent writer     β†’ model: "local-fast"
    agent tester     β†’ model: "openrouter-smart"
    agent critic     β†’ model: "claude-sonnet"

  loop quality_gate
    phases: [write, test, review]
    repeat_while: review.verdict == "needs_work"
    max_iterations: 5

  done when: review.confidence >= 0.85
Traditional (LangGraph, CrewAI) AgentFlow DSL
Define workflows
Python code (~40 lines boilerplate) .aflow file (~20 lines)
Multi-model
Manual provider switching Per-agent model aliases
MCP integration
Write MCP server code Automatic β€” each workflow = MCP tool
Git-friendly
Code + config scattered Single .aflow file
Reviewable
Need Python knowledge Readable by anyone
npm install -g @anhonestboy/agentflow
agentflow init

Interactive wizard: choose providers (Claude, OpenRouter, Ollama), configure model aliases, save API keys.

Create my-workflow.aflow

:

workflow blog_post
  description: "Generate and refine a blog post"
  version: "1.0.0"

  agents:
    agent researcher
      mode: patient
      must_produce:
        - outline
        - key_points

    agent writer
      mode: focused
      must_produce:
        - draft
        - word_count: int

    agent editor
      mode: adversarial
      must_produce:
        - verdict
        - suggestions
        - confidence: float

  phases:
    phase research
      agent: researcher
      input: [trigger.topic]
      output: [outline, key_points]

    phase write
      agent: writer
      input: [research.outline, research.key_points]
      output: [draft, word_count]

    phase edit
      agent: editor
      input: [write.draft]
      output: [verdict, suggestions, confidence]

  loop revision_cycle
    phases: [write, edit]
    repeat_while: edit.verdict == "needs_work"
    max_iterations: 3
    on_each_iteration:
      send_to: writer
      payload: edit.suggestions

  done when: edit.confidence >= 0.8 and edit.verdict == "approved"
agentflow check my-workflow.aflow     # Validate
agentflow run my-workflow.aflow --input 'topic="AI in photography"'
agentflow mcp-config

Copy the JSON output to your Claude Code MCP settings. Your workflow is now a tool β€” call it directly from Claude Code.

Provider Status Notes
Claude (Anthropic)
βœ… Native SDK, multi-round tool use
OpenRouter
βœ… 315+ models, automatic provider routing
Ollama
βœ… Local execution, no API key needed

Configure model aliases for cost optimization β€” use cheap models for drafting, frontier models for review:

{
  "models": {
    "local-fast":       { "provider": "ollama",      "model": "qwen3:8b" },
    "openrouter-smart": { "provider": "openrouter",  "model": "google/gemini-2.5-flash" },
    "claude-sonnet":    { "provider": "claude",      "model": "claude-sonnet-4-5" }
  }
}
agentflow init                     # Interactive setup wizard
agentflow check <file>             # Validate workflow + summary
agentflow run <file> --input '…'   # Execute with real LLMs
agentflow run <file> --mock        # Execute with mock agents (no API key needed)
agentflow compile <file>           # Compile to IR JSON
agentflow validate <file>          # Validate only (no summary)
agentflow mcp-config               # Print MCP server config for Claude Code
agentflow models                   # List configured models + connectivity
agentflow resume <file> --instance <uuid>  # Resume interrupted workflow
agent <id>
  model: "<alias>"         # Model alias from config (default: "auto")
  mode: <mode>             # focused | adversarial | reliable | precise | strict | patient | objective
  tools: [<name>, ...]     # Built-in tools: file_write, file_read, shell_exec, test_runner
  must_produce:
    - <name>               # Required output field (string)
    - <name>: float        # Typed output field
  constraint: "<rule>"     # Natural language constraint
phase <id>
  agent: <agent_id>
  input: [<ref>, ...]          # trigger.field or phase_id.output
  output: [<name>, ...]
  inject_context: "<path>"     # Optional: inject file content into agent context
  timeout: 30min               # For human_action_required phases
loop <id>
  phases: [<phase_id>, ...]
  repeat_while: <condition>    # review.verdict == "needs_work"
  max_iterations: <n>
  on_each_iteration:
    send_to: <agent_id>
    payload: <ref>             # Feedback to inject
  on_max_exceeded:
    escalate_to: <agent_id>
    message: "<...>"
review.confidence >= 0.85

review.verdict == "approved" and review.confidence >= 0.85
not (review.verdict == "needs_work")
.aflow file
    β”‚
    β–Ό
 Tokenizer ──► Parser ──► Compiler (AST β†’ IR)
                              β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Validator (S1-S10) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  WorkflowRunner     β”‚
                    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                    β”‚  β”‚ ExecutorResolverβ”‚  β”‚
                    β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚  β”‚
                    β”‚  β”‚ β”‚ Claude      β”‚β”‚  β”‚
                    β”‚  β”‚ β”‚ OpenRouter  β”‚β”‚  β”‚
                    β”‚  β”‚ β”‚ Ollama      β”‚β”‚  β”‚
                    β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚  β”‚
                    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  MCP Server         β”‚
                    β”‚  (stdio JSON-RPC)   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                     Claude Code / Cursor
File Description
examples/blog-post.aflow
Researcher β†’ writer β†’ editor with revision loop
examples/code-quality.aflow
Writer β†’ tester β†’ critic with quality gate loop
examples/code-quality-with-plan.aflow
Extended with planning phase
examples/custom-domain.aflow
7-phase domain provisioning workflow
git clone https://github.com/anhonestboy/agentflow.git
cd agentflow
npm install
npm run build
npm test          # 92 tests, 6 suites
npm run dev -- check examples/code-quality.aflow

v1.1β€” VS Code extension (syntax highlighting, LSP)** v1.2**β€” Parallel phase execution** v1.3**β€” Workflow registry & sharing** v2.0**β€” Web visualizer, CI/CD integration

MIT β€” see LICENSE for details.

── more in #ai-agents 4 stories Β· sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/i-m-a-photographer-i…] indexed:0 read:4min 2026-05-31 Β· β€”