Skip to main content

WorkflowIr

Struct WorkflowIr 

Source
pub struct WorkflowIr {
Show 20 fields pub workflow_id: String, pub version: String, pub name: Option<String>, pub description: Option<String>, pub state_schema: String, pub start_node: String, pub nodes: HashMap<String, NodeDef>, pub edges: Vec<EdgeDef>, pub retry_policies: HashMap<String, RetryPolicy>, pub timeouts: TimeoutConfig, pub models: HashMap<String, ModelConfig>, pub tools: HashMap<String, ToolConfig>, pub mcp_servers: HashMap<String, McpServerConfig>, pub remote_agents: HashMap<String, RemoteAgentConfig>, pub labels: HashMap<String, String>, pub policy: Option<PolicySetIr>, pub token_budget: Option<TokenBudgetIr>, pub cost_budget_usd: Option<f64>, pub on_budget_exceeded: Option<String>, pub data_policy: Option<DataPolicyIr>,
}
Expand description

The canonical Intermediate Representation for a JamJet workflow.

Both YAML and Python workflow definitions compile to this struct before being submitted to the runtime. The IR is serializable to JSON and YAML.

Fields§

§workflow_id: String

Unique workflow definition identifier.

§version: String

Semantic version string (e.g., “1.0.0”).

§name: Option<String>

Human-readable name.

§description: Option<String>

Optional description.

§state_schema: String

Reference to the Pydantic model or JSON Schema for workflow state.

§start_node: String

The first node to execute.

§nodes: HashMap<String, NodeDef>

All nodes in the workflow graph, keyed by node id.

§edges: Vec<EdgeDef>

All edges (transitions) between nodes.

§retry_policies: HashMap<String, RetryPolicy>

Named retry policies referenced by nodes.

§timeouts: TimeoutConfig

Timeout configuration for this workflow.

§models: HashMap<String, ModelConfig>

Named model configurations referenced by model nodes.

§tools: HashMap<String, ToolConfig>

Named tool configurations referenced by tool nodes.

§mcp_servers: HashMap<String, McpServerConfig>

Named MCP server configurations.

§remote_agents: HashMap<String, RemoteAgentConfig>

Named remote A2A agents.

§labels: HashMap<String, String>

Observability labels attached to all spans from this workflow.

§policy: Option<PolicySetIr>

Workflow-level policy set (overrides global; node-level overrides this).

§token_budget: Option<TokenBudgetIr>

Per-execution token budget enforcement.

§cost_budget_usd: Option<f64>

Per-execution cost cap in USD. Execution fails / branches when exceeded.

§on_budget_exceeded: Option<String>

Node to route to when any budget is exceeded (optional). If absent, the execution fails with WorkflowFailed.

§data_policy: Option<DataPolicyIr>

Data handling policy (PII redaction + retention controls).

Implementations§

Source§

impl WorkflowIr

Source

pub fn from_json(s: &str) -> Result<Self, Error>

Parse a WorkflowIr from a JSON string.

Source

pub fn from_yaml(s: &str) -> Result<Self, Error>

Parse a WorkflowIr from a YAML string.

Source

pub fn to_json_pretty(&self) -> Result<String, Error>

Serialize to JSON (pretty-printed).

Source

pub fn node(&self, id: &str) -> Option<&NodeDef>

Look up a node by id.

Source

pub fn edges_from(&self, node_id: &str) -> Vec<&EdgeDef>

Return all edges originating from a given node.

Source

pub fn successors(&self, node_id: &str) -> Vec<&str>

Return the successors of a node (all nodes it can transition to).

Trait Implementations§

Source§

impl Clone for WorkflowIr

Source§

fn clone(&self) -> WorkflowIr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkflowIr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for WorkflowIr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for WorkflowIr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.