|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
Adapter base class for tools whose work is naturally coroutine-shaped (HTTP fetch, MCP RPC, async DB query). More...
#include <tool.h>
Public Member Functions | |
| std::string | execute (const json &arguments) final |
| Sync facade — drives execute_async on a private io_context. | |
| virtual asio::awaitable< std::string > | execute_async (const json &arguments)=0 |
| Async work — override this. | |
Public Member Functions inherited from neograph::Tool | |
| virtual ChatTool | get_definition () const =0 |
| Get the tool definition metadata. | |
| virtual std::string | get_name () const =0 |
| Get the tool name. | |
Adapter base class for tools whose work is naturally coroutine-shaped (HTTP fetch, MCP RPC, async DB query).
Stage 3 / Sem 4.2. The Tool interface is intentionally sync — the Stage 3 plan freezes it so users don't have to migrate every tool to a new signature. AsyncTool keeps that contract: subclasses implement execute_async returning asio::awaitable<std::string> and AsyncTool's sync execute drives it through neograph::async::run_sync. Each invocation gets its own private io_context so the adapter is safe to call from any thread, including from inside an existing run loop.
Implementation is in async/run_sync.h via the run_sync template, so this header only needs the asio::awaitable forward declaration.
|
finalvirtual |
Sync facade — drives execute_async on a private io_context.
Implemented out-of-line in src/core/tool.cpp so the run_sync helper isn't pulled into every translation unit that includes <neograph/tool.h>.
Implements neograph::Tool.
|
pure virtual |