Skip to documentation
Open Workflow Studio
On this page

Benchius control plane and .NET SDK

Home | Documentation

The production control plane is hosted by WebFrontEnd at /api/benchius/v1. The API service, WebAssembly app, and PWA development server keep their existing hosting boundaries. A standalone application can opt into local HTTP hosting using the SDK's ASP.NET Core package.

Authentication and OpenAPI

Every control-plane operation requires X-Benchius-Api-Key. The default free-tier key is the unique GUID configured in AspireDemo.Web\appsettings.json and the samples' shared appSettings.config:

c3771397-b105-4a41-af59-b340d4ca3e29

Free-tier access has no tier quotas or tier-specific rate limiting. Existing workflow resource limits, deadlines, native-tool capacity, explicit approvals, and configured feature prerequisites remain active.

The default key is public. Everyone using that key shares its API workspace. Use private GUID keys for private libraries, credentials, and results. Disable the public key when appropriate:

{
  "BenchiusControlPlane": {
    "EnableFreeTierKey": false,
    "ApiKeys": {
      "my-application": "<private GUID>"
    },
    "DataDirectory": "App_Data\\control-plane",
    "RunRetentionMinutes": 30
  }
}

Store private production keys in the deployment's secret configuration. Each distinct key defines an independent owner scope for runs, data, libraries, automations, and deployment handles. Key rotation changes that scope.

Open /openapi for the searchable, interactive API reference. The live contract at /api/benchius/v1/openapi/benchius.json is available anonymously. The document retains its API-key security requirements, request/response schemas, typed feature contracts, and exact binary download responses. Every operational API requires authentication.

Expand an operation to inspect linked component schemas, edit path/query/header parameters, and load a synthetic request. The execution field starts with the host's configured free-tier key when enabled. Replace it with a private workspace key before using private data. Mutating requests require explicit authorization; provider and cloud operations can incur charges. The explorer shows the redacted HTTP request, actual status and duration, response headers, JSON, streamed events, and binary downloads. Keys and request data remain in page memory. The SDK guide explains safe exercises and response limits.

Capability coverage

GET /capabilities reports feature groups, every workflow node kind, and all model protocols. GET /operations inventories their exact methods and routes.

Group API support
Workflows and models Graph validation; captured chat, image, video, speech, document, retrieval, Decisions, multi-turn, and orchestration configurations
Runs Start, status, events, explicit input, budget approval, cancellation, eligible checkpoint recovery, outputs, costs, and owned media downloads
Tools MCP, public HTTPS REST, caller-owned Entra/Azure resources, configured JIT/local executors, stitching, and watermarks
Libraries Encrypted workflow, profile, session, lab, Vault, and prompt documents with paging and revision-safe updates
Data Synthetic-data and vector collections, embedding-space-aware search, metadata filters, upserts, and explicit deletion
Benchmarking Parallel workflows with shared input, existing scoring expressions, usage, provider timing, and pricing
Templates and packaging Existing workflow factories and Aspire, Foundry, M365 Copilot, and Copilot Studio source packages
API Studio Validated public HTTPS execution and redacted session archive export
Routers Published OpenRouter APIs, Model Router inference, routing metadata, affinity, and confirmed management operations
Speech Native transcription, synthesis, audio turns, realtime credentials, WebRTC, WebSocket relay, and confirmed voice/SIP utilities
Retrieval and Decisions Dedicated Cohere embeddings/reranking/projection and GPT/Microsoft Decisions contracts
Responsible AI and provenance Existing advisory probes, human reviews, reports, original evidence, configured owned verification, and approved derivatives
Automations and deployments Existing enabled scheduler and caller-owned Azure deployment validation, confirmation, explicit start, observation, and cancellation

WebFrontEnd-specific routes are under /features. A model invocation creates a run that uses the existing workflow engine, so streaming, media, budgets, and human input use the same run APIs.

Native tools, owned detector artifacts, scheduler enablement, and approved JIT implementations must be configured on the host. Unavailable operations return explicit errors. Video derivative signing additionally requires the host's signing configuration and BenchiusControlPlane:AllowProvenanceSigning.

.NET packages

Package Purpose
Benchius.Runtime Shared workflow engine and contracts for in-process execution
Benchius.Client Remote/local HTTP SDK, generated typed operations, event streaming, and realtime transport
Benchius.AspNetCore Authenticated local endpoint hosting, private storage, and OpenAPI

The libraries and checked-in samples target .NET 11. Workflow types retain the AspireDemo.Workflows namespace for compatibility. WebFrontEnd compiles those types from the runtime library; the PWA retains its linked source build. Exported workflows retain the embedded source-runtime contract.

dotnet pack .\sdk\Benchius.Runtime\Benchius.Runtime.csproj -o .\artifacts\nuget
dotnet pack .\sdk\Benchius.Client\Benchius.Client.csproj -o .\artifacts\nuget
dotnet pack .\sdk\Benchius.AspNetCore\Benchius.AspNetCore.csproj -o .\artifacts\nuget

Connect with the SDK

$env:BENCHIUS_API_KEY = "<your API key>"
$env:BENCHIUS_ENDPOINT = "http://127.0.0.1:5110/"

The endpoint override is optional. Without it, the SDK selects https://benchius.com/.

using Benchius;
using System.Text.Json.Nodes;

using var client = new BenchiusClient();
var workflow = await client.Operations.BenchiusCreateTemplateAsync(
    "CreateGreeting", new JsonObject(), cancellationToken);
var run = await client.Workflows.StartAsync(new()
{
    Definition = workflow,
    Input = "Ada",
    IdempotencyKey = "greeting-1"
}, cancellationToken);
await foreach (var item in client.Workflows.WatchAsync(
    run.Id, cancellationToken: cancellationToken))
    Console.WriteLine($"{item.Kind}: {item.Message}");

Use AddBenchiusClient() for dependency injection. Operations provides generated typed methods and native feature DTOs for the complete nonstreaming API. Workflows, Models, Tools, Library, and Data provide concise domain methods; Realtime.ConnectSpeechAsync exposes the native socket. Features supports custom typed extensions under the protected feature group.

All transports confine credentials to the configured control-plane origin, support cancellation, bound responses, and avoid automatic retries. BenchiusApiException preserves status and problem details. Binary operation results expose a disposable stream. Dispose downloads after use.

Model-provider access uses separate caller-owned bindings:

var request = new BenchiusRunRequest
{
    Definition = workflow,
    Input = prompt,
    Credentials = new() { ["MODEL_API_KEY"] = providerKey },
    Endpoints = new() { ["MODEL_ENDPOINT"] = providerEndpoint }
};

Use NAME|scope for an audience-bound access token, or Principals["NAME"] for a caller-owned service principal. The public API never falls back to the host's environment, managed identity, browser sign-in, or Vault principal. API Studio and provider transports validate public destinations and disable redirects.

Run and persistence boundaries

Run execution belongs to the host. Disconnecting an event request leaves the run active. Cancel explicitly through /runs/{id}/cancel. Reconnect events using the last observed sequence; an expired event window returns an explicit conflict.

Idempotency applies while a run is retained. The same key and request return its existing run. A changed request conflicts. Human input uses the exact pending request ID and allowed options. Budget approval is an explicit operation. Eligible provider failures resume using retained completed outputs and fresh caller credentials.

Runs, media, checkpoints, and deployment access handles are process-local. Restarts interrupt them. Library documents are encrypted with Data Protection, and workflow data is stored in private per-key directories. Persist the data directory and Data Protection keys for restart-safe libraries. Use one instance or add durable dispatch/distributed storage before scaling out. Keep storage outside wwwroot.

Azure deployment uses a single-use expiring validation receipt. Creating a job requires explicit billable-operation authorization; starting it is a separate command. Cancellation retains resources already created.

Disconnected and local hosting

using AspireDemo.Workflows;
using Benchius;

using var engine = BenchiusClient.CreateOffline(new()
{
    DataStore = new WorkflowFileDataStore("workflow-data")
});
await foreach (var item in engine.RunAsync(request, cancellationToken: cancellationToken))
    Console.WriteLine(item.Message);

Local expressions, variables, branches, loops, and cached data operate disconnected. Model, MCP, and cloud steps need their configured services. Supply WorkflowUserInputSession, WorkflowRunControl, media processors, or approved JIT implementations through the runtime options as required.

For non-.NET consumers, host the same contract locally:

using Benchius.AspNetCore;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBenchiusControlPlane(builder.Configuration);
var app = builder.Build();
app.UseBenchiusControlPlane();
app.UseAuthentication();
app.UseAuthorization();
app.MapBenchiusControlPlane();
app.Run();

Debugging and agent lifecycle

Run snapshots expose reached breakpoints and the latest run-owned agents execution IDs/statuses. Resume a specific debugging pause with Workflows.ResumeBreakpointAsync(runId, new(requestId)); use the actual pending request ID. Workflows.ControlAgentAsync accepts a WorkflowAgentCommand with Pause, Resume, or Delete. Both endpoints enforce run ownership. Breakpoint resume and budget approval remain independent. Offline execution with enabled breakpoints requires an explicitly supplied WorkflowRunControl.

Samples and regeneration

Open samples\Benchius\Benchius.Samples.sln and launch Samples Runner. Its six ASP.NET Core scenarios demonstrate local API discovery, streamed human approval and idempotency, disconnected purchase-policy loops and branches, exact-match workflow comparisons, configurable Studio-only embedding with an SDK runtime callback, and revision-safe libraries with filtered vector search. See the SDK samples guide.

The generated client uses the pinned local NSwag tool and reuses runtime contracts:

dotnet tool restore --tool-manifest .\sdk\.config\dotnet-tools.json
$env:BENCHIUS_OPENAPI_OUTPUT = Join-Path $PWD "artifacts\benchius-openapi.json"
dotnet test .\AspireDemo.Web.Tests\AspireDemo.Web.Tests.csproj --filter "FullyQualifiedName~WebFrontEndOpenApiDescribesAllFeatureGroups"
node .\scripts\generate-benchius-client.mjs .\artifacts\benchius-openapi.json

The dedicated streaming and realtime clients remain hand-maintained. Run the focused control-plane regressions and the complete repository test categories after changes.

An unhandled error has occurred. Reload 🗙