NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
task_graph_proposal.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <neograph/api.h>
13
14#include <cstdint>
15#include <memory>
16#include <stdexcept>
17#include <string>
18#include <string_view>
19#include <vector>
20
21namespace neograph::program {
22
25 std::uint64_t wall_time_ms = 0;
26 std::uint64_t model_tokens = 0;
27 std::uint64_t monetary_microunits = 0;
28 std::uint64_t output_bytes = 0;
29
30 bool operator==(const TaskGraphBudget&) const = default;
31};
32
35 std::string artifact;
36 std::vector<std::string> fields;
37
38 bool operator==(const TaskGraphArtifactContract&) const = default;
39};
40
50 std::string template_id;
51 std::string content_identity;
52 std::vector<std::string> input_fields;
53 std::vector<TaskGraphArtifactContract> output_artifacts;
54 TaskGraphBudget budget_ceiling;
55 std::string child_binding;
56 std::string executable_identity;
57 std::string kind;
58 std::vector<std::string> capabilities;
59 std::vector<std::string> effects;
60
61 bool operator==(const TaskGraphTemplateContract&) const = default;
62};
63
66 std::uint64_t max_tasks = 0;
67 std::uint64_t max_edges = 0;
68 std::uint64_t max_depth = 0;
69 TaskGraphBudget per_task_budget_ceiling;
70 TaskGraphBudget total_budget_ceiling;
78 std::uint32_t min_schema_version = 1;
80 std::uint32_t max_attempts = 1;
82 std::uint32_t max_literal_bytes = 0;
84 std::uint32_t max_total_literal_bytes = 0;
85
86 bool operator==(const TaskGraphProposalLimits&) const = default;
87};
88
96 std::string source_id;
97 std::vector<SourceMapEntry> source_map;
99 std::vector<TaskGraphTemplateContract> template_allowlist;
100};
101
104 std::string task_id;
105 std::string artifact;
106 std::string field;
107
108 bool operator==(const TaskGraphArtifactReference&) const = default;
109};
110
113 std::string field;
114
115 bool operator==(const TaskGraphInputTarget&) const = default;
116};
117
122
123 bool operator==(const TaskGraphInputBinding&) const = default;
124};
125
132 json value;
133
134 bool operator==(const TaskGraphInputLiteral&) const = default;
135};
136
139 std::string id;
140 std::string template_id;
141 std::vector<TaskGraphInputBinding> input_bindings;
142 std::vector<std::string> depends_on;
143 TaskGraphBudget budget;
145 std::vector<TaskGraphInputLiteral> literals;
148 std::uint32_t max_attempts = 1;
149
150 bool operator==(const TaskGraphTask&) const = default;
151};
152
153enum class TaskGraphJoinKind : std::uint8_t { All };
154
155NEOGRAPH_PROGRAM_API std::string_view to_string(TaskGraphJoinKind kind) noexcept;
156NEOGRAPH_PROGRAM_API TaskGraphJoinKind task_graph_join_kind_from_string(std::string_view value);
157
160 TaskGraphJoinKind kind = TaskGraphJoinKind::All;
161
162 bool operator==(const TaskGraphJoinPolicy&) const = default;
163};
164
166class NEOGRAPH_PROGRAM_API TaskGraphProposalError final : public std::runtime_error {
167public:
168 explicit TaskGraphProposalError(std::vector<Diagnostic> diagnostics);
169 const std::vector<Diagnostic>& diagnostics() const noexcept;
170
171private:
172 std::vector<Diagnostic> diagnostics_;
173};
174
191class NEOGRAPH_PROGRAM_API TaskGraphProposal final {
192public:
193 static constexpr std::uint32_t SCHEMA_VERSION = 1;
194 static constexpr std::uint32_t SCHEMA_VERSION_2 = 2;
195
196 TaskGraphProposal(const TaskGraphProposal&) = default;
197 TaskGraphProposal& operator=(const TaskGraphProposal&) = default;
198 TaskGraphProposal(TaskGraphProposal&&) noexcept = default;
199 TaskGraphProposal& operator=(TaskGraphProposal&&) noexcept = default;
201
202 static TaskGraphProposal parse(const json& proposal, TaskGraphProposalOptions options);
203
204 std::uint32_t schema_version() const noexcept;
205 const std::string& source_id() const noexcept;
206 const std::vector<SourceMapEntry>& source_map() const noexcept;
207 const std::vector<TaskGraphTask>& tasks() const noexcept;
208 const TaskGraphJoinPolicy& join() const noexcept;
209 const std::string& id() const noexcept;
210 const std::string& proposal_hash() const noexcept;
211 json to_json() const;
212 const std::string& serialize_canonical() const noexcept;
213
214private:
215 struct Impl;
216 explicit TaskGraphProposal(std::shared_ptr<const Impl> impl);
217 std::shared_ptr<const Impl> impl_;
218};
219
220} // namespace neograph::program
NEOGRAPH_API export/import macro for shared-library builds.
Typed structural rejection with stable Program diagnostics and coordinates.
Deeply owned canonical TaskGraphProposal.
Deeply owned, immutable Program source values.
Exact field contract for one named artifact emitted by a sealed template.
Reference to one declared producer field.
Requested resource budget for one proposed task or a proposal ceiling.
Typed dataflow edge; it is data selection, never expression evaluation.
A JSON value assigned to one input field of a template (schema 2).
Target field accepted by the consuming sealed template.
v1 intentionally supports only all-of joins; additional policies need their own contract.
Finite structural and resource ceilings enforced before a proposal is usable.
std::uint32_t max_attempts
Schema 2: the most attempts one task may declare. 1 means no retries.
std::uint32_t min_schema_version
Lowest proposal schema version this host accepts.
std::uint32_t max_total_literal_bytes
Schema 2: bytes of canonical JSON all the literals of a proposal may take together.
std::uint32_t max_literal_bytes
Schema 2: bytes of canonical JSON one literal input may take. 0 refuses literals.
Trusted parsing context for one proposal artifact.
One task vertex in a finite TaskGraphProposal DAG.
std::vector< TaskGraphInputLiteral > literals
Schema 2; sorted by target field.
std::uint32_t max_attempts
Schema 2: attempts the task may take, 1 to TaskGraphProposalLimits::max_attempts.
Immutable-template facts supplied by the trusted source/admission layer.