{"slug": "i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows", "title": "I'm a photographer. I built a DSL for multi-agent workflows", "summary": "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.", "body_md": "**A declarative language for multi-agent AI workflows — compile to MCP tools, no code required.**\n\nWrite complex multi-agent workflows in clean, readable `.aflow`\n\nfiles. 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.\n\n```\nworkflow code_quality\n  description: \"Iterative code review with writer, tester, and critic\"\n  version: \"1.0.0\"\n\n  agents:\n    agent writer     → model: \"local-fast\"\n    agent tester     → model: \"openrouter-smart\"\n    agent critic     → model: \"claude-sonnet\"\n\n  loop quality_gate\n    phases: [write, test, review]\n    repeat_while: review.verdict == \"needs_work\"\n    max_iterations: 5\n\n  done when: review.confidence >= 0.85\n```\n\n| Traditional (LangGraph, CrewAI) | AgentFlow DSL | |\n|---|---|---|\nDefine workflows |\nPython code (~40 lines boilerplate) | `.aflow` file (~20 lines) |\nMulti-model |\nManual provider switching | Per-agent model aliases |\nMCP integration |\nWrite MCP server code | Automatic — each workflow = MCP tool |\nGit-friendly |\nCode + config scattered | Single `.aflow` file |\nReviewable |\nNeed Python knowledge | Readable by anyone |\n\n```\nnpm install -g @anhonestboy/agentflow\nagentflow init\n```\n\nInteractive wizard: choose providers (Claude, OpenRouter, Ollama), configure model aliases, save API keys.\n\nCreate `my-workflow.aflow`\n\n:\n\n```\nworkflow blog_post\n  description: \"Generate and refine a blog post\"\n  version: \"1.0.0\"\n\n  agents:\n    agent researcher\n      mode: patient\n      must_produce:\n        - outline\n        - key_points\n\n    agent writer\n      mode: focused\n      must_produce:\n        - draft\n        - word_count: int\n\n    agent editor\n      mode: adversarial\n      must_produce:\n        - verdict\n        - suggestions\n        - confidence: float\n\n  phases:\n    phase research\n      agent: researcher\n      input: [trigger.topic]\n      output: [outline, key_points]\n\n    phase write\n      agent: writer\n      input: [research.outline, research.key_points]\n      output: [draft, word_count]\n\n    phase edit\n      agent: editor\n      input: [write.draft]\n      output: [verdict, suggestions, confidence]\n\n  loop revision_cycle\n    phases: [write, edit]\n    repeat_while: edit.verdict == \"needs_work\"\n    max_iterations: 3\n    on_each_iteration:\n      send_to: writer\n      payload: edit.suggestions\n\n  done when: edit.confidence >= 0.8 and edit.verdict == \"approved\"\nagentflow check my-workflow.aflow     # Validate\nagentflow run my-workflow.aflow --input 'topic=\"AI in photography\"'\nagentflow mcp-config\n```\n\nCopy the JSON output to your Claude Code MCP settings. Your workflow is now a tool — call it directly from Claude Code.\n\n| Provider | Status | Notes |\n|---|---|---|\nClaude (Anthropic) |\n✅ | Native SDK, multi-round tool use |\nOpenRouter |\n✅ | 315+ models, automatic provider routing |\nOllama |\n✅ | Local execution, no API key needed |\n\nConfigure model aliases for cost optimization — use cheap models for drafting, frontier models for review:\n\n```\n{\n  \"models\": {\n    \"local-fast\":       { \"provider\": \"ollama\",      \"model\": \"qwen3:8b\" },\n    \"openrouter-smart\": { \"provider\": \"openrouter\",  \"model\": \"google/gemini-2.5-flash\" },\n    \"claude-sonnet\":    { \"provider\": \"claude\",      \"model\": \"claude-sonnet-4-5\" }\n  }\n}\nagentflow init                     # Interactive setup wizard\nagentflow check <file>             # Validate workflow + summary\nagentflow run <file> --input '…'   # Execute with real LLMs\nagentflow run <file> --mock        # Execute with mock agents (no API key needed)\nagentflow compile <file>           # Compile to IR JSON\nagentflow validate <file>          # Validate only (no summary)\nagentflow mcp-config               # Print MCP server config for Claude Code\nagentflow models                   # List configured models + connectivity\nagentflow resume <file> --instance <uuid>  # Resume interrupted workflow\nagent <id>\n  model: \"<alias>\"         # Model alias from config (default: \"auto\")\n  mode: <mode>             # focused | adversarial | reliable | precise | strict | patient | objective\n  tools: [<name>, ...]     # Built-in tools: file_write, file_read, shell_exec, test_runner\n  must_produce:\n    - <name>               # Required output field (string)\n    - <name>: float        # Typed output field\n  constraint: \"<rule>\"     # Natural language constraint\nphase <id>\n  agent: <agent_id>\n  input: [<ref>, ...]          # trigger.field or phase_id.output\n  output: [<name>, ...]\n  inject_context: \"<path>\"     # Optional: inject file content into agent context\n  timeout: 30min               # For human_action_required phases\nloop <id>\n  phases: [<phase_id>, ...]\n  repeat_while: <condition>    # review.verdict == \"needs_work\"\n  max_iterations: <n>\n  on_each_iteration:\n    send_to: <agent_id>\n    payload: <ref>             # Feedback to inject\n  on_max_exceeded:\n    escalate_to: <agent_id>\n    message: \"<...>\"\n# Comparison\nreview.confidence >= 0.85\n\n# Logical\nreview.verdict == \"approved\" and review.confidence >= 0.85\nnot (review.verdict == \"needs_work\")\n.aflow file\n    │\n    ▼\n Tokenizer ──► Parser ──► Compiler (AST → IR)\n                              │\n                    ┌─────────▼──────────┐\n                    │   Validator (S1-S10) │\n                    └─────────┬──────────┘\n                              │\n                    ┌─────────▼──────────┐\n                    │  WorkflowRunner     │\n                    │  ┌───────────────┐  │\n                    │  │ ExecutorResolver│  │\n                    │  │ ┌─────────────┐│  │\n                    │  │ │ Claude      ││  │\n                    │  │ │ OpenRouter  ││  │\n                    │  │ │ Ollama      ││  │\n                    │  │ └─────────────┘│  │\n                    │  └───────────────┘  │\n                    └─────────┬──────────┘\n                              │\n                    ┌─────────▼──────────┐\n                    │  MCP Server         │\n                    │  (stdio JSON-RPC)   │\n                    └─────────┬──────────┘\n                              │\n                     Claude Code / Cursor\n```\n\n| File | Description |\n|---|---|\n`examples/blog-post.aflow` |\nResearcher → writer → editor with revision loop |\n`examples/code-quality.aflow` |\nWriter → tester → critic with quality gate loop |\n`examples/code-quality-with-plan.aflow` |\nExtended with planning phase |\n`examples/custom-domain.aflow` |\n7-phase domain provisioning workflow |\n\n```\ngit clone https://github.com/anhonestboy/agentflow.git\ncd agentflow\nnpm install\nnpm run build\nnpm test          # 92 tests, 6 suites\nnpm run dev -- check examples/code-quality.aflow\n```\n\n**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\n\nMIT — see [LICENSE](/anhonestboy/agentflow/blob/main/LICENSE) for details.", "url": "https://wpnews.pro/news/i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows", "canonical_source": "https://github.com/anhonestboy/agentflow", "published_at": "2026-05-31 06:06:03+00:00", "updated_at": "2026-05-31 06:45:29.564937+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-products", "ai-infrastructure", "large-language-models"], "entities": ["Claude Code", "OpenRouter", "Ollama", "LangGraph", "CrewAI", "AgentFlow", "MCP", "Claude"], "alternates": {"html": "https://wpnews.pro/news/i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows", "markdown": "https://wpnews.pro/news/i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows.md", "text": "https://wpnews.pro/news/i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows.txt", "jsonld": "https://wpnews.pro/news/i-m-a-photographer-i-built-a-dsl-for-multi-agent-workflows.jsonld"}}