NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::RunResult Struct Reference

Result of a graph execution run. More...

#include <engine.h>

Public Member Functions

template<typename T >
channel (const std::string &name) const
 Read a channel value as type T (issue #25).
 
json channel_raw (const std::string &name) const
 Read a channel value as a raw json node (issue #25).
 
bool has_channel (const std::string &name) const noexcept
 Test whether a channel value exists in either shape.
 

Public Attributes

std::string checkpoint_id
 ID of the last checkpoint saved.
 
std::vector< std::string > execution_trace
 Ordered list of executed node names.
 
std::string interrupt_node
 Name of the node that triggered the interrupt.
 
json interrupt_value
 Value associated with the interrupt.
 
bool interrupted = false
 True if execution was interrupted (HITL).
 
json output
 Final serialized graph state. See struct docstring for shape details.
 

Detailed Description

Result of a graph execution run.

<tt>output</tt> shape (issue #25)

The canonical shape of output is channels-wrapped: each channel value lives at output["channels"][<name>]["value"], with sibling metadata such as ["version"] recording how many times the channel was written. output["global_version"] carries the super-step counter.

Some compiled flows project additional flat top-level keys for ergonomic access — e.g. react_graph exposes a synthetic output["final_response"] so the README quickstart can read the model's last reply with one bracket. These projections coexist with the channels wrapper; the wrapper is always present and is the source of truth.

Use the channel<T>(name) accessor below to read a channel value without committing to either shape — it checks the channels wrapper first, then falls back to a flat top-level key with the same name. That way the same call site works against GraphEngine::compile- built graphs (channels-wrapped only) and react_graph-built graphs (channels-wrapped + flat-key projections) alike.

Definition at line 209 of file engine.h.

Member Function Documentation

◆ channel()

template<typename T >
T neograph::graph::RunResult::channel ( const std::string &  name) const
inline

Read a channel value as type T (issue #25).

Looks up the value in output. Tries the canonical channels-wrapped path first (output["channels"][name]["value"]); falls back to a flat top-level key (output[name]) for graphs that project flat keys such as react_graph's final_response.

Exceptions
json::out_of_rangeif no channel with that name exists in either shape.
json::type_errorif the channel exists but its value cannot be converted to T (delegated to json::get<T>).
Template Parameters
TOne of the types json::get<T> is specialised for — int, long, double, std::string, bool, json, etc. See json.h.

Definition at line 234 of file engine.h.

References channel_raw().

◆ channel_raw()

json neograph::graph::RunResult::channel_raw ( const std::string &  name) const
inline

Read a channel value as a raw json node (issue #25).

Same lookup rules as channel<T> — channels-wrapped first, flat top-level key as fallback. Returns the underlying json so the caller can walk arrays / objects without committing to a scalar conversion.

Exceptions
json::out_of_rangeif no channel with that name exists in either shape.

Definition at line 247 of file engine.h.

References output.

Referenced by channel().

◆ has_channel()

bool neograph::graph::RunResult::has_channel ( const std::string &  name) const
inlinenoexcept

Test whether a channel value exists in either shape.

True if either the channels-wrapped path or a flat top-level key with the same name resolves. Useful as a guard before channel<T> when the graph may or may not have written the channel (e.g. early HITL interrupt before a node ran).

Definition at line 264 of file engine.h.

References output.


The documentation for this struct was generated from the following file: