Repository navigation
Graphrt 0.4.0
Evaluation lands: graphrt eval runs datasets against a workflow with deterministic, trajectory, retrieval and judge assertions, where a judge is an ordinary graphrt workflow. graphrt serve can score sampled production runs online, take human feedback and export scores as OpenTelemetry events, and spans now follow the OpenTelemetry GenAI semantic conventions with presets for Langfuse, LangSmith, Braintrust, Opik, Phoenix and MLflow. Also new: end user JWT verification and per user rate limits for serve. Contains breaking changes, see Changed (Breaking).
Changed (Breaking)
- OpenTelemetry span names: the run span is
invoke_workflow {workflow}(wasworkflow {workflow}) withgen_ai.operation.name=invoke_workflow, and is kindINTERNALunless it continues a caller'straceparent(thenSERVER, as before)- Model nodes are
chat {model}(was the node title, now ingraphrt.node.title) - Agents are
invoke_agent {title}withgen_ai.operation.name=invoke_agent(waschat).
- Model nodes are
system-onespans reportgen_ai.operation.name=chat(was the non-standardclassify, nowgraphrt.operation.kind=classify).gen_ai.systemis deprecated in favor ofgen_ai.provider.name. Both are emitted for this release,gen_ai.systemwill be removed in the next.tool_call/tool_resultprogress no longer appear as span events on the agent span (they areexecute_toolspans).model_requestprogress never becomes a span event.graphrt-otelAPI:OtelConfig::capture_content: boolis replaced byOtelConfig::capture: CaptureMode.AttrValueis#[non_exhaustive].RunRecordand the CLI'sServiceOptionshave new public fields (construct them withRunRecord::running/..Default::default()).
Added
- Online evaluation:
graphrt serve --evaluators <file>(cargo featureonline-eval, on by default, not in the IoT build) scores a deterministic sample of finished runs with the assertions ofgraphrt evalthat need no expected answer (judgeworkflows,regex,contains*,starts-with,is-json,json-schema,latency,tokens,trajectory:*), validated at startup.- Evaluators filter on workflow, run status, tags and metadata.
- Sampling hashes the run id with the evaluator name.
- Runs are queued after their response to a bounded pool (
concurrency,queue) - A full queue drops and counts (
graphrt.eval.dropped). - Without
--evaluatorsnothing runs and runs pay only an emptyOptioncheck (serve throughput within noise). - Scores, online evaluation, presets and the uploader add about 98 KiB to the default min-size binary and nothing to the IoT build.
graphrt_eval::onlineholds the config, sampling and evaluation.examples/evals/onlinereplays the reference judges offline.- See docs/evals.md#online-evaluation.
- Run scores (cargo feature
scores):GET /v1/runs/{id}/scores, andPOST /v1/runs/{id}/feedbackfor human feedback{name, value, comment?, user?}(number, boolean or text values).- Scores are stored next to the run (
runs/<id>/scores.json, or in memory, bounded by--max-runsand the TTL) with deterministic ids, so a repeated score replaces the earlier one. - With
--verify-jwt, an end user's token may give feedback on the user's own runs only, as that user.
- Scores are stored next to the run (
evaluate {name}spans: every score (online, human, and each assertion ofgraphrt eval) becomes a span in the evaluated run's trace, under its root span, with agen_ai.evaluation.resultevent (gen_ai.evaluation.name,.score.value,.score.label,.explanation), plus agraphrt.eval.scorehistogram by evaluator.- Names live in
graphrt_otel::semconv.
- Names live in
- Vendor presets:
--otel-preset <name>(orGRAPHRT_OTEL_PRESET) forlangfuse,langsmith,braintrust,opik,phoenixandmlflowfills the traces endpoint, auth and routing headers (Langfuse Basic auth andx-langfuse-ingestion-version: 4,x-bt-parent,x-mlflow-experiment-id...) and resource attributes (opik.project_name,openinference.project.name) from each vendor's own environment variables, and turns the metrics push off.- Small static tables in
graphrt_otel::preset.
- Small static tables in
graphrt serve --langfuse-scores(cargo featurelangfuse) uploads online and human scores to Langfuse's/api/public/scoreswith the run's trace and root observation ids and the score's deterministic id, through the egress policy, with retries.graphrt eval --otelexports one trace per test run withlangfuse.experiment.*attributes (a Langfuse experiment over OTLP, with the Braintrust preset andBRAINTRUST_PARENT=experiment_id:<id>, a Braintrust experiment) and anevaluatespan per assertion. It used to ignore--otel.graphrt-otel:EventTracer::with_span_attributes,with_root_attributesandwith_root_span_id.TraceId::from_hex/SpanId::from_hex.OtelConfig::export_metricsandpreset.graphrt-eval:EngineTarget::engineandenv.graphrt serve --verify-jwt INPUT(cargo featurejwt, on by default) verifies the token of a header-mapped input as a JWT:ES256/RS256keys from a JWKS (--jwt-jwks-url, refreshed in the background and on unknownkid) and/or anHS256secret (--jwt-secret-env), withexp,nbf,--jwt-issuerand--jwt-audiencechecks and a requiredsub.- A valid token may start runs (
POST /v1/workflows/{name}/runsonly, of workflows that declare the input, others are403) without the API key and setssys.user_id. - An invalid one is
401. --user-rate-limit Nallows N runs per minute persub(429withRetry-After).- The server refuses
--verify-jwton a non-loopback address without an API key. - No new crates.
- About 33 KiB of binary.
- A valid token may start runs (
examples/supabase-chatbot: a multi-user chatbot backend for apps signed in with Supabase Auth: agent with the supabase plugin inuser_rpcmode andtool_context, memory fromsys.history, a sample schema with RLS and an isolation test, a distroless container and Fly.io / Cloud Run / VPS notes.graphrt serve --input-header INPUT=HEADERmaps a request header (leadingBearerstripped) to a secret start input of new, streamed and resumed runs, so an app can send a user's JWT next to the serve API key.- The value is masked everywhere and never stored.
- Resumes must send the header again.
- A missing header for a required input is
401, the same input in the body400, and a non-secretdeclaration fails at startup.
agent_thoughtprogress events carrystreamed(whether the turn's text was streamed).- docs/serving.md documents the SSE format, the
responseevent and how retry /on_errorpolicies hold back live answer text. agentnodetool_context: per-run values (e.g. the end user's JWT) sent to one provider's tools beside the arguments, as a newcontextfield of the plugin protocol'stool.call({"secrets": {name: string}}).- Only plugins with
permissions.secretsthat the operator trusts receive it. - Other providers fail the node with
tool_context_denied. - The values are never shown to the model or recorded, and are masked in tool results, logged arguments and node errors.
- Hosts announce the
tool_contextfeature ininitialize.
- Only plugins with
- Plugin SDKs pass the context as the tool handler's second argument (TypeScript
(args, context), Python(args, context)for two-parameter handlers, RustToolCall::context). Existing handlers keep working. NodeContext::observe_secretlets a node register plaintext it handles as a run secret, so later node error messages are scrubbed.- OpenTelemetry: agent tool calls are
execute_tool {tool}child spans (gen_ai.tool.name,gen_ai.tool.call.id, error status for failed or denied calls).knowledge-retrievalnodes areretrievalspans withgen_ai.retrieval.top_k.gen_ai.provider.name,gen_ai.agent.nameandgen_ai.response.finish_reasons. - OpenTelemetry content capture follows
OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT(NO_CONTENTdefault,SPAN_ONLY,EVENT_ONLY,SPAN_AND_EVENT).- With it on, the run span carries the run input and output (
graphrt.run.input/outputandlangfuse.observation.input/output), model spansgen_ai.system_instructionsandgen_ai.input.messages/gen_ai.output.messagesas structured values, tool spans their arguments and result, retrieval spans the query and document ids. - Values stay masked and capped at 4 KB.
- With it on, the run span carries the run input and output (
graphrt_core::node::CaptureContentservice: when registered (the CLI does so while content capture is on),llmnodes report their rendered messages asmodel_requestprogress, agents add result text totool_resultprogress andknowledge-retrievaladds itsqueryto the node metadata. Nothing extra is built without it.POST /v1/workflows/{name}/runsacceptsmetadata,session_id,user_idandtags.- They are stored on the run record and stamped on every span (
session.id,user.id,gen_ai.conversation.id,langfuse.session.id,langfuse.user.id,langfuse.trace.tags,langfuse.trace.metadata.*). graphrt rungets--session-id,--user-id,--tagand--metadata.
- They are stored on the run record and stamped on every span (
RunRecordgainstrace_idandspan_id(root span of the latest traced execution),metadata,session_id,user_id,tags, andinputs, kept (secrets masked) only with the newgraphrt serve --store-inputs.graphrt-otel:semconvmodule with every attribute name,CaptureMode,RunContext,EventTracer::{capture, with_context, content_limit, root_span_id},Span::is_run_root,AttrValue::Structured.- docs/observability.md: setups for Langfuse v4, Phoenix, Opik, MLflow, LangSmith and Braintrust.
graphrt eval <file.eval.yaml>: evaluate a workflow against test cases and gate CI on the pass rate.- Eval files use Promptfoo's
tests/assert/defaultTestshape plus JSONL datasets. - Assertions cover outputs (
equals,containsand its variants,regex,starts-with,is-json,json-schema,transformpaths),latencyandtokensbudgets, agent trajectories (trajectory:tool-used,tool-sequence,tool-args-match,step-count, from the run's tool-call events) and retrieval quality (retrieval:recall-at-k,precision-at-k,mrr), each negatable withnot-and weighted (weight: 0reports only). - The workflow is compiled once and tests run in-process and concurrently (
-j), with--filter,--trials(alias--repeat), per-test--timeout-ms,--outputJSON results (reportschema_version: 2) and--junitXML. - A failed gate exits with the new exit code 5 (
--fail-exit-code). - Feature
eval, on by default. - Not in the small-device build.
- See docs/evals.md.
- Eval files use Promptfoo's
- LLM judges as graphrt workflows:
{type: judge, workflow: judges/x.yaml}runs the judge on the test'soutput,vars,expected, retrievedcontextsand tooltrajectory(plusinputs), and readsverdict: pass|fail|unknownor a 0..1scorewithreasoning.unknown: fail(default) orexclude(reported, not scored or gated).- Each judge is compiled once and runs inside its test under
-j. - Its workflow fingerprint, verdict, reasoning and tokens are recorded with the result (
summary.judge_usagetotals them). --judge-model PROVIDER/NAMEoverrides the judges' models.--modelnever does.
examples/evals/judges: reference judges for faithfulness, answer relevance, goal success and refusal (binary, single criterion, with anunknownoption) and a System One refusal judge.examples/evals/judgedruns them offline on a RAG workflow from replay cassettes.--trials N: per test case unbiased pass@k (1 - C(n-c,k)/C(n,k)) and pass^k (C(c,k)/C(n,k)) incasesandsummary.trials.gate: {pass_hat_k, k}gates on the mean pass^k.--baseline results.json: compare with an earlier--outputfile. Metric means and per-test pass rates regress only beyondgate.baselinetolerances (tolerance0.05,test_tolerance0, per-metricmetrics), improvements and changed judge fingerprints are reported, and any regression fails the gate.- Judge calibration: a suite with
calibration:evaluates a judge workflow against human labels inexpected(newverdictassertion) and reports agreement, TPR, TNR, Cohen's kappa and the confusion matrix, withmin_kappa/min_tpr/min_tnrgates (examples/evals/calibration). gate.failuresin the JSON results andgate: FAILED (...)on the terminal name every unmet gate condition.graphrt-evalcrate: the same harness as a library, forcargo test, with anAssertiontrait and registry for custom assertion types, aJudgeLoaderforjudgeassertions, and thestats(pass@k, pass^k, agreement),baselineandcalibrationmodules.kind: replayproviders: serve model responses from recorded cassettes (keyed by a hash of the normalized request, streamed delta by delta), record them from anupstreamprovider (mode: record), or both (mode: auto, a response cache).GRAPHRT_REPLAY_MODEoverrides the mode.- Works with
eval,runandserve(--providers). - Feature
replayof graphrt-llm and graphrt-cli.
schema/eval-v1.schema.json: JSON Schema of eval files.examples/evals: offline suites for the hello and branching workflows, an agent judged on its tool trajectory from committed cassettes, and retrieval metrics over a committed knowledge store.
Changed
agentstreams the text of every turn token by token, including turns that may still call tools, so the final answer of a tool-using agent no longer arrives as one chunk after the model finished.- Tool-call arguments are never streamed as text.
- Text a turn streams before its tool calls (a preamble such as "Let me check.") is now part of the
textoutput, separated from later text by a blank line, so the streamed text always equalstext. stream_tool_turns: falserestores the previous behaviour.
- Breaking (Rust API):
ToolRuntime::calltakes a third argument,&ToolCallContext(passToolCallContext::empty()when there is nothing to send), andToolRuntime::accepts_secrets(defaultfalse) was added.graphrt_plugin_sdk::ToolCallhas a newcontextfield.
Fixed
- Plaintext of secret-typed
conversationvariables is now scrubbed from node error messages, like other secrets. - The OTLP exporter no longer drops a run's root span when its queue is full. Several backends hide or discard every span of a trace without its root.
graphrt servekeeps keep-alive connections usable after responses sent before the request body was read (401/403auth,429rate limits,415,413): the unread body is drained (up to--max-body-bytes, at most 2 s), or the response saysConnection: close.- Pooling clients such as Dart's
http.Clientno longer fail their next request with "Broken pipe".
- Pooling clients such as Dart's
examples/supabase-chatbot/tests: end-to-end security test (realgraphrt serve, supabase plugin inuser_rpcmode, PostgREST and Postgres, a scripted hostile model) proving user A cannot reach user B's rows and that prompt injection cannot call functions outside the allowlist or reveal the user's JWT.tests/run.shruns it with the smoke test.- New guide docs/chatbot-supabase.md and a docs index.
Install
curl -fsSL https://github.com/Graphrt/graphrt/releases/download/v0.4.0/install.sh | sh
brew install graphrt/graphrt/graphrt
cargo install graphrt-cli
docker pull ghcr.io/bimapangestu28/graphrt:0.4.0The container image of this release was published at ghcr.io/bimapangestu28/graphrt and stays there. Starting with the next release, images are published at ghcr.io/graphrt/graphrt.
- Windows (experimental): cross-compiled, not yet run on Windows.
Full changelog: CHANGELOG.md · v0.3.2...v0.4.0