Skip to main content
The C++ SDK is header-only and type-theoretic: protocol invariants live in the type system and are proved at compile time — the build is the test runner.

Refinement types

TopK cannot be 0, ProtocolVersion is validated at construction, Score/Dimension are not interchangeable.

Typestate Client

Only constructible via a connect*() that runs the handshake; gated calls fail client-side with CapabilityMissing before any I/O.

Concept-gated Server<H>

A handler advertises capabilities and implements matching hooks; if constexpr dispatch makes an advertised-but-unimplemented method a typed error, never a crash.

Total Result<T>

Result<T> = std::expected<T, Error> everywhere — no exceptions for control flow. static_assert proofs ship in test_types.cpp.

Requirements

A C++23 compiler with std::expected (GCC 13+ or recent Clang). Header-only — just add sdk/cpp/include to your include path and #include "rcp.hpp".

Server

Which hooks you define is detected at compile time; a capability you advertise but don’t implement resolves to a typed CapabilityMissing, not a null pointer.

Client

Every call returns Result<T>; nothing throws across the API boundary.

Build & test

Validate against the conformance suite:

Fusion & the vector codec

rcp/fusion.hpp and rcp/vectors.hpp are standalone, header-only, and tested — byte-for-byte identical to the Python, Node, and Rust SDKs. The live Federation delegates to the same rcp::fusion::rrf_fuse, so held-list fusion and fan-out fusion agree exactly:
See Federation and compact encoding.
The SDK also ships a Selector (pick one backend) and a Federation (fan out + RRF fuse) — see Federation.