pub struct Node { /* private fields */ }Expand description
A clonable handle to a workflow with lazy loading and shared reads.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(inference: Arc<Inference>) -> Self
pub fn new(inference: Arc<Inference>) -> Self
Creates a new Node in the Pending state with the given Inference.
pub fn init_new(reference: Arc<Reference>, inference: Arc<Inference>) -> Self
pub fn init_default(reference: Arc<Reference>) -> Self
pub fn parse(input: &str) -> Result<Self>
Sourcepub fn init(&self, reference: Arc<Reference>)
pub fn init(&self, reference: Arc<Reference>)
Initializes the Node in the Unloaded state with the given Reference.
pub fn reference(&self) -> Result<Arc<Reference>>
Sourcepub fn inference(&self) -> Arc<Inference>
pub fn inference(&self) -> Arc<Inference>
Returns the inference characteristic for this workflow.
The model provides an abstraction to decouple inference from reliance on a specific underlying model. The model performance characteristic reflects one of six specializations:
- Fast - optimized for speed and low latency
- Standard - balanced performance for general use
- Thinking - optimized for complex reasoning
- Extraction - optimized for a large context window
- Instruct - optimized for closely following instructions
- Coder - optimized for programming tasks
The pattern provides an abstraction for different kinds of workflow tasks.
- Evaluate - non-agentic workflow evaluation
- Inference - general inference pattern
- Search - search extraction pattern
- Summarize - map-reduce pattern
- Compose - ReAct composer pattern for accurate annotation based document editing (Crate markdown)
- Debate - debate pattern where two agents each make an assessment; a third judge scores resolution.
Sourcepub fn get_workflow(&self) -> Result<Arc<Workflow>>
pub fn get_workflow(&self) -> Result<Arc<Workflow>>
Gets the workflow for read-only access, loading it with Workflow::load_new if needed.
Uses a double-checked lock: fast RwLock read when loaded, upgrades to
write lock to perform a single load on transition from Unloaded.
Panics on poisoned locks.
Sourcepub fn get_workflow_like(&self) -> Result<Arc<dyn WorkflowLike>>
pub fn get_workflow_like(&self) -> Result<Arc<dyn WorkflowLike>>
Returns the workflow as Arc<dyn WorkflowLike>.
Sourcepub fn get_workflow_mut(&self) -> Result<Workflow>
pub fn get_workflow_mut(&self) -> Result<Workflow>
Returns an owned Workflow for mutation.
Sourcepub fn set_workflow(&self, workflow: Workflow)
pub fn set_workflow(&self, workflow: Workflow)
Atomically replace the old workflow with the new workflow.
Sets state to Loaded with a new shared snapshot. Panics on poisoned lock.
pub fn compact(&self)
Sourcepub fn save_all(&self) -> Result<()>
pub fn save_all(&self) -> Result<()>
Recursively saves all workflows and instances within this node’s workflow hierarchy.
This method saves the current workflow if it has pending changes, then recursively saves all child nodes and instances. It handles both loaded and unloaded workflows to ensure comprehensive state persistence.
§Returns
Ok(()) if all save operations complete successfully, or an error if any
workflow or instance fails to save.
§Behavior
- Saves the current workflow if it has pending changes (
is_touched()) - Recursively saves all child nodes in the workflow
- Saves all instances within the workflow
- Handles unloaded workflows by checking if they need saving
- Fails fast on any save error to maintain consistency
pub fn print(&self, writer: &mut Writer)
Trait Implementations§
Source§impl WriterLike for Node
impl WriterLike for Node
Source§fn to_stringized(&self) -> String
fn to_stringized(&self) -> String
Source§fn to_sanitized(&self) -> String
fn to_sanitized(&self) -> String
Source§fn to_expressionized(&self) -> String
fn to_expressionized(&self) -> String
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.