pub struct DAGWorkflow {
pub name: String,
pub description: String,
/* private fields */
}
Expand description
The main orchestration structure
Fields§
§name: String
The workflow name
description: String
The workflow description
Implementations§
Source§impl DAGWorkflow
impl DAGWorkflow
Sourcepub fn register_agent(&mut self, agent: Arc<dyn Agent>)
pub fn register_agent(&mut self, agent: Arc<dyn Agent>)
Register an agent with the orchestrator
Sourcepub fn connect_agents(
&mut self,
from: &str,
to: &str,
flow: Flow,
) -> Result<EdgeIndex, GraphWorkflowError>
pub fn connect_agents( &mut self, from: &str, to: &str, flow: Flow, ) -> Result<EdgeIndex, GraphWorkflowError>
Add a flow connection between two agents
Sourcepub fn disconnect_agents(
&mut self,
from: &str,
to: &str,
) -> Result<(), GraphWorkflowError>
pub fn disconnect_agents( &mut self, from: &str, to: &str, ) -> Result<(), GraphWorkflowError>
Remove an agent connection
Sourcepub fn remove_agent(&mut self, name: &str) -> Result<(), GraphWorkflowError>
pub fn remove_agent(&mut self, name: &str) -> Result<(), GraphWorkflowError>
Remove an agent from the orchestrator
Sourcepub async fn execute_agent(
&self,
name: &str,
input: String,
) -> Result<String, GraphWorkflowError>
pub async fn execute_agent( &self, name: &str, input: String, ) -> Result<String, GraphWorkflowError>
Execute a specific agent
Sourcepub async fn execute_workflow(
&mut self,
start_agents: &[&str],
input: impl Into<String>,
) -> Result<DashMap<String, Result<String, GraphWorkflowError>>, GraphWorkflowError>
pub async fn execute_workflow( &mut self, start_agents: &[&str], input: impl Into<String>, ) -> Result<DashMap<String, Result<String, GraphWorkflowError>>, GraphWorkflowError>
Sourcepub fn get_workflow_structure(
&self,
) -> HashMap<String, Vec<(String, Option<String>)>>
pub fn get_workflow_structure( &self, ) -> HashMap<String, Vec<(String, Option<String>)>>
Get the current workflow as a visualization-friendly format
Sourcepub fn export_workflow_dot(&self) -> String
pub fn export_workflow_dot(&self) -> String
Export the workflow to a format that can be visualized (e.g., DOT format for Graphviz)
Sourcepub fn find_execution_paths(
&self,
start_agents: &[&str],
) -> Result<Vec<Vec<String>>, GraphWorkflowError>
pub fn find_execution_paths( &self, start_agents: &[&str], ) -> Result<Vec<Vec<String>>, GraphWorkflowError>
Helper method to find all possible execution paths
Sourcepub fn detect_potential_deadlocks(&self) -> Vec<Vec<String>>
pub fn detect_potential_deadlocks(&self) -> Vec<Vec<String>>
Detect potential deadlocks in the workflow. Whether there will actually be a deadlock depends on the flow at execution time.
§Info
Maybe we need a monitor to detect deadlocks instead of this function.
§Returns
Returns a vector of cycles (each cycle is a vector of agent names).
Example: vec![vec![“A”, “B”, “C”], vec![“X”, “Y”]]
Auto Trait Implementations§
impl Freeze for DAGWorkflow
impl !RefUnwindSafe for DAGWorkflow
impl !Send for DAGWorkflow
impl !Sync for DAGWorkflow
impl Unpin for DAGWorkflow
impl !UnwindSafe for DAGWorkflow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more