Skip to main content

DIAL Skills Reference

This is a consolidated reference for AI agents learning to use DIAL. For modular, downloadable skills, see the skills directory.

Quick Reference

# Install DIAL
npm install dialai

# Run a state machine
npx dialai machine.json

# Run as MCP server
npx dialai --mcp

Modular Skills

Each skill below is available as a standalone file that agents can download:

SkillFileDescription
Run MachineSKILL.mdExecute state machines from CLI
Create MachineSKILL.mdDefine state machine JSON
Add SpecialistsSKILL.mdConfigure AI and human participants
Decision CyclesSKILL.mdUnderstand the decision cycle
Programmatic UsageSKILL.mdTypeScript/JavaScript integration
MCP ServerSKILL.mdRun as MCP server for AI assistants
TroubleshootingSKILL.mdDebug common issues

Core Concepts

The Decision Cycle

Propose -> Arbitrate -> Execute -> (repeat until goalState)
  1. Propose: Proposers submit transition proposals (each proposal endorses a transition)
  2. Arbitrate: Arbiter counts proposals per transition, applies alignment margin consensus
  3. Execute: Winning transition is applied

Specialist Types

StrategyDescription
llmAI specialist using a language model
humanHuman specialist with CLI prompts
deterministicAlways takes the same action

Human Primacy

When consensus cannot be reached, only a specialist registered with isHuman: true can force a decision via submitArbitration.

Machine Definition Template

{
"machineName": "my-task",
"initialState": "pending",
"goalState": "done",
"states": {
"pending": {
"prompt": "Should we complete this task?",
"transitions": { "complete": "done" }
},
"done": {}
}
}

For machines with embedded specialists, see State Machines.

API Functions

FunctionPurpose
createSessionStart a new decision process
getSessionCheck session state
registerProposerAdd a proposer
submitProposalSubmit a transition proposal (with roundId)
submitArbitrationEvaluate consensus and execute
executeTransitionApply a transition directly

Common Patterns

Human Override

{
"specialists": [
{ "specialistId": "ai", "role": "proposer", "strategyFnName": "firstAvailable" },
{ "specialistId": "human", "role": "proposer", "isHuman": true }
]
}

Human proposals always win consensus immediately.

AI Consensus

{
"specialists": [
{ "specialistId": "ai-1", "role": "proposer", "strategyFnName": "firstAvailable" },
{ "specialistId": "ai-2", "role": "proposer", "strategyFnName": "firstAvailable" },
{ "specialistId": "ai-3", "role": "proposer", "strategyFnName": "firstAvailable" },
{ "specialistId": "arbiter", "role": "arbiter", "strategyFnName": "alignmentMargin", "threshold": 2 }
]
}

Quick Troubleshooting

ProblemSolution
Invalid machinecat machine.json | jq .
Stuck in stateRun with --verbose
No human promptsAdd --human flag
API key errorexport ANTHROPIC_API_KEY=sk-...

Further Reading