NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::RunConfig Struct Reference

Configuration for a graph execution run. More...

#include <engine.h>

Public Attributes

std::shared_ptr< std::atomic_bool > budget_exhausted
 Set by a node that crossed model_token_budget so the enclosing runtime can classify it.
 
std::shared_ptr< CancelToken > cancel_token
 Optional cooperative cancel handle (v0.3+).
 
json input
 Initial channel writes (e.g., {"messages": [...]}).
 
int max_steps = 50
 Safety limit for maximum super-steps per run.
 
std::uint64_t model_token_budget = 0
 Optional hard model-token ceiling enforced by budget-aware nodes.
 
std::optional< std::vector< sp::Message > > provider_messages
 Full history input; when set, replaces only the messages channel.
 
bool resume_if_exists = false
 Auto-resume from latest checkpoint for thread_id (v0.3.1+).
 
StreamMode stream_mode = StreamMode::ALL
 Which event types to emit during streaming.
 
std::string thread_id
 Thread ID for checkpoint association.
 
std::shared_ptr< UsageAccumulator > usage
 Token accounting for this run (issue #88).
 

Detailed Description

Configuration for a graph execution run.

Definition at line 225 of file engine.h.

Member Data Documentation

◆ cancel_token

std::shared_ptr<CancelToken> neograph::graph::RunConfig::cancel_token

Optional cooperative cancel handle (v0.3+).

When set, the engine super-step loop polls cancel_token->is_cancelled() between steps and bails with CancelledException. Each engine entry point forks an operation child and binds only that child's cancellation_slot to its internal work, so an in-flight LLM HTTP request gets aborted at the socket layer without sharing one slot across concurrent runs.

Default nullptr → no cancellation; existing behaviour unchanged for callers that haven't opted in.

Definition at line 250 of file engine.h.

◆ resume_if_exists

bool neograph::graph::RunConfig::resume_if_exists = false

Auto-resume from latest checkpoint for thread_id (v0.3.1+).

Default false keeps the historical behaviour: every run starts from a fresh GraphState initialized by reducers and overwritten by input. Multi-turn callers carrying prior conversation state through the input dict themselves see no change.

When true:

  1. The engine loads the latest checkpoint for thread_id (if one exists). The checkpoint's channel values seed GraphState instead of the per-channel initial values.
  2. input is then applied on top via the same reducer pipeline as a fresh run — so e.g. an APPEND messages channel grows by the new turn instead of being clobbered.
  3. The super-step loop starts at the entry node (plan_start_step) — this flag is for the multi-turn-chat use case where the previous run completed at __end__ and the caller wants to add a new user message and re-run. For HITL resume from an interrupted run, use resume() / resume_async() instead.
  4. If no checkpoint exists for thread_id, behaves as if the flag were unset (fresh run from input). No error.

Requires a configured CheckpointStore — without one the flag is a no-op.

Definition at line 291 of file engine.h.

◆ usage

std::shared_ptr<UsageAccumulator> neograph::graph::RunConfig::usage

Token accounting for this run (issue #88).

Leave null and the engine makes one; pass your own to accumulate across several runs — e.g. a per-tenant budget that spans a whole conversation rather than one turn. Whatever ends up here is what RunResult::usage reports.

Definition at line 256 of file engine.h.


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