NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
runtime_turn_assembler.h
1#pragma once
2
3#include <neograph/api.h>
4#include <neograph/provider.h>
5#include <neograph/context_store.h>
6#include <neograph/runtime_context.h>
7
8#include <cstdint>
9#include <memory>
10#include <optional>
11#include <stdexcept>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace neograph {
17
18class NEOGRAPH_API ContextBudgetBlocked final : public std::runtime_error {
19public:
20 ContextBudgetBlocked();
21};
22
24struct NEOGRAPH_API RuntimeTurn {
25 PreparedProviderRequest request;
26 ContextAssemblyReceipt assembly_receipt;
27};
28
29struct RuntimeContextRequirements {
31 std::vector<std::string> required_artifact_ids;
33 std::vector<std::string> required_skill_artifact_ids;
34};
35
42class NEOGRAPH_API RuntimeTurnAssembler final {
43public:
45 std::vector<std::string> static_required_skill_artifact_ids = {},
46 std::uint64_t max_input_tokens = 0);
48 std::uint64_t max_input_tokens,
49 RuntimeContextRequirements requirements);
52 RuntimeTurnAssembler& operator=(RuntimeTurnAssembler&&) noexcept;
54 RuntimeTurnAssembler& operator=(const RuntimeTurnAssembler&) = delete;
55
56 RuntimeTurn assemble(Provider& provider, std::string owner_id,
57 const ContextEpoch& epoch,
58 ProviderRequest request) const;
59 RuntimeTurn assemble(Provider& provider, std::string owner_id,
60 const ContextEpoch& epoch,
61 ProviderRequest request,
62 std::vector<sp::Message> host_instructions,
63 std::vector<sp::Message> trusted_supplemental) const;
64
71 static std::uint64_t estimate_input_tokens(const PreparedProviderRequest& request);
73 static std::string normalized_request_digest(const PreparedProviderRequest& request);
79 static std::optional<std::string> tools_digest(std::string_view encoded_body);
80
81private:
82 struct Impl;
83 std::unique_ptr<Impl> impl_;
84};
85
86} // namespace neograph
NEOGRAPH_API export/import macro for shared-library builds.
Evidence that one normalized provider request was assembled from one exact epoch.
Immutable selection of exact RAW and derived material for provider turns.
Durable contract for owner-isolated runtime history and context artifacts.
Capability identity plus a single prepared, owned operation contract.
Definition provider.h:387
Hydrates and verifies a ContextEpoch before constructing a provider request.
static std::string normalized_request_digest(const PreparedProviderRequest &request)
Canonical digest of dispatch-relevant request data, excluding callback and cancellation identity.
static std::optional< std::string > tools_digest(std::string_view encoded_body)
Digest of the tools member of an encoded request body, which every family names tools.
static std::uint64_t estimate_input_tokens(const PreparedProviderRequest &request)
Provider-neutral heuristic: the encoded request body's bytes, three per token.
Portable request controls remain the SDK's declared, family-specific fields.
Definition provider.h:190
A normalized request and its immutable evidence of context assembly.