pub struct ScopeNode {
pub id: NodeId,
pub name: &'static str,
/* private fields */
}Expand description
A node that executes an embedded graph with a configurable context boundary.
The embedded graph is a self-contained directed graph that is executed as a
single unit within the parent graph. The ContextPolicy controls how the
parent’s SystemContext is shared
with the embedded graph.
From the parent graph’s perspective, the scope node is a single opaque node — execution enters the scope, runs the embedded graph to completion, and exits from the scope’s outgoing edge.
Unlike decision/loop/parallel nodes, the embedded graph’s nodes are NOT merged
into the parent. The ScopeNode holds the Graph as a field.
§Examples
Scope nodes are created through the Graph builder API:
use polaris_graph::{Graph, ContextPolicy};
async fn gather_info() -> String { String::new() }
async fn summarize() -> String { String::new() }
// Build an inner graph for the sub-agent
let mut research = Graph::new();
research.add_system(gather_info).add_system(summarize);
// Embed it as a scope that chain-reads parent resources.
let mut graph = Graph::new();
graph.add_scope("research", research, ContextPolicy::new().share_rest());Fields§
§id: NodeIdUnique identifier for this node.
name: &'static strHuman-readable name for debugging and tracing.
Implementations§
Source§impl ScopeNode
impl ScopeNode
Sourcepub fn new(
name: &'static str,
graph: Graph,
context_policy: ContextPolicy,
) -> Self
pub fn new( name: &'static str, graph: Graph, context_policy: ContextPolicy, ) -> Self
Creates a new scope node.
Sourcepub fn context_policy(&self) -> &ContextPolicy
pub fn context_policy(&self) -> &ContextPolicy
Returns a reference to the context policy.