Skip to main content

A modular framework for designing and orchestrating complex agentic workflows with ease.

Project description

Modular Agent Designer

Modular Agent Designer is a YAML-first toolkit for designing automated agent workflows from modular pieces: models, tools, agents, routing, retries, loops, and handoffs.

It is built for people who want to automate agent workflows without writing orchestration code. Most workflows live entirely in YAML. Python is only needed when you add custom tools, Pydantic schemas, or custom node logic.

mad create my_agent
mad run my_agent/my_agent.yaml --input '{"message": "hello"}'

mad is the short alias for modular-agent-designer.

If you are running from a cloned checkout without activating the virtual environment, prefix commands with uv run, for example uv run mad run ....


What You Build

A Modular Agent Designer workflow describes:

Part What it controls
models Which LLM providers and model aliases your agents use
tools Builtin tools, Python functions, or MCP tools agents can call
agents Agent prompts, model choices, tools, schemas, retries, and behavior
workflow The graph: entry node, edges, routing, loops, fan-out, and handoffs

You can start with a single agent and grow into multi-step workflows:

user input -> researcher -> analyst -> writer -> final state

Or design more advanced automations:

classifier
  -> billing agent
  -> technical agent
  -> human handoff

Install

Requires Python 3.11+ and uv.

uv sync --prerelease=allow

For development tools:

uv pip install -e ".[dev]" --prerelease=allow

For optional MLflow / OTLP tracing support:

uv sync --extra telemetry --prerelease=allow

If you use the default scaffolded local workflow, install and start Ollama:

ollama serve
ollama pull gemma:e4b

Quickstart

Create a new agent project:

mad create my_agent

This creates:

File Purpose
my_agent.yaml The workflow definition you edit
agent.py ADK web entry point exposing root_agent
__init__.py Makes the folder importable
README.md Per-agent quickstart notes

Run the workflow:

mad run my_agent/my_agent.yaml --input '{"message": "hello"}'

Validate it without running:

mad validate my_agent/my_agent.yaml --skip-build

List the workflow structure:

mad list my_agent/my_agent.yaml

Generate a Mermaid diagram:

mad diagram my_agent/my_agent.yaml

You can also use the full command name:

modular-agent-designer run my_agent/my_agent.yaml --input '{"message": "hello"}'

Minimal Workflow

This is a complete single-agent workflow:

name: hello_world
description: Single-agent sanity check using a local Ollama model.

models:
  local_fast:
    provider: ollama
    model: ollama/gemma4:e4b

tools: {}

agents:
  greeter:
    model: local_fast
    instruction: |
      The user gave you this topic: {{state.user_input.topic}}
      Write a single friendly sentence greeting about that topic.

workflow:
  nodes:
    - greeter
  edges: []
  entry: greeter

Run it:

mad run examples/workflows/hello_world.yaml --input '{"topic": "tide pools"}'

Workflow input is stored in state as state.user_input, so prompts can refer to values like {{state.user_input.topic}}.


YAML Concepts

Models

Define provider-specific models once, then reference them by alias from agents.

models:
  local:
    provider: ollama
    model: ollama/gemma4:e4b
    thinking:
      reasoning_effort: high

  writer_model:
    provider: openai
    model: openai/gpt-4o

Supported provider prefixes:

Provider Model prefix Environment
Ollama ollama/ or ollama_chat/ Optional OLLAMA_API_BASE
Anthropic anthropic/ ANTHROPIC_API_KEY
Google Gemini gemini/ GOOGLE_API_KEY
OpenAI openai/ OPENAI_API_KEY

The optional thinking field passes provider-specific reasoning settings to the model. Use reasoning_effort for providers that support effort levels, or Gemini-style fields such as thinking_budget and include_thoughts when needed.

Tools

Tools can be builtin, Python functions, or MCP servers.

tools:
  fetch:
    type: builtin
    name: fetch_url

  custom_lookup:
    type: python
    ref: examples.tools.text_tools.keyword_count

  filesystem:
    type: mcp_stdio
    command: docker
    args: ["mcp", "gateway", "run", "--servers=filesystem"]
    tool_name_prefix: fs

Use YAML for wiring. Use Python only when the tool itself is custom logic.

Agents

Agents combine a model, instructions, optional tools, and optional output contracts.

agents:
  researcher:
    model: local
    tools: [fetch]
    instruction: |
      Research this topic: {{state.user_input.topic}}
      Return concise findings.

  writer:
    model: local
    instruction: |
      Write a short article from these findings:
      {{state.researcher}}

Agent outputs are written back into state under the agent name by default. In the example above, writer can read {{state.researcher}}.

Workflow Graph

The workflow graph chooses which agents run and in what order.

workflow:
  nodes: [researcher, writer]
  edges:
    - from: researcher
      to: writer
  entry: researcher

See examples/workflows/research_assistant.yaml for a three-stage workflow.


When Python Is Needed

Most workflow changes should be YAML-only. Reach for Python when you need:

Need Use
Custom tool behavior A Python callable referenced by type: python
Structured agent inputs or outputs Pydantic models referenced by dotted path
Non-LLM workflow logic A custom ADK BaseNode or node function

Examples:


Schemas and Runtime Skills

Structured Schemas

Use Pydantic schemas when an agent should return structured data that later workflow steps can inspect.

from typing import Literal

from pydantic import BaseModel, Field


class ValidationResult(BaseModel):
    validation_result: Literal["success", "fail"]
    reason: str = Field(description="Why validation passed or failed")

Reference the schema from YAML with a dotted path:

agents:
  validator:
    model: fast
    output_schema: examples.schemas.validation.ValidationResult
    instruction_file: examples.prompts.output_schema_routing__validator

workflow:
  edges:
    - from: validator
      to: process_node
      condition:
        eval: "state.get('validator', {}).get('validation_result') == 'success'"
    - from: validator
      to: reject_node
      condition: default

Example: examples/workflows/output_schema_routing.yaml

Runtime Skills

Runtime skills are reusable instruction packages that agents can load through ADK's SkillToolset. They are different from the coding-assistant skills in src/modular_agent_designer/cli_skills.

Define skills once at the workflow root, then attach them to agents by alias:

skills:
  summarizer:
    ref: modular_agent_designer.skills.summarize-text
  local_summary:
    ref: examples.skills.summarize-text

agents:
  researcher:
    model: local
    instruction_file: prompts.skills_example__researcher
    skills: [summarizer]

Each skill ref points to a directory containing SKILL.md, such as examples/skills/summarize-text/SKILL.md.

Example: examples/workflows/skills_example.yaml


Common Workflow Patterns

Sequential Pipeline

Run agents in a fixed order.

edges:
  - from: researcher
    to: analyst
  - from: analyst
    to: writer

Example: examples/workflows/research_assistant.yaml

Conditional Routing

Route based on a node output.

edges:
  - from: classifier
    to: technical_support
    condition: tech
  - from: classifier
    to: billing_support
    condition: billing
  - from: classifier
    to: fallback
    condition: default

Examples:

Switch/Case Routing

Use switch when one state value should choose from several named routes. This keeps classifier-style workflows easier to scan than repeating one conditional edge per case.

edges:
  - from: classifier
    switch: "{{state.classifier}}"
    cases:
      urgent: handle_urgent
      normal: handle_normal
      low: handle_low
    default: handle_normal

The switch value can read from state with {{state.key}}. The optional default target handles values that do not match any case.

Example: examples/workflows/switch_example.yaml

Loops and Retries

Use loops for intentional workflow cycles, such as draft-review-revise flows. Use retries for transient node failures.

agents:
  writer:
    model: local
    instruction: "Write a draft."
    retry:
      max_retries: 3
      backoff: exponential
      delay_seconds: 1

workflow:
  edges:
    - from: reviewer
      to: writer
      condition: revise
      loop:
        max_iterations: 3

Examples:

Error Handling

Route failures to recovery agents after retries are exhausted.

edges:
  - from: api_caller
    to: success_handler

  - from: api_caller
    to: timeout_handler
    on_error: true
    error_type: TimeoutError

  - from: api_caller
    to: generic_error_handler
    on_error: true
    condition: default

Example: examples/workflows/typed_errors.yaml

Parallel Fan-Out

Send work to multiple agents at the same time and join the results.

edges:
  - from: planner
    to: [researcher_a, researcher_b, researcher_c]
    parallel: true
    join: synthesizer

Example: examples/workflows/parallel_workflow.yaml

Sub-Agents

Use sub-agents when a parent agent should choose which specialist to call at runtime.

agents:
  coordinator:
    model: local
    instruction: "Delegate to the right specialist."
    sub_agents: [search_specialist, analysis_specialist]

  search_specialist:
    model: local
    description: "Finds relevant source material."
    mode: single_turn

  analysis_specialist:
    model: local
    description: "Turns source material into findings."
    mode: single_turn

Example: examples/workflows/sub_agent_example.yaml


CLI Reference

Command Purpose
mad create <agent-name> Scaffold a new editable agent project
mad run <workflow.yaml> --input '<json-or-text>' Run a workflow
mad run <workflow.yaml> --input-file <path> Run using JSON or text from a file
mad validate <workflow.yaml> Validate and build a workflow
mad validate <workflow.yaml> --skip-build Validate YAML only, useful in CI without secrets
mad list <workflow.yaml> Print models, tools, agents, and graph details
mad diagram <workflow.yaml> Emit a Mermaid flowchart
mad cli-skills setup Install bundled assistant skills into .agents/skills

Useful run options:

mad run workflow.yaml --dry-run --verbose
mad run workflow.yaml --log-level INFO --input '{"topic": "x"}'
mad run workflow.yaml --mlflow 0 --input '{"topic": "x"}'

Examples

Start here:

Example What it shows
hello_world.yaml Smallest single-agent workflow
research_assistant.yaml Multi-stage pipeline
local_tools_example.yaml Python tool integration
mcp_example.yaml MCP tool integration
conditional_workflow.yaml Conditional branches
parallel_workflow.yaml Parallel fan-out and join
sub_agent_example.yaml Parent agent with specialists
output_schema_routing.yaml Structured output and routing
skills_example.yaml Runtime skills attached to an agent

All workflow examples live in examples/workflows.


Assistant Skills

The project includes instruction skills for coding assistants. They are not runtime agent skills; they help a coding assistant guide you through building workflows.

Install them into a project:

mad cli-skills setup

Available guides:

Skill Use it for
mad-overview Full project and YAML reference
mad-create-workflow Building a workflow from scratch
mad-tools Builtin, Python, and MCP tools
mad-routing Branching, loops, errors, and parallel edges
mad-sub-agents Sub-agents, skills, schemas, and custom nodes

See src/modular_agent_designer/cli_skills/README.md for setup details for Codex, Claude Code, Gemini CLI, and ChatGPT CLI.


Development

Install with development dependencies:

uv pip install -e ".[dev]" --prerelease=allow

Run tests:

uv run pytest

Run a lightweight validation check:

mad validate examples/workflows/hello_world.yaml --skip-build

Project Status

Modular Agent Designer compiles declarative YAML workflows into Google ADK agents and workflow graphs. The project supports local Ollama workflows, hosted model providers, builtin tools, custom tools, MCP tools, sub-agents, structured outputs, retries, routing, diagrams, and optional tracing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modular_agent_designer-0.8.0.tar.gz (494.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modular_agent_designer-0.8.0-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file modular_agent_designer-0.8.0.tar.gz.

File metadata

  • Download URL: modular_agent_designer-0.8.0.tar.gz
  • Upload date:
  • Size: 494.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for modular_agent_designer-0.8.0.tar.gz
Algorithm Hash digest
SHA256 885d2eb3007322df1d0b8f5200d295055177dfac13e1d41ffc648121eb1cda8e
MD5 a95a24e89a78a08fb4c4a1a82c7e7a46
BLAKE2b-256 ea1752ab506480b81e0922a3cafb3d909e9d27c5a06a9a1b5baaf526c431b531

See more details on using hashes here.

File details

Details for the file modular_agent_designer-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: modular_agent_designer-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 73.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for modular_agent_designer-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e293460f4d1473bbf20d45cf3e32bfad4b201f0f9b848fe4d3e254dbbc5f62e
MD5 d12ac50707cc0a989560d73377d9e100
BLAKE2b-256 50a83e78ffb9d4108eca3c8fa29952fb8a80dd861887acd3d59e0c68c375bbe4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page