Skip to content

Introduction to Moira

Moira is a workflow orchestration engine designed specifically for AI agents. It guides agents through multi-step processes using structured workflows with clear directives and success criteria.

AI agents are powerful but need structure. Without guidance, they can:

  • Lose focus on complex multi-step tasks
  • Skip important steps or prerequisites
  • Produce inconsistent results
  • Miss quality checks and validation

Moira provides a node-graph workflow system where each step has:

Directive

Clear instruction on what needs to be done

Completion Condition

Success criteria that must be met

Input Schema

Expected structure of the response (optional)

Connections

Links to next steps in the workflow

The agent executes each step, validates completion, and moves to the next node based on the workflow graph.

flowchart LR
    A[Start Workflow] --> B[Execute Step]
    B --> C{Validate Completion}
    C -->|Success| D[Next Step]
    D --> B
    C -->|Workflow Complete| E[End]
  1. Agent starts a workflow via MCP tool
  2. Receives current step directive and completion condition
  3. Executes the directive
  4. Returns result via step() tool
  5. Engine validates and advances to next step
  6. Repeat until workflow completes

A workflow is a directed graph of nodes. Each node represents a step in the process. Nodes can branch conditionally, loop, or delegate to subgraphs.

{
"id": "my-workflow",
"metadata": {
"name": "My Workflow",
"version": "1.0.0",
"description": "Example workflow"
},
"nodes": [
{ "id": "start", "type": "start", "connections": { "default": "task-1" } },
{
"id": "task-1",
"type": "agent-directive",
"directive": "...",
"connections": { "success": "end" }
},
{ "id": "end", "type": "end" }
]
}

Moira supports 7 node types:

TypePurpose
startEntry point for workflow execution
endTerminal node marking completion
agent-directiveTask for agent with directive and completion condition
conditionBranch execution based on structured conditions
expressionCompute values using arithmetic expressions
subgraphDelegate to another workflow
telegram-notificationSend notifications via Telegram

Templates allow dynamic content in directives and conditions using {{variable}} syntax:

{
"directive": "Analyze {{projectName}} and create {{reportType}} report"
}

Variables can reference:

  • Initial data from start node
  • Results from previous steps
  • Workflow parameters

An execution is a running instance of a workflow. It maintains:

  • Current position - Which node is active
  • Context - Variables and step results
  • History - Completed steps and outcomes

Moira connects to AI agents via Model Context Protocol. The MCP server provides tools for:

ToolPurpose
listBrowse available workflows
startBegin workflow execution
stepExecute current step and advance
manageCreate, edit, and retrieve workflows
sessionGet user info and active executions