NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
server.h
Go to the documentation of this file.
1
22#pragma once
23
24#include <neograph/api.h>
25#include <neograph/a2a/types.h>
27
28#include <functional>
29#include <memory>
30#include <string>
31
32namespace neograph::a2a {
33
41class NEOGRAPH_API GraphAgentAdapter {
42 public:
43 virtual ~GraphAgentAdapter() = default;
44
46 virtual std::string input_channel() const { return "prompt"; }
47
49 virtual std::string output_channel() const { return "response"; }
50
54 virtual neograph::json build_initial_state(const std::string& user_text) const;
55};
56
68class NEOGRAPH_API A2AServer {
69 public:
73 A2AServer(std::shared_ptr<neograph::graph::GraphEngine> engine,
74 AgentCard card,
75 std::shared_ptr<GraphAgentAdapter> adapter = {});
76
77 ~A2AServer();
78
81 bool start(const std::string& host, int port);
82
85 bool start_async(const std::string& host, int port);
86
88 void stop();
89
91 bool is_running() const;
92
94 int port() const;
95
96 private:
97 struct Impl;
98 std::unique_ptr<Impl> impl_;
99};
100
101} // namespace neograph::a2a
Core data types for the Agent-to-Agent (A2A) protocol.
NEOGRAPH_API export/import macro for shared-library builds.
HTTP server exposing a NeoGraph as an A2A agent.
Definition server.h:68
bool start(const std::string &host, int port)
Bind + listen.
void stop()
Signal the server to stop accepting connections and join.
A2AServer(std::shared_ptr< neograph::graph::GraphEngine > engine, AgentCard card, std::shared_ptr< GraphAgentAdapter > adapter={})
bool is_running() const
True once start_async() has the server listening.
bool start_async(const std::string &host, int port)
Bind + spawn a worker thread; returns when the server is ready to accept connections.
int port() const
Bound port — useful when caller passed 0 to bind a free port.
Adapt a NeoGraph run to the A2A request/response shape.
Definition server.h:41
virtual std::string output_channel() const
Channel name to read the agent's text response from (default "response").
Definition server.h:49
virtual neograph::json build_initial_state(const std::string &user_text) const
Hook to populate the initial graph state.
virtual std::string input_channel() const
Channel name to write the inbound user text into (default "prompt").
Definition server.h:46
Main graph execution engine with super-step loop and HITL support.
Subset of AgentCard required to interact (spec §5.5).
Definition types.h:160