| Crates.io | miyabi-workflow |
| lib.rs | miyabi-workflow |
| version | 0.1.2 |
| created_at | 2025-11-22 07:46:28.240114+00 |
| updated_at | 2025-11-22 07:46:28.240114+00 |
| description | Workflow DSL for Miyabi - Graph-based agent orchestration with .then(), .branch(), .parallel() |
| homepage | |
| repository | https://github.com/ShunsukeHayashi/Miyabi |
| max_upload_size | |
| id | 1945035 |
| size | 87,361 |
Workflow DSL for Miyabi - Define and execute agent workflows with conditional branching and state persistence.
.step() and .then() for sequential steps.parallel() for concurrent tasks.branch() and .branch_on() for dynamic pathsuse miyabi_workflow::{WorkflowBuilder, Condition};
use miyabi_types::agent::AgentType;
// Define a workflow
let workflow = WorkflowBuilder::new("deployment-pipeline")
.step("analyze", AgentType::IssueAgent)
.then("test", AgentType::CodeGenAgent)
.branch_on("quality-gate", vec![
("high", Condition::FieldGreaterThan {
field: "quality_score".into(),
value: 0.9
}, "deploy"),
("low", Condition::Always, "review"),
])
.step("deploy", AgentType::DeploymentAgent)
.step("review", AgentType::ReviewAgent);
// Build DAG
let dag = workflow.build_dag()?;
let workflow = WorkflowBuilder::new("test-workflow")
.step("test", AgentType::CodeGenAgent)
.branch("quality-check", "deploy", "reject");
use miyabi_workflow::Condition;
let workflow = WorkflowBuilder::new("custom-workflow")
.step("analyze", AgentType::IssueAgent)
.branch_on("decision", vec![
("high-priority", Condition::FieldEquals {
field: "priority".into(),
value: json!("P0")
}, "fast-track"),
("normal", Condition::Always, "standard-review"),
]);
Condition::Always - Always evaluates to true (fallback branch)Condition::FieldEquals { field, value } - Field equals a specific valueCondition::FieldGreaterThan { field, value } - Numeric field > thresholdCondition::FieldLessThan { field, value } - Numeric field < thresholdCondition::FieldExists { field } - Field exists in contextCondition::And(vec![...]) - All conditions must be trueCondition::Or(vec![...]) - At least one condition must be trueCondition::Not(Box::new(...)) - Negate a conditionuse miyabi_agent_coordinator::CoordinatorAgent;
let coordinator = CoordinatorAgent::new(config);
// Execute workflow with state tracking
let execution_state = coordinator
.execute_workflow(&workflow, Some("./data/workflow-state"))
.await?;
println!("Status: {:?}", execution_state.status);
println!("Completed steps: {:?}", execution_state.completed_steps);
The workflow execution state is automatically persisted:
use miyabi_workflow::StateStore;
let state_store = StateStore::with_path("./data/workflow-state")?;
// Load execution state
if let Some(state) = state_store.load_execution(&workflow_id)? {
println!("Workflow status: {:?}", state.status);
println!("Current step: {:?}", state.current_step);
}
This crate is designed to work with:
Apache-2.0