NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
types.h File Reference

Graph engine type definitions: channels, edges, nodes, events, and control flow. More...

#include <neograph/api.h>
#include <neograph/types.h>
#include <neograph/provider.h>
#include <neograph/tool.h>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <vector>
#include <cstdint>
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  neograph::graph::Channel
 A state channel that holds a value with a reducer and version tracking. More...
 
struct  neograph::graph::ChannelWrite
 Output of a node: a write to a named channel. More...
 
struct  neograph::graph::Command
 Combined routing override + state update. More...
 
struct  neograph::graph::ConditionalEdge
 A conditional edge with runtime routing based on state. More...
 
struct  neograph::graph::Edge
 A static edge connecting two nodes. More...
 
struct  neograph::graph::GraphEvent
 An event emitted during graph execution for streaming. More...
 
struct  neograph::graph::NodeContext
 Dependency injection context passed to nodes during construction. More...
 
class  neograph::graph::NodeInterrupt
 Exception thrown from inside a node to trigger a dynamic breakpoint. More...
 
struct  neograph::graph::NodeResult
 Extended result returned by node execution. More...
 
struct  neograph::graph::RetryPolicy
 Retry policy for node execution with exponential backoff. More...
 
struct  neograph::graph::Send
 Dynamic fan-out request (map-reduce pattern). More...
 

Typedefs

using neograph::graph::ConditionFn = std::function< std::string(const GraphState &)>
 Condition function signature for conditional edge routing.
 
using neograph::graph::GraphStreamCallback = std::function< void(const GraphEvent &)>
 Callback for receiving graph execution events.
 
using neograph::graph::ReducerFn = std::function< json(const json &current, const json &incoming)>
 Custom reducer function signature.
 

Enumerations

enum class  neograph::graph::ReducerType { OVERWRITE , APPEND , CUSTOM }
 Strategy for merging values when writing to a channel. More...
 
enum class  neograph::graph::StreamMode : uint8_t {
  EVENTS = 0x01 , TOKENS = 0x02 , VALUES = 0x04 , UPDATES = 0x08 ,
  DEBUG = 0x10 , ALL = 0xFF
}
 Bitfield flags for selecting which events to stream during execution. More...
 

Functions

bool neograph::graph::has_mode (StreamMode flags, StreamMode test)
 Check if a specific stream mode flag is set.
 
StreamMode neograph::graph::operator& (StreamMode a, StreamMode b)
 Bitwise AND for StreamMode flags.
 
StreamMode neograph::graph::operator| (StreamMode a, StreamMode b)
 Bitwise OR for StreamMode flags.
 

Variables

constexpr const char * neograph::graph::END_NODE = "__end__"
 Special node name representing the graph exit point.
 
constexpr const char * neograph::graph::START_NODE = "__start__"
 Special node name representing the graph entry point.
 

Detailed Description

Graph engine type definitions: channels, edges, nodes, events, and control flow.

Contains all the foundational types used by the graph execution engine, including reducers, channels, edges, Send/Command control flow, retry policies, stream modes, and graph events.

Definition in file types.h.

Typedef Documentation

◆ ConditionFn

using neograph::graph::ConditionFn = typedef std::function<std::string(const GraphState&)>

Condition function signature for conditional edge routing.

Parameters
stateThe current graph state to evaluate.
Returns
A string key that is matched against ConditionalEdge::routes.

Definition at line 314 of file types.h.

◆ GraphStreamCallback

using neograph::graph::GraphStreamCallback = typedef std::function<void(const GraphEvent&)>

Callback for receiving graph execution events.

Parameters
eventThe graph event to process.

Definition at line 287 of file types.h.

◆ ReducerFn

using neograph::graph::ReducerFn = typedef std::function<json(const json& current, const json& incoming)>

Custom reducer function signature.

Parameters
currentThe current value in the channel.
incomingThe new value being written.
Returns
The merged result.

Definition at line 65 of file types.h.

Enumeration Type Documentation

◆ ReducerType

enum class neograph::graph::ReducerType
strong

Strategy for merging values when writing to a channel.

Enumerator
OVERWRITE 

Replace the current value entirely.

APPEND 

Append to the current value (arrays are concatenated).

CUSTOM 

Use a custom reducer function.

Definition at line 53 of file types.h.

◆ StreamMode

enum class neograph::graph::StreamMode : uint8_t
strong

Bitfield flags for selecting which events to stream during execution.

Combine with bitwise OR to select multiple event types:

StreamMode mode = StreamMode::EVENTS | StreamMode::TOKENS;
Enumerator
EVENTS 

NODE_START, NODE_END, INTERRUPT, ERROR events.

TOKENS 

LLM_TOKEN events (streaming tokens).

VALUES 

Full state snapshot after each super-step.

UPDATES 

Channel write deltas per node.

DEBUG 

Internal debug info (retry attempts, routing decisions).

ALL 

All event types.

Definition at line 194 of file types.h.

Function Documentation

◆ has_mode()

bool neograph::graph::has_mode ( StreamMode  flags,
StreamMode  test 
)
inline

Check if a specific stream mode flag is set.

Parameters
flagsThe combined StreamMode bitfield.
testThe flag to test for.
Returns
True if the flag is set.

Definition at line 221 of file types.h.

References neograph::graph::has_mode().

Referenced by neograph::graph::has_mode().

◆ operator&()

StreamMode neograph::graph::operator& ( StreamMode  a,
StreamMode  b 
)
inline

Bitwise AND for StreamMode flags.

Parameters
aLeft operand.
bRight operand.
Returns
Intersection of StreamMode flags.

Definition at line 214 of file types.h.

References neograph::graph::operator&().

Referenced by neograph::graph::operator&().

◆ operator|()

StreamMode neograph::graph::operator| ( StreamMode  a,
StreamMode  b 
)
inline

Bitwise OR for StreamMode flags.

Parameters
aLeft operand.
bRight operand.
Returns
Combined StreamMode flags.

Definition at line 207 of file types.h.

References neograph::graph::operator|().

Referenced by neograph::graph::operator|().