AI agent orchestration

Orchestrate Agent Harness steps and MCP-operated workflows.

Dagu gives AI-assisted work a production workflow boundary: run Agent Harness steps through `harness.run`, let MCP-capable tools operate Dagu through the built-in MCP server, and keep logs, retries, approvals, and audit history in one place.

Agent Harness orchestration as YAML
# agent-review.yaml
schedule: "0 9 * * 1"
working_dir: /srv/app
 
steps:
  - id: draft_notes
    action: harness.run
    with:
      provider: codex
      prompt: |
        Draft release notes for the commits since the last tag.
    stdout:
      artifact: release-notes.md
 
  - id: human_review
    action: human.task
    with:
      prompt: Publish these release notes?
      artifacts: [release-notes.md]
      push_back:
        rewind_to: draft_notes
        form:
          type: object
          properties:
            feedback: { type: string }
          required: [feedback]
    depends: [draft_notes]
 
  - id: publish
    run: ./scripts/publish-notes.sh
    depends: [human_review]

Execution order

draft_notescodexhuman_reviewpush backpublish

Explicit external provider runtime

Run Claude, Codex, Gemini, OpenCode, or custom external agent CLIs

Expose workflow operations to MCP-capable tools

Keep human review, logs, retries, and artifacts in Dagu

At a glance

Dagu's role in an agent stack

Agent runtime
Dagu

Configured external CLIs through Agent Harness steps, plus MCP clients over HTTP.

Typical alternative

Agent frameworks often couple orchestration to one runtime or model surface.

Operations
Dagu

Schedules, retries, logs, artifacts, approvals, and reruns.

Typical alternative

Prompt-only automation leaves these controls to custom scripts and conventions.

Ownership
Dagu

Workflow definitions, logs, and execution stay in your environment.

Typical alternative

Hosted harnesses can make workflow state, credentials, and costs harder to control.

In depth

How Dagu does it

01

Use external agent commands, not a hidden runtime

Dagu keeps AI work explicit: workflow steps call the external agent CLI your team chooses through Agent Harness.

  • Use `harness.run` for Claude, Codex, Gemini, OpenCode, Aider, or internal agent CLIs.
  • Run the provider on the host or inside a controlled container sandbox.
  • Swap models and external agent CLIs without changing the workflow engine.
02

Let MCP-capable tools operate Dagu

Dagu's MCP server remains built into the HTTP server. It lets approved clients inspect state, preview edits, apply DAG changes, and control runs through the same authenticated boundary as the API.

  • Expose Dagu state and run controls without handing agents raw infrastructure credentials.
  • Use `dagu_read`, `dagu_change`, and `dagu_execute` from MCP clients.
  • Attribute MCP requests and downstream actions in audit history.
03

Keep production controls around AI work

Agent output still needs schedules, dependencies, retries, validation, and human review. Dagu treats those controls as workflow structure instead of prompt glue.

  • Repeat an agent step until your tests pass, then have a person review it and push it back with feedback.
  • Capture stdout, stderr, artifacts, logs, and run history for review.
  • Schedule recurring summaries, triage, cleanup, and QA workflows.

FAQ

Practical questions before adopting Dagu

Where does the agent run?

An Agent Harness step launches a configured external CLI, and an MCP-capable client operates a running Dagu server from outside it. In an Agent DAG, Dagu runs the loop itself and calls the model you configure.

How is harness different from MCP?

Agent Harness runs the configured external CLI as a workflow step. MCP lets an external AI tool operate a running Dagu server: inspect workflows, preview or apply edits, and start, retry, enqueue, or stop runs.

Can Dagu run multiple agent providers?

Yes. A workflow can call different CLIs or custom harness definitions in different steps, and harness fallback entries can try alternate provider configs when a primary attempt fails.

Next step

Start with one workflow.

Install Dagu, move one fragile script or agent task into YAML, and decide from a real run history.