Ashlar currently ships two similarly named integration surfaces:
- Host SDK surface (stable):
Ashlar.Hosting.Sdkextension methods +IAshlarSdkBuilderfor registering bricks/agents in a host process. - Client SDK surface (stable):
Ashlar.Sdk(Ashlar.Client) for talking to a running Ashlar API over HTTP.
Use the host surface when embedding Ashlar into your own service. Use the client surface when your app calls an external Ashlar API.
Ashlar.Hosting.Sdk(AddAshlarSdk(Action<IAshlarSdkBuilder>)onIServiceCollection; builder implementationHostAshlarSdkBuilder)Ashlar.Infrastructure.Sdk.Ports.IAshlarSdkBuilderAshlar.Sdk.Client(AddAshlarClientSdk(baseUrl, ...),AshlarClientSdkBuilder) +Ashlar.Client(IAshlarClient)- Obsolete compat:
AddAshlarSdk(baseUrl, ...)/AshlarSdkBuilderon the client package (same assembly asAshlar.Sdk)
Ashlar.Sdk.AshlarSdkBuilder.UseAdaptiveRouting()— marked[Obsolete]and is a no-op. Adaptive routing is configured on the host viaIProviderFactory, not the client SDK.
- Types under
Ashlar.Infrastructure.*other than the stable interfaces listed above - Runtime execution internals and orchestration internals not exposed through the stable interfaces above
- Stable SDK APIs follow semantic versioning for package changes; the full policy, the packages it covers and the mechanism that enforces it (
PublicAPI.Shipped.txt/PublicAPI.Unshipped.txtunderMicrosoft.CodeAnalysis.PublicApiAnalyzers, warnings-as-errors) are indocs/SdkCompatibilityPolicy.md. - Current minor line
0.4.x(release commit for0.4.0; the tag is not cut here): no breaking changes to stable surfaces within that line; breaking changes only in0.(x+1).0after an[Obsolete]deprecation in the prior minor. The launch promise was the same rule within0.1.x. From1.0.0: only in major version bumps. Full statement:docs/SdkCompatibilityPolicy.md. - Experimental APIs may change in any release; using them is a compile-time opt-in, one per diagnostic id.
ASHLAREXP001marks the autonomy loop.ASHLAREXP002marks the security labels, the egress guard and the resolved deployment profile inAshlar.Abstractions(Ashlar.Abstractions.Security,Ashlar.Abstractions.Security.EgressandAshlarResolvedDeploymentProfileOptions). Avoid hard dependencies unless you pin package versions. The ids, their surfaces and how to opt in:docs/SdkCompatibilityPolicy.md, "Experimental". - The HTTP routes the client SDK calls have their own policy:
docs/api/versioning.md(unversioned inv0.x,/api/v1at1.0, one-minor deprecation window, Breaking entries inCHANGELOG.md).
using Ashlar.Hosting;
using Ashlar.Hosting.Sdk;
using Ashlar.Hosting.Sdk.Extensions;
var builder = WebApplication.CreateBuilder(args);
// 1. Configure the SDK (call before AddAshlar)
builder.Services.AddAshlarSdk(sdk => sdk
.RegisterBrick<MyCustomBrick>()
.RegisterAgent<MyCustomAgent>()
.RegisterAgentCard(myAgentCard));
// 2. Add the Ashlar kernel
builder.Services.AddAshlar();
var app = builder.Build();using Microsoft.Extensions.DependencyInjection;
using Ashlar.Sdk.Client;
var services = new ServiceCollection();
services.AddAshlarClientSdk("http://localhost:5000");
var provider = services.BuildServiceProvider();IAshlarClient currently exposes these operations:
| Method | API Path |
|---|---|
RunAgentAsync |
POST /api/agent |
RunValidationAsync |
POST /api/validate |
OrchestrateAsync |
POST /api/orchestrate |
GetStatusAsync |
GET /api/status |
BuildImageAsync |
POST /api/execution/build |
RunContainerAsync |
POST /api/execution/run |
QueryKnowledgeAsync |
GET /api/knowledge/query |
InvokeAsync |
Any path (escape hatch; same HttpClient, base URL, and X-Ashlar-Api-Key as typed methods) |
Endpoints not yet wrapped as typed methods (copilot, director, trust mutation, capabilities, etc.) can be called with InvokeAsync using the paths in docs/api/index.md, or with your own HttpClient against the same base URL.
AddAshlarClient accepts BaseUrl, optional ApiKey (sent as X-Ashlar-Api-Key header), and Timeout.
using var json = new StringContent("{}", System.Text.Encoding.UTF8, "application/json");
using var resp = await client.InvokeAsync(HttpMethod.Post, "api/copilot/task", json, ct);
resp.EnsureSuccessStatusCode();
var body = await resp.Content.ReadAsStringAsync(ct);- Recommended: run Ashlar as a separate .NET host (local or mesh) and call it with
Ashlar.Client/InvokeAsyncfrom an Editor assembly (HTTP + optional API key). Keep the player build free of the full hosting stack unless you explicitly need it. - Embed
Ashlar.Hostingin-process is possible for .NET hosts (tools, servers); for Unity it is usually heavier and version-sensitive than HTTP. - Unreal / non-.NET: use the HTTP API (same paths as
docs/api/index.md); generate clients from OpenAPI if you add a spec to your release pipeline.
Registers a brick type derived from Ashlar.Core.Domain.Bricks.Brick. The brick will be available in the brick registry and can be used by the adaptation pipeline, workflow executor, and behavior executor.
sdk.RegisterBrick<OWASPScannerBrick>();
sdk.RegisterBrick<MySecurityBrick>();Resolve a registered brick with IBrickRegistry.GetBrick. AddAshlarBrick<T>() adds the type to that registry; it does not register T as its own service. Ensure required services (e.g. IProviderFactory) are registered.
Registers an agent type implementing Ashlar.Abstractions.IAgent. The agent will be discoverable by the agent executor and can be invoked by name.
sdk.RegisterAgent<ToolCallingAgent>();
sdk.RegisterAgent<MyCustomAgent>();Agents must implement IAgent (Name, ThinkAsync).
Registers an AgentCard for workflow execution. Agent cards define personas with behaviors for the behavior executor.
var card = new AgentCard
{
Id = "my-agent",
Name = "My Agent",
Domain = "security",
Description = "Custom security agent",
Behaviors = new[] { "scan", "remediate" }
};
sdk.RegisterAgentCard(card);Important: Call AddAshlarSdk before AddAshlar():
builder.Services.AddAshlarSdk(configure); // First
builder.Services.AddAshlar(); // SecondThe SDK RegisterBrick and the existing AddAdaptationBricks both add brick types to the adaptation pipeline. You can use either:
- AddAshlarSdk +
RegisterBrick: For host applications that configure everything in one place - AddAdaptationBricks: For CLI commands or scenarios that add bricks after adaptation infrastructure is registered
Both mechanisms merge into the same AdaptationBrickOptions.AdditionalBrickTypes list.
A minimal, stable-only host integration sample is provided at:
docs/samples/StableSdkHostSample/— project-reference mode (StableSdkHostSample.csproj) for contributors working inside the repo.docs/samples/StableSdkHostSample/package-consumer/— package-only mode (StableSdkHostSample.Package.csproj): referencesAshlar.Hosting.Bundlefrom NuGet; verified byscripts/verify-stable-sdk-host-sample-packages.shagainst a local feed afterscripts/pack-ashlar-hosting-graph.sh(isolatedNUGET_PACKAGES+--force-evaluateby default; seedocs/PUBLISHING.md).
The sample intentionally uses only Ashlar.Hosting.Sdk + IAshlarSdkBuilder extension points and avoids internal namespaces.