pub struct Graph {
pub entry: String,
pub nodes: Vec<Node>,
pub edges: Vec<Edge>,
}Expand description
The bare execution graph: an entry node, a node list, and an edge list.
Deserialised via serde and validated via Graph::validate.
Fields§
§entry: String§nodes: Vec<Node>§edges: Vec<Edge>Implementations§
Source§impl Graph
impl Graph
Sourcepub fn edges_from(&self, id: &str) -> impl Iterator<Item = &Edge>
pub fn edges_from(&self, id: &str) -> impl Iterator<Item = &Edge>
Outgoing edges for a node, in declaration order.
Sourcepub fn validate(&self, schema_version: u32) -> Result<(), String>
pub fn validate(&self, schema_version: u32) -> Result<(), String>
Validate the graph.
schema_version is passed in so that v2-only node kinds can be
rejected when the document declares schemaVersion: 1.
§Rules (v1 + v2)
- Node ids must be unique.
entrynames an existing node.- Every edge endpoint names an existing node.
- Agent and Tool nodes have exactly one outgoing edge.
- Router nodes have both a
"loop"and a"resolved"branch edge. - Respond nodes have zero outgoing edges.
- (v2) v2-kind nodes in a schemaVersion-1 document are rejected.
- (v2) Supervisor: ≥2 routes; unique branch labels; every route has exactly one matching outgoing edge; no extra outgoing edges.
- (v2) Parallel: ≥2 outgoing edges, all with unique branch labels; every branch reaches the same join node; branches are node-disjoint before the join; no nested parallel; no respond inside a branch.
- (v2) Join: ≥2 incoming edges; exactly 1 outgoing edge; only reachable via a parallel node.
- (v2) Approval: ≥1 outgoing edge (branch labels are validated
leniently — any of
approved/denied/timeoutis accepted).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Graph
impl<'de> Deserialize<'de> for Graph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request