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

Dynamic fan-out request (map-reduce pattern). More...

#include <types.h>

Public Attributes

json input
 Channel writes for that invocation.
 
std::string target_node
 Node to dispatch.
 

Detailed Description

Dynamic fan-out request (map-reduce pattern).

A node can return Send objects to dispatch the same (or different) node multiple times with different inputs. Send targets are joined as one Asio parallel group; CPU work uses multiple threads only when the caller or engine supplies a multi-threaded executor.

Isolation semantics

Each multi-Send worker runs on an isolated GraphState copy: channel writes made inside a Send target are scoped to that worker and only merged back (via each channel's reducer) after all siblings finish. Concurrent workers therefore cannot corrupt each other's channel view.

This isolation does NOT extend to out-of-state side effects. If two Send workers call the same LLM provider instance, hit the same HTTP client, or write to the same file descriptor, they do so concurrently — whatever thread safety those external objects offer is what governs the outcome. Make sure any resource a Send target touches is either thread-safe or scoped per-invocation; a shared provider handle alone does not establish that a custom implementation is concurrency-safe.

Execution trace

Each Send execution is listed in RunResult::execution_trace as "<target_node>[send]", so a node that runs by Send and by an edge shows two kinds of entry. A step lists its ready nodes first, then its Sends in the order they were emitted (the ready nodes' order, then each node's own), not in the order they finished.

NodeResult result;
for (auto& item : work_items) {
result.sends.push_back(Send{"worker_node", {{"item", item}}});
}
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
Dynamic fan-out request (map-reduce pattern).
Definition types.h:637

Definition at line 637 of file types.h.


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