-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture C++ Engine
Devrajsinh Gohil edited this page Aug 30, 2026
·
1 revision
The core execution engine is implemented in Phase1/python_adapter/agentmesh_pybind.cpp.
Represents an immutable node definition in the compiled DAG:
struct FastNode {
std::string id;
PyObject* callable{nullptr};
PyObject* router{nullptr};
std::vector<int> staticSuccessorIndices;
int inDegree{0};
};Represents a scheduled unit of execution:
struct WaveItem {
int nodeIndex{-1};
PyObject* customArg{nullptr}; // Non-null for Send() dynamic map-reduce
};py::dict run(py::dict initialState, int maxLoops = 100) {
PyObject* stateObj = initialState.ptr();
std::vector<WaveItem> currentWave = { WaveItem{.nodeIndex = entryIndex_, .customArg = nullptr} };
int loopCount = 0;
while (!currentWave.empty() && loopCount < maxLoops) {
loopCount++;
// 1. Execute wave items concurrently
std::vector<std::pair<int, PyObject*>> waveResults;
executeWave(currentWave, stateObj, waveResults);
// 2. State Reduction & Command Routing Extraction
std::vector<WaveItem> nextWave;
for (auto& [nodeIdx, resultObj] : waveResults) {
// Apply updates to stateObj via reducers...
}
// 3. Resolve downstream transitions (Routers & Barrier Joins)
// ...
currentWave = nextWave;
}
return initialState;
}
```\nGetting Started
How-To Guides
- Compile a Graph
- Annotated Reducers
- Parallel Fanout
- Send() Map-Reduce
- Command() Routing
- Nested Subgraphs
- Async & Streaming
- Checkpointing & State
- Financial Swarm Example
Architecture
- System Overview
- C++ Engine Internals
- O(1) Scheduler
- Dual-Tier Graph
- Persistence & WAL
- Zero-Copy Pybind Bridge
- SOLID Design Principles
API Reference
Benchmarks
Contributing