NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <neograph/api.h>
13#include <neograph/provider.h>
14#include <neograph/tool.h>
15#include <neograph/tool_set.h>
16#include <neograph/types.h>
17
18#include <chrono>
19#include <cstddef>
20#include <cstdint>
21#include <exception>
22#include <functional>
23#include <map>
24#include <memory>
25#include <optional>
26#include <stdexcept>
27#include <string>
28#include <string_view>
29#include <variant>
30#include <vector>
31
32// Windows SDK (pulled in transitively via asio on Win32) defines a
33// bunch of ALL-CAPS macros — notably ERROR (wingdi.h) and DEBUG —
34// that silently clobber enumerator names. `enum class Type { ERROR }`
35// below becomes `enum class Type { 0 }` and every downstream parse
36// collapses. Scrub the ones we actually use before declaring the
37// enums. No-op outside of Windows.
38#ifdef _WIN32
39# ifdef ERROR
40# undef ERROR
41# endif
42# ifdef DEBUG
43# undef DEBUG
44# endif
45# ifdef IN
46# undef IN
47# endif
48# ifdef OUT
49# undef OUT
50# endif
51#endif
52
53namespace neograph::graph {
54
55// Forward declaration
56class GraphState;
57
61enum class ReducerType {
62 OVERWRITE,
63 APPEND,
64 CUSTOM
65};
66
74enum class ChannelRetentionPolicy : std::uint8_t {
75 Unbounded,
76 Latest,
77 Bounded,
78};
79
83enum class ChannelPersistencePolicy : std::uint8_t {
85 Ephemeral,
86};
87
88struct ChannelLifecyclePolicy {
89 ChannelRetentionPolicy retention = ChannelRetentionPolicy::Unbounded;
90 std::uint64_t retention_limit = 0;
91 ChannelPersistencePolicy persistence = ChannelPersistencePolicy::Checkpoint;
92
93 bool operator==(const ChannelLifecyclePolicy&) const = default;
94};
95
96
103using ReducerFn = std::function<json(const json& current, const json& incoming)>;
104
113struct Channel {
114 std::string name;
115 ReducerType reducer_type = ReducerType::OVERWRITE;
117 ChannelLifecyclePolicy lifecycle;
118 json value;
122 uint64_t version = 0;
123};
124
130 enum class Mode {
133 Reduce,
137 Overwrite,
138 };
139
140 std::string channel;
141 json value;
144 std::shared_ptr<const std::vector<sp::Message>> native_messages;
145};
146
147inline ChannelWrite provider_messages_write(std::vector<sp::Message> messages,
149 json projection = json::array();
150 for (const auto& message : messages) {
151 json item;
152 to_json(item, project_message(message));
153 projection.push_back(std::move(item));
154 }
155 return ChannelWrite{"messages", std::move(projection), mode,
156 std::make_shared<const std::vector<sp::Message>>(std::move(messages))};
157}
158
159inline ChannelWrite provider_messages_write(const sp::runtime::Result& outcome,
161 if (!outcome) throw std::invalid_argument("Provider returned no owned outcome");
162 const auto& messages = outcome_messages(*outcome);
163 json projection = json::array();
164 for (const auto& message : messages) {
165 json item;
166 to_json(item, project_message(message));
167 projection.push_back(std::move(item));
168 }
169 return ChannelWrite{"messages", std::move(projection), mode,
170 std::shared_ptr<const std::vector<sp::Message>>(outcome, &messages)};
171}
172
200class NEOGRAPH_API NodeInterrupt : public std::runtime_error {
201public:
204 explicit NodeInterrupt(const std::string& reason)
205 : std::runtime_error(reason), reason_(reason) {}
206
211 NodeInterrupt(const std::string& reason, json value)
212 : std::runtime_error(reason), reason_(reason),
213 value_(std::move(value)) {}
214
217 const std::string& reason() const { return reason_; }
218
221 const json& value() const { return value_; }
222
228 const std::string& node() const { return node_; }
229
231 void set_node(std::string node) { node_ = std::move(node); }
232
233private:
234 std::string reason_;
235 json value_;
236 std::string node_;
237};
238
252 std::string id;
253 std::string node;
256 json value;
257
258 bool operator==(const PendingInterrupt&) const = default;
259};
260
268class NEOGRAPH_API NodeExecutionError : public std::runtime_error {
269public:
270 NodeExecutionError(std::string node_name, int attempts,
271 std::exception_ptr cause)
272 : std::runtime_error(make_message(node_name, attempts, cause)),
273 node_name_(std::move(node_name)), attempts_(attempts),
274 cause_(std::move(cause)) {}
275
276 const std::string& node_name() const noexcept { return node_name_; }
277 int attempts() const noexcept { return attempts_; }
278 const std::exception_ptr& cause() const noexcept { return cause_; }
279
280private:
281 static std::string make_message(const std::string& node_name, int attempts,
282 const std::exception_ptr& cause) {
283 std::string detail = "unknown exception";
284 try {
285 if (cause) std::rethrow_exception(cause);
286 } catch (const std::exception& e) {
287 detail = e.what();
288 } catch (...) {}
289 return "Node '" + node_name + "' failed after "
290 + std::to_string(attempts) + " attempt(s): " + detail;
291 }
292
293 std::string node_name_;
294 int attempts_;
295 std::exception_ptr cause_;
296};
297
308enum class NodeFailureClass : std::uint8_t {
311 Ordinary = 0,
314 Timeout = 1,
318 ProviderFailed = 2,
322 EffectCommitted = 3,
324 LogicError = 4,
327 ConfigError = 5,
329 SafetyBlocked = 6,
331 BudgetExhausted = 7,
334 EffectUncertain = 8,
337 Unknown = 9,
339 Interrupted = 10,
341 HookBlocked = 11,
343 Cancelled = 12,
344};
345
347enum class NodeFailureKind : std::uint8_t {
348 Exhausted,
355 Deadline,
358 Ceiling,
362};
363
367 NodeFailureClass failure_class = NodeFailureClass::Unknown;
369 std::string code;
371 std::string public_message;
377 bool retryable = false;
383 bool retryable_by_class = false;
384 bool routable = false;
389 std::exception_ptr signal;
390};
391
392class CancelToken;
393
400NEOGRAPH_API FailureVerdict classify_failure(const std::exception_ptr& error,
401 const CancelToken* run_token = nullptr) noexcept;
402
404NEOGRAPH_API const char* node_failure_code(NodeFailureClass failure_class) noexcept;
406NEOGRAPH_API bool node_failure_retryable(NodeFailureClass failure_class) noexcept;
408NEOGRAPH_API bool node_failure_routable(NodeFailureClass failure_class) noexcept;
411NEOGRAPH_API const char* to_string(NodeFailureKind kind) noexcept;
414NEOGRAPH_API bool is_author_failure_code(std::string_view code) noexcept;
415
419 std::string tool;
420 std::uint64_t ordinal = 0;
421 std::string status;
422 bool operator==(const NodeFailureEffect&) const = default;
423};
424
435 std::string node;
437 std::string code;
438 std::string public_message;
439 NodeFailureClass failure_class = NodeFailureClass::Ordinary;
440 NodeFailureKind kind = NodeFailureKind::NonRetryable;
443 bool retryable = false;
444 bool routable = false;
446 int attempts = 0;
451 std::vector<NodeFailureEffect> effects;
452};
453
466class NEOGRAPH_API NodeFailureError : public std::runtime_error {
467public:
468 explicit NodeFailureError(std::string code, std::string public_message = {},
469 std::optional<bool> retryable = std::nullopt)
470 : NodeFailureError(what_of(code, public_message), code, public_message, retryable) {}
471
473 const std::string& code() const noexcept { return code_; }
474 const std::string& public_message() const noexcept { return public_message_; }
475 std::optional<bool> retryable() const noexcept { return retryable_; }
476
477protected:
480 NodeFailureError(std::string what, std::string code, std::string public_message,
481 std::optional<bool> retryable)
482 : std::runtime_error(std::move(what)), code_(std::move(code)),
483 public_message_(std::move(public_message)), retryable_(retryable) {}
484
485private:
486 static std::string what_of(const std::string& code, const std::string& public_message) {
487 if (!is_author_failure_code(code))
488 throw std::invalid_argument(
489 "NodeFailureError code must match [a-z][a-z0-9_]*(.[a-z0-9_]+)+ "
490 "and must not use the reserved NG. prefix");
491 return public_message.empty() ? code : code + ": " + public_message;
492 }
493
494 std::string code_;
495 std::string public_message_;
496 std::optional<bool> retryable_;
497};
498
511class NEOGRAPH_API RemoteControlFailure : public NodeFailureError {
512public:
515 RemoteControlFailure(const std::string& code, const std::string& public_message)
516 : NodeFailureError(what_of(code, public_message), checked(code), public_message,
517 false) {}
518
519private:
520 static std::string checked(const std::string& code) {
521 if (code != "NG.HookBlocked" && code != "NG.Interrupted")
522 throw std::invalid_argument(
523 "RemoteControlFailure code must be NG.HookBlocked or NG.Interrupted");
524 return code;
525 }
526 static std::string what_of(const std::string& code, const std::string& public_message) {
527 return public_message.empty() ? code : code + ": " + public_message;
528 }
529};
530
542class NEOGRAPH_API NodeAttemptTimeout : public std::runtime_error {
543public:
544 NodeAttemptTimeout(std::string node, int attempt, std::chrono::milliseconds timeout,
545 bool stopped)
546 : std::runtime_error(what_of(node, attempt, timeout, stopped)), node_(std::move(node)),
547 attempt_(attempt), timeout_(timeout), stopped_(stopped) {}
548
550 const std::string& node() const noexcept { return node_; }
552 int attempt() const noexcept { return attempt_; }
553 std::chrono::milliseconds timeout() const noexcept { return timeout_; }
555 bool stopped() const noexcept { return stopped_; }
556
557private:
558 static std::string what_of(const std::string& node, int attempt,
559 std::chrono::milliseconds timeout, bool stopped) {
560 auto text = "Node '" + node + "' attempt " + std::to_string(attempt + 1) +
561 " timed out after " + std::to_string(timeout.count()) + " ms";
562 if (!stopped) text += " and did not stop by its stop deadline; its effects are uncertain";
563 return text;
564 }
565
566 std::string node_;
567 int attempt_ = 0;
568 std::chrono::milliseconds timeout_{0};
569 bool stopped_ = true;
570};
571
574NEOGRAPH_API const NodeFailure* node_failure_of(const NodeExecutionError& error) noexcept;
576NEOGRAPH_API std::optional<NodeFailure> node_failure_of(const std::exception_ptr& error);
577
592using FailureTextRedactor = std::function<std::string(const NodeFailure& failure)>;
593
595inline constexpr const char* kVisitLimitCode = "NG.VisitLimit";
597inline constexpr const char* kAbortedCode = "NG.Aborted";
598
637struct Send {
638 std::string target_node;
639 json input;
640 // Filled by GraphEngine when it collects a node's output. User-created
641 // Sends leave this empty until they are returned from a node.
642 std::string source_node;
643};
644
656struct Command {
657 std::string goto_node;
658 std::vector<ChannelWrite> updates;
659};
660
669 int max_retries = 0;
671 float backoff_multiplier = 2.0f;
672 int max_delay_ms = 5000;
679 float jitter_pct = 0.0f;
680};
681
690enum class StreamMode : uint8_t {
691 EVENTS = 0x01,
692 TOKENS = 0x02,
693 VALUES = 0x04,
694 UPDATES = 0x08,
695 DEBUG = 0x10,
696 ALL = 0xFF
697};
698
704 return static_cast<StreamMode>(static_cast<uint8_t>(a) | static_cast<uint8_t>(b));
705}
711 return static_cast<StreamMode>(static_cast<uint8_t>(a) & static_cast<uint8_t>(b));
712}
717inline bool has_mode(StreamMode flags, StreamMode test) {
718 return static_cast<uint8_t>(flags & test) != 0;
719}
720
724struct Edge {
725 std::string from;
726 std::string to;
727};
728
736 std::string from;
737 std::string condition;
738 std::map<std::string, std::string> routes;
739};
740
743constexpr const char* DEFAULT_ROUTE = "default";
744class GraphRegistry;
745
746
754 std::shared_ptr<Provider> provider;
760 std::string model;
761 std::string instructions;
765 std::vector<ChatTool> tool_definitions;
768 std::string provider_name;
770 std::shared_ptr<const GraphRegistry> registry;
772};
773
779 enum class Type {
780 NODE_START,
781 NODE_END,
782 LLM_TOKEN,
784 INTERRUPT,
785 ERROR
786 };
788 std::string node_name;
789 json data;
790};
791
794 std::string node_name;
795 std::optional<int> retry_attempt;
796 json data;
797};
798
801 std::string node_name;
802 std::optional<std::string> command_goto;
803 std::size_t send_count = 0;
804 json data;
805};
806
809 std::string node_name;
810 std::string token;
811};
812
815 std::string node_name;
816 std::string channel;
817 json value;
818};
819
822 json state;
823};
824
827 std::optional<std::string> command_goto;
828 std::vector<std::string> next_nodes;
829 std::optional<int> step;
830 json data;
831};
832
835 std::vector<Send> sends;
836};
837
840 std::string node_name;
841 std::optional<std::string> phase;
842 std::optional<std::string> checkpoint_id;
843 json data;
844};
845
848 std::string node_name;
849 std::string message;
850 json data;
851};
852
855 GraphEvent event;
856};
857
858using TypedGraphEvent = std::variant<NodeStartEvent,
868
877NEOGRAPH_API TypedGraphEvent to_typed_event(const GraphEvent& event);
878
881using GraphStreamCallback = std::function<void(const GraphEvent&)>;
882
884using TypedGraphStreamCallback = std::function<void(const TypedGraphEvent&)>;
885
888 if (!callback) return {};
889 return [callback = std::move(callback)](const GraphEvent& event) {
890 callback(to_typed_event(event));
891 };
892}
893
903 std::vector<ChannelWrite> writes;
904 std::optional<Command> command;
905 std::vector<Send> sends;
906
907 NodeResult() = default;
908
911 NodeResult(std::vector<ChannelWrite> w) : writes(std::move(w)) {}
912};
913
919using ConditionFn = std::function<std::string(const GraphState&)>;
920
922constexpr const char* START_NODE = "__start__";
924constexpr const char* END_NODE = "__end__";
925
926} // namespace neograph::graph
NEOGRAPH_API export/import macro for shared-library builds.
Copyable owner of a fixed collection of tools.
Definition tool_set.h:21
Cooperative cancel primitive shared between caller and engine.
Definition cancel.h:82
Engine-owned registry of custom graph callables.
Definition registry.h:21
Thread-safe container for all graph state channels.
Definition state.h:55
A node attempt ran past its attempt_timeout_ms (#364).
Definition types.h:542
int attempt() const noexcept
The attempt that timed out: 0 for the first one.
Definition types.h:552
bool stopped() const noexcept
The cancelled attempt stopped before its stop deadline.
Definition types.h:555
const std::string & node() const noexcept
The node whose attempt timed out.
Definition types.h:550
A node failure annotated by the executor with dispatch context.
Definition types.h:268
Fail a node with an author code.
Definition types.h:466
NodeFailureError(std::string what, std::string code, std::string public_message, std::optional< bool > retryable)
For bindings that translate a foreign error: what() keeps that error's text.
Definition types.h:480
const std::string & code() const noexcept
The author code; empty when the failure carries none (NG.TaskFailed).
Definition types.h:473
Exception thrown from inside a node to trigger a dynamic breakpoint.
Definition types.h:200
NodeInterrupt(const std::string &reason, json value)
Construct a NodeInterrupt carrying a structured payload.
Definition types.h:211
void set_node(std::string node)
Record the throwing node's name. Called by the executor.
Definition types.h:231
const std::string & node() const
The node that threw this interrupt.
Definition types.h:228
const std::string & reason() const
Get the interrupt reason.
Definition types.h:217
NodeInterrupt(const std::string &reason)
Construct a NodeInterrupt with a reason message.
Definition types.h:204
const json & value() const
Get the structured payload.
Definition types.h:221
A run control signal a remote peer reported for one call.
Definition types.h:511
RemoteControlFailure(const std::string &code, const std::string &public_message)
code is "NG.HookBlocked" or "NG.Interrupted"; anything else throws std::invalid_argument.
Definition types.h:515
Marker for exceptions that are configuration or definition verdicts (#364).
std::function< void(const GraphEvent &)> GraphStreamCallback
Callback for receiving graph execution events.
Definition types.h:881
constexpr const char * START_NODE
Special node name representing the graph entry point.
Definition types.h:922
NodeFailureKind
Why the executor stopped trying a failed node.
Definition types.h:347
@ Deadline
The backoff before the next attempt would cross the run's deadline (RunContext::deadline,...
@ Ceiling
The run-level retry ceiling (Program RunBudget::max_node_retries) was reached before a retry.
@ NonRetryable
The failure's class, the author's hint or the node's non_retryable codes rule out a retry.
@ VisitLimit
The node was activated once more than its max_visits; it did not run (code NG.VisitLimit,...
@ Exhausted
Retryable, but every allowed attempt failed.
std::function< std::string(const NodeFailure &failure)> FailureTextRedactor
Decides the free text a failure record may carry (#364).
Definition types.h:592
GraphStreamCallback adapt_typed_stream(TypedGraphStreamCallback callback)
Adapt a typed callback to the existing GraphStreamCallback surface.
Definition types.h:887
NEOGRAPH_API TypedGraphEvent to_typed_event(const GraphEvent &event)
Convert the stable GraphEvent wire shape to an owning typed event.
StreamMode operator|(StreamMode a, StreamMode b)
Bitwise OR for StreamMode flags.
Definition types.h:703
ChannelRetentionPolicy
Retention policy applied after a channel reducer produces a value.
Definition types.h:74
@ Unbounded
Keep the reducer result unchanged.
@ Bounded
Keep at most retention_limit newest array elements.
@ Latest
Keep the newest array element (as a one-element array).
bool has_mode(StreamMode flags, StreamMode test)
Check if a specific stream mode flag is set.
Definition types.h:717
constexpr const char * END_NODE
Special node name representing the graph exit point.
Definition types.h:924
StreamMode
Bitfield flags for selecting which events to stream during execution.
Definition types.h:690
@ TOKENS
LLM_TOKEN events (streaming tokens).
@ UPDATES
Channel write deltas per node.
@ EVENTS
NODE_START, NODE_END, INTERRUPT, ERROR events.
@ VALUES
Full state snapshot after each super-step.
@ DEBUG
Internal debug info (retry attempts, routing decisions).
NEOGRAPH_API FailureVerdict classify_failure(const std::exception_ptr &error, const CancelToken *run_token=nullptr) noexcept
Classify any failure the way the node retry loop and every tool path do: the most severe class found ...
NodeFailureClass
What a node failure means for retry and for failure routing.
Definition types.h:308
@ ConfigError
NG.ConfigError: configuration or misuse, including provider request, authentication and permission fa...
@ ProviderFailed
NG.ProviderFailed: a transient provider failure (transport, timeout, server, overloaded,...
@ BudgetExhausted
NG.BudgetExhausted: budget or quota exhaustion.
@ SafetyBlocked
NG.SafetyBlocked: a provider safety block.
@ Ordinary
NG.TaskFailed, NG.SubgraphFailed or an author code.
@ EffectCommitted
NG.EffectCommitted: the attempt committed a non-idempotent effect, so running the node again could re...
@ EffectUncertain
NG.EffectUncertain: an effect whose outcome is not known (ProviderOutcomeError, an unconfirmed Tool e...
@ LogicError
NG.LogicError: std::logic_error, which includes integrity checks.
@ HookBlocked
Run control: HookBoundaryBlocked. Stops the run as before.
@ Timeout
NG.Timeout: the attempt ran past its attempt_timeout_ms, was cancelled, and stopped (NodeAttemptTimeo...
constexpr const char * kAbortedCode
NG.Aborted: the code of a failure exit that declares none.
Definition types.h:597
StreamMode operator&(StreamMode a, StreamMode b)
Bitwise AND for StreamMode flags.
Definition types.h:710
std::function< json(const json &current, const json &incoming)> ReducerFn
Custom reducer function signature.
Definition types.h:103
constexpr const char * DEFAULT_ROUTE
Reserved route key selected when an open/unspecified condition returns no exact match.
Definition types.h:743
ReducerType
Strategy for merging values when writing to a channel.
Definition types.h:61
@ OVERWRITE
Replace the current value entirely.
@ APPEND
Append to the current value (arrays are concatenated).
@ CUSTOM
Use a custom reducer function.
NEOGRAPH_API const NodeFailure * node_failure_of(const NodeExecutionError &error) noexcept
The record the executor attached to error, or null when the executor's retry loop did not throw error...
std::function< std::string(const GraphState &)> ConditionFn
Condition function signature for conditional edge routing.
Definition types.h:919
NEOGRAPH_API bool is_author_failure_code(std::string_view code) noexcept
True for an author code: [a-z][a-z0-9_]*(\.
constexpr const char * kVisitLimitCode
NG.VisitLimit: the code of a node activated once more than its max_visits.
Definition types.h:595
ChannelPersistencePolicy
Whether a channel value is part of serialized checkpoints.
Definition types.h:83
@ Ephemeral
Omit value; checkpoint resume rejects written ephemeral state.
std::function< void(const TypedGraphEvent &)> TypedGraphStreamCallback
Callback for the additive typed event view.
Definition types.h:884
Typed per-call controls translated into the selected SDK provider family.
Definition provider.h:118
Typed channel update event.
Definition types.h:814
Output of a node: a write to a named channel.
Definition types.h:128
json value
Value to write.
Definition types.h:141
Mode mode
Default preserves the pre-#91 behavior.
Definition types.h:142
std::shared_ptr< const std::vector< sp::Message > > native_messages
Authoritative ordered provider messages paired with this portable write.
Definition types.h:144
Mode
What the write means for the channel's current value (issue #91).
Definition types.h:130
@ Overwrite
Replace the channel's value outright, ignoring the reducer.
@ Reduce
Feed the value through the channel's reducer.
std::string channel
Target channel name.
Definition types.h:140
A state channel that holds a reducer, lifecycle policy, and version.
Definition types.h:113
ReducerType reducer_type
Merge strategy.
Definition types.h:115
ChannelLifecyclePolicy lifecycle
Retention and persistence policy.
Definition types.h:117
uint64_t version
Value of the state's single write counter (GraphState::global_version) at this channel's last write; ...
Definition types.h:122
json value
Current channel value.
Definition types.h:118
ReducerFn reducer
Custom reducer (when type == CUSTOM).
Definition types.h:116
std::string name
Channel name.
Definition types.h:114
Serialized snapshot of graph execution state at a single super-step.
Definition checkpoint.h:173
Combined routing override + state update.
Definition types.h:656
std::vector< ChannelWrite > updates
State updates to apply before routing.
Definition types.h:658
std::string goto_node
Next node to execute (overrides edge routing).
Definition types.h:657
A conditional edge with runtime routing based on state.
Definition types.h:735
std::string from
Source node name.
Definition types.h:736
std::string condition
Condition function name in ConditionRegistry.
Definition types.h:737
std::map< std::string, std::string > routes
Mapping of condition result to destination node.
Definition types.h:738
A static edge connecting two nodes.
Definition types.h:724
std::string to
Destination node name.
Definition types.h:726
std::string from
Source node name.
Definition types.h:725
Typed execution error event. data preserves retry diagnostics.
Definition types.h:847
The node failure classifier's verdict on any failure (see classify_failure).
Definition types.h:366
std::exception_ptr signal
For the run control classes, the signal itself as found in the cause chain: the HookBoundaryBlocked,...
Definition types.h:389
bool retryable
Sending the same request again may succeed: retryable_by_class, unless the node's retry loop already ...
Definition types.h:377
std::string code
"NG.TaskFailed", "NG.HookBlocked", "NG.Cancelled", an author code, ...
Definition types.h:369
std::string public_message
Text from typed safe sources only (NodeFailureError::public_message).
Definition types.h:371
bool retryable_by_class
The failure's class and hints allow a retry, whether or not attempts were left: NodeFailure::retryabl...
Definition types.h:383
An event emitted during graph execution for streaming.
Definition types.h:777
json data
Event-specific data payload.
Definition types.h:789
std::string node_name
Name of the node that generated this event.
Definition types.h:788
Type type
The event type.
Definition types.h:787
Type
Event type enumeration.
Definition types.h:779
@ NODE_START
A node began execution.
@ LLM_TOKEN
A token was received from the LLM.
@ CHANNEL_WRITE
A value was written to a channel.
@ INTERRUPT
Execution was interrupted (HITL).
@ ERROR
An error occurred during execution.
@ NODE_END
A node finished execution.
Typed HITL interrupt event. data remains available for custom metadata.
Definition types.h:839
Typed LLM token event.
Definition types.h:808
Dependency injection context passed to nodes during construction.
Definition types.h:753
std::shared_ptr< Provider > provider
LLM provider for making completions.
Definition types.h:754
json extra_config
Additional configuration (node-type specific).
Definition types.h:762
std::shared_ptr< const GraphRegistry > registry
Construction-only registry snapshot inherited by built-in subgraphs.
Definition types.h:770
std::string model
Model name override (empty = use provider default).
Definition types.h:760
std::string provider_name
Identity metadata for an admitted Provider requirement.
Definition types.h:768
std::vector< ChatTool > tool_definitions
Non-executable metadata for an admitted node's exact Tool requirements.
Definition types.h:765
ProviderControls provider_controls
Explicit typed admission controls, including finite output cap.
Definition types.h:771
ToolSet tools
Owned tool collection, shared cheaply across copies of this context, the compiled graph,...
Definition types.h:759
std::string instructions
System prompt / instructions for the LLM.
Definition types.h:761
Typed view of a node-end event. data preserves extension fields.
Definition types.h:800
One mediated Tool effect of a node attempt, as seen by the run's ToolEffectBroker.
Definition types.h:418
The classified outcome of a failed node.
Definition types.h:433
std::string code
"NG.TaskFailed", "NG.SubgraphFailed", an author code, ...
Definition types.h:437
int attempts
Attempts made, counting attempts made before a crash-resume.
Definition types.h:446
bool retryable
The failure itself was retryable (its class and the author's hint), whether or not attempts were left...
Definition types.h:443
std::vector< NodeFailureEffect > effects
Effects of the final attempt through the run's ToolEffectBroker, in the order they settled; empty wit...
Definition types.h:451
std::string node
The node whose retry loop gave up.
Definition types.h:435
Extended result returned by node execution.
Definition types.h:902
std::vector< Send > sends
If non-empty, triggers dynamic fan-out.
Definition types.h:905
std::optional< Command > command
If set, overrides edge-based routing.
Definition types.h:904
std::vector< ChannelWrite > writes
Channel writes from this node.
Definition types.h:903
NodeResult(std::vector< ChannelWrite > w)
Construct from plain channel writes (backward compatible).
Definition types.h:911
Typed view of a node-start event. data preserves extension fields.
Definition types.h:793
One NodeInterrupt of a paused super-step (#388).
Definition types.h:248
std::string id
The paused invocation's stable task id, unique in its super-step: "s<step>:<node>" for a node of the ...
Definition types.h:252
json value
{"type": "NodeInterrupt", "reason": ..., "value": ...}, the shape of RunResult::interrupt_value ("val...
Definition types.h:256
std::string node
The node that raised it.
Definition types.h:253
Escape hatch for malformed input or payload shapes added by future versions.
Definition types.h:854
Retry policy for node execution with exponential backoff.
Definition types.h:668
int initial_delay_ms
Delay before the first retry (milliseconds).
Definition types.h:670
int max_delay_ms
Maximum delay cap (milliseconds).
Definition types.h:672
float jitter_pct
Random jitter as a fraction of the computed delay, in [0, 1].
Definition types.h:679
int max_retries
Maximum retry attempts. 0 = no retry.
Definition types.h:669
float backoff_multiplier
Multiplier applied to delay after each retry.
Definition types.h:671
Routing decision emitted for StreamMode::DEBUG.
Definition types.h:826
Dynamic Send batch emitted for StreamMode::DEBUG.
Definition types.h:834
Dynamic fan-out request (map-reduce pattern).
Definition types.h:637
json input
Channel writes for that invocation.
Definition types.h:639
std::string target_node
Node to dispatch.
Definition types.h:638
Full serialized state emitted for StreamMode::VALUES.
Definition types.h:821
Abstract tool interface for callable functions.