NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
server.h File Reference

A2A server — exposes a NeoGraph as an Agent-to-Agent endpoint. More...

#include <neograph/api.h>
#include <neograph/a2a/types.h>
#include <neograph/graph/execution.h>
#include <chrono>
#include <functional>
#include <cstddef>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for server.h:

Go to the source code of this file.

Classes

struct  neograph::a2a::A2AHttpConfig
 Which Host and Origin values an A2AServer answers, and how large a request body it reads. More...
 
class  neograph::a2a::A2AServer
 HTTP server exposing a NeoGraph as an A2A agent. More...
 
class  neograph::a2a::GraphAgentAdapter
 Adapt a NeoGraph run to the A2A request/response shape. More...
 
class  neograph::a2a::StructuredOutputAdapter
 Adapt one JSON-valued graph output channel into a versioned A2A DataPart. More...
 

Detailed Description

A2A server — exposes a NeoGraph as an Agent-to-Agent endpoint.

Speaks the JSON-RPC binding of A2A 1.0 (v1.0.1, the primary version: PascalCase methods, ProtoJSON bodies, A2A-Version: 1.0) and keeps A2A 0.3 as a compatibility dialect (slash-form methods, kind discriminators, no A2A-Version header). Each request is answered in the dialect its A2A-Version names (header or query parameter); any other version gets VersionNotSupportedError (-32009).

Endpoints:

  • GET /.well-known/agent-card.json — one card per version: the pure 1.0 card for A2A-Version: 1.0, the 0.3 card (also listing the 1.0 interface) otherwise
  • POST / — JSON-RPC dispatcher

Methods (1.0 / 0.3 spelling):

  • SendMessage / message/send — blocking, or returnImmediately (0.3 blocking: false) returns the SUBMITTED task at once
  • SendStreamingMessage / message/stream — SSE task lifecycle stream: the Task, status and artifact updates, closed on a terminal or interrupted state; a stream silent for 5 s writes the SSE comment : keep-alive
  • GetTask / tasks/get, CancelTask / tasks/cancel (a terminal task answers TaskNotCancelableError), ListTasks, SubscribeToTask / tasks/resubscribe
  • push-notification config methods answer PushNotificationNotSupportedError; GetExtendedAgentCard answers UnsupportedOperationError. Neither feature is claimed in the card.

Requests are checked before they are routed: a loopback bind answers only the loopback Host names and its own origin unless A2AHttpConfig lists more, and a body over A2AHttpConfig::max_payload_bytes gets HTTP 413.

Every run executes on its own worker thread; a stream or a blocking send only observes it, so the task outlives a dropped connection. A failed run reports only typed public fields (the failure's public message and metadata["neograph/failure"] = {code, retryable}), never exception text. A NodeInterrupt ends in INPUT_REQUIRED with the interrupt reason and payload; a follow-up message to that task resumes the run from its checkpoint (or reruns it when the engine has no checkpoint store).

Definition in file server.h.