|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
Factory for the Plan-and-Execute agent pattern. More...
#include <neograph/graph/engine.h>Go to the source code of this file.
Functions | |
| std::unique_ptr< GraphEngine > | neograph::graph::create_plan_execute_graph (std::shared_ptr< Provider > provider, std::vector< std::unique_ptr< Tool > > tools, const std::string &planner_prompt, const std::string &executor_prompt, const std::string &responder_prompt, const std::string &model="", int max_step_iterations=5) |
| Build a Plan-and-Execute graph. | |
Factory for the Plan-and-Execute agent pattern.
Produces a graph with three phases:
start → planner → [plan_empty? responder : executor] executor → [plan_empty? responder : executor] responder → end
Phase roles:
planner_prompt. The model must reply with a JSON array of strings (one step per item); the node tolerates fenced ``json blocks and leading prose. The array is written to theplanchannel.executor: Pops the next step offplan, runs an inner ReAct loop against that single step using @p executor_prompt and the shared tool set, and appends {step, result} to the past_stepschannel.responder: Composes a final answer from the original objective and the accumulatedpast_steps, using @p responder_prompt. The text lands on thefinal_responsechannel and is also appended tomessages` as an assistant turn.The factory registers its three custom node types and the plan_empty condition the first time it is called (idempotent via std::call_once).
Definition in file plan_execute_graph.h.
| std::unique_ptr< GraphEngine > neograph::graph::create_plan_execute_graph | ( | std::shared_ptr< Provider > | provider, |
| std::vector< std::unique_ptr< Tool > > | tools, | ||
| const std::string & | planner_prompt, | ||
| const std::string & | executor_prompt, | ||
| const std::string & | responder_prompt, | ||
| const std::string & | model = "", |
||
| int | max_step_iterations = 5 |
||
| ) |
Build a Plan-and-Execute graph.
| provider | LLM provider shared by every phase. |
| tools | Tools the executor may invoke (ownership transferred). |
| planner_prompt | System prompt for the planner phase. Should instruct the model to respond with a JSON array of steps. |
| executor_prompt | System prompt for the single-step executor. |
| responder_prompt | System prompt for the final synthesis phase. |
| model | Model name. Empty falls back to the provider default. |
| max_step_iterations | Max tool-call iterations inside the executor per step (safety bound on the inner ReAct loop). |
References neograph::graph::create_plan_execute_graph().
Referenced by neograph::graph::create_plan_execute_graph().