GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - seclai/seclai-csharp: Official Seclai C# SDK

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude/skills
.claude/skills
 
 
.config
.config
 
 
.github
.github
 
 
api
api
 
 
docs
docs
 
 
src/Seclai
src/Seclai
 
 
tests/Seclai.Tests
tests/Seclai.Tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
Seclai.sln
Seclai.sln
 
 
docfx.json
docfx.json
 
 

Repository files navigation

Seclai C# SDK

Official Seclai C# SDK for .NET, targeting netstandard2.0 (compatible with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+).

Provides strongly-typed async methods for the entire Seclai API: agents, knowledge bases, memory banks, sources, content, evaluations, solutions, governance, alerts, search, AI assistants, and more.

Install

dotnet add package Seclai.Sdk

Quick Start

using Seclai;
using Seclai.Models;

var client = new SeclaiClient(new SeclaiClientOptions
{
    ApiKey = Environment.GetEnvironmentVariable("SECLAI_API_KEY"),
    // BaseUri defaults to https://seclai.com
});

// Run an agent
var run = await client.RunAgentAsync("sc_ag_123", new AgentRunRequest { Input = "hello" });
Console.WriteLine($"Run {run.RunId}: {run.Status}");

Configuration

Option Default Description
ApiKey SECLAI_API_KEY env var API key for x-api-key header authentication.
AccessToken — Static OAuth2 bearer token.
AccessTokenProvider — Async function called per request: Func<CancellationToken, Task<string>>.
Profile SECLAI_PROFILE / "default" SSO profile name from ~/.seclai/config.
ConfigDir SECLAI_CONFIG_DIR / ~/.seclai Config/cache directory path.
AutoRefresh true Auto-refresh expired SSO tokens using the cached refresh token.
AccountId — Account ID sent as X-Account-Id header.
BaseUri https://seclai.com API base URL. Falls back to SECLAI_API_URL env var.
HttpClient internal Bring your own HttpClient (useful for DI or testing). Its DefaultRequestHeaders are the lowest header layer — see Request headers.
Timeout 120 s HTTP request timeout. Ignored when a custom HttpClient is provided.
DefaultHeaders none Extra headers sent with every request. An entry replaces the supplied HttpClient's default for the same header; the SDK's own headers replace both.

SeclaiClient implements IDisposable. When you let it create its own HttpClient, wrap it in a using statement so the client is disposed properly:

using var client = new SeclaiClient(new SeclaiClientOptions { ApiKey = "sk_..." });

If you supply your own HttpClient, the client does not dispose it — you manage its lifetime.

Request headers

Exactly one value is sent for every header the SDK sets and for every request header named in DefaultHeaders. A content header named there, such as Content-Type, is not a request header in .NET and is ignored. A header that only the supplied HttpClient carries is sent as that client holds it, with every value it has. From lowest to highest, where a higher layer replaces a lower one:

  1. the supplied HttpClient's DefaultRequestHeaders
  2. DefaultHeaders
  3. the headers the SDK sets from its own options: Accept, Seclai-Version (from ApiVersion), the API-key header (from ApiKey), Authorization (from AccessToken, AccessTokenProvider or SSO) and X-Account-Id (from AccountId)

So the credential and the account a request runs as always come from the options that exist for them, never from a default header of the same name. A header the SDK is not setting passes through from the lower layers: with ApiKey authentication a default Authorization is still sent, and with AccountId unset a default X-Account-Id is too. Seclai-Version is the one exception in layer 3: a DefaultHeaders entry for it takes precedence over ApiVersion.

Authentication

Credentials are resolved via a chain (first match wins):

  1. Explicit ApiKey option
  2. Explicit AccessToken option (static string)
  3. Explicit AccessTokenProvider option (async delegate, called per request)
  4. SECLAI_API_KEY environment variable
  5. SSO — cached tokens from ~/.seclai/sso/cache/ (always available as fallback)
// API key
using var client = new SeclaiClient(new SeclaiClientOptions { ApiKey = "sk-..." });

// Static bearer token
using var client = new SeclaiClient(new SeclaiClientOptions { AccessToken = "eyJhbGciOi..." });

// Dynamic bearer token provider (called per request)
using var client = new SeclaiClient(new SeclaiClientOptions
{
    AccessTokenProvider = async ct => await GetTokenFromVaultAsync(ct)
});

// SSO profile (uses cached tokens, auto-refreshes)
using var client = new SeclaiClient(new SeclaiClientOptions { Profile = "my-profile" });

// Environment variable
// set SECLAI_API_KEY=sk-...
using var client = new SeclaiClient(new SeclaiClientOptions());

SSO authentication

SSO is the default fallback when no explicit credentials are provided. The SDK includes built-in production SSO defaults, so no configuration is needed:

npx @seclai/cli auth login    # authenticate via browser — works immediately

To customize SSO settings (e.g. for a staging environment), use seclai configure sso or set environment variables:

Variable Description Default
SECLAI_SSO_DOMAIN Cognito domain auth.seclai.com
SECLAI_SSO_CLIENT_ID Cognito app client ID 4bgf8v9qmc5puivbaqon9n5lmr
SECLAI_SSO_REGION AWS region us-west-2

API versioning

The API dates its backward-incompatible changes. Nothing changes for you until you opt in, either per client or by pinning the account:

var client = new SeclaiClient(new SeclaiClientOptions
{
    ApiKey = "...",
    ApiVersion = SeclaiApiVersion.V2026_07_27,   // sent as the Seclai-Version header
});

var state = await client.GetApiVersionAsync();   // what this request resolved to
await client.UpdateApiVersionAsync(SeclaiApiVersion.V2026_07_27); // pin the whole account

Leave ApiVersion unset and the header is omitted, so the account's pinned baseline applies and responses keep their current shapes. Upgrading this package alone never changes the wire contract.

Known versions are on SeclaiApiVersion (V2026_07_01 through V2026_11_19, plus Default, Latest and Known). A version this release was not built against is rejected with ConfigurationException: a newer version can reshape responses, and this client would decode them incorrectly rather than reject them. Upgrade the package to adopt a new version, or set AllowUnknownApiVersion if you have to move first and accept that risk.

The guard covers every way a Seclai-Version can reach the wire: ApiVersion, DefaultHeaders, and the DefaultRequestHeaders of an HttpClient you supply. The first two are checked at construction. An HttpClient's defaults can change afterwards, so they are checked at construction and again on every request, after the access token has been fetched and immediately before the request is handed to the HttpClient: an unknown or empty value throws before anything is sent. Two different values there throw even with AllowUnknownApiVersion, since the client cannot tell which one the server would use; the same value twice is sent once.

That check cannot be airtight. HttpClient adds its defaults when it sends, so another thread that changes a shared HttpClient's Seclai-Version between the check and the send is not seen. Set the version through ApiVersion, which the client writes onto each request itself, if the HttpClient is shared.

The guard only covers the header. An account pinned server-side can still be newer than this release — GetApiVersionAsync().EffectiveVersion is what the request actually resolved to, and comparing it against SeclaiApiVersion.Latest is how you detect the gap.

What 2026-07-27 changes. Undeclared query parameters become a 422 instead of being ignored, and 30 list endpoints change shape: by default each answers with a bare array or an object keyed per resource (items, domains, configs, …), and from 2026-07-27 with {data, pagination} plus the same extra fields. Every method for those endpoints reads both shapes and returns the items where it always has:

Returns Methods Paging metadata
List<T> ListEvaluationCriteriaAsync, GetAgentCallersAsync, ListInboundEmailRejectionsAsync, ListGovernanceAiConversationsAsync, ListSolutionConversationsAsync, Typed.ListModelsAsync, Typed.ListMemoryBankTemplatesAsync, Typed.GetAgentsUsingMemoryBankAsync, the four cloud-drive listings not exposed
A model with Data ListEvaluationCriteriaPageAsync, ListRunEvaluationResultsAsync, ListAgentEvaluationResultsAsync, ListEvaluationResultsAsync, ListEvaluationRunsAsync, ListCompatibleRunsAsync, ListKnowledgeBasesAsync, ListMemoryBanksAsync Total, Page and Limit where the model has them, filled from either shape that states them — the default bare array of ListRunEvaluationResultsAsync states none, so its counters are 0 there; Pagination once opted in
A model with its own list property ListAgentEmailOptOutsAsync, ListBlockedEmailSendersAsync and SetAutoBlockModeAsync (Items), ListOrganizationAlertPreferencesAsync (Preferences), ListEmailDomainsAsync (Domains), Typed.ListExperimentsAsync (Experiments), Typed.GetGenerationTiersAsync (Tiers) Total where the model has it, filled from either shape; Pagination once opted in
A model with two list properties Typed.ListAlertConfigsAsync (Configs), Typed.ListModelAlertsAsync (Alerts), ListEmbeddingModelsAsync and ListRerankerModelsAsync (Models) Read Items, which returns whichever arrived: the named property is filled on the default shape and Data from 2026-07-27, never both. Total where the model has it; Pagination once opted in

Pagination is null on the default shape. The raw JsonElement methods — ListAlertConfigsAsync, ListModelAlertsAsync, ListExperimentsAsync, GetGenerationTiersAsync, ListModelsAsync, ListMemoryBankTemplatesAsync and GetAgentsUsingMemoryBankAsync — return the response body exactly as sent, so its top-level shape follows the version; use their client.Typed forms.

A successful response that is not a list in either shape — an error-shaped object, text, null — throws ApiException from every method in the table rather than returning an empty list, which would read as "no results". An explicit "data": null is an empty list.

Opting in turns paging on. Some endpoints return everything by default and one page once the request resolves to 2026-07-27 or later, so the same call can return fewer rows:

Method Default From 2026-07-27
ListEvaluationCriteriaAsync, ListEvaluationCriteriaPageAsync every criterion; page and limit are ignored one page, 20 items unless limit is passed
ListRunEvaluationResultsAsync every result for the run; page and limit are ignored one page, 20 items unless limit is passed
ListAlertConfigsAsync, Typed.ListAlertConfigsAsync every config; page and limit are ignored one page, 50 items unless limit is passed
SetAutoBlockModeAsync Total is the account's full count of blocked senders Total is the number of rows returned, which is at most 50

For the three listings, read Pagination.HasNext and request the next page, or pass limit, before relying on the result being complete. SetAutoBlockModeAsync cannot tell you: opted in, its Total is the row count and HasNext is always false. To see every blocked sender, page through ListBlockedEmailSendersAsync.

Later versions. Each is cumulative, and this client decodes the responses of every one:

Version What it changes
2026-08-03 The API rejects max_age_days on a memory bank with a 400 — leave UpdateMemoryBankRequest.MaxAgeDays unset, or send 0 to clear a stored value — and a bank created without retention_days gets a default per bank type instead of 30
2026-08-21 CreateSourceAsync rejects an embedding dimension its embedder does not support with a 400 — ListEmbeddingModelsAsync reports the supported ones
2026-09-28 Agent-definition writes use the current file-list grammar: an omitted attachments keeps the stored list and [] means no files
2026-09-30 AgentRunResponse.Output and AgentRunStepResponse.Output are the text rather than a JSON manifest; the files are in Attachments on every version
2026-10-03 A new LLM step written without attachments takes its parent's files, and a new retrieval step's matched media are its files
2026-10-05 A content item an Enforce governance policy holds for review reports completed rather than failed; HeldForReview is true either way
2026-10-13 MediaTypes on a source rejects an unknown kind, or any kind on a source type other than website or RSS, with a 400 instead of dropping it
2026-10-16 UploadAgentInputAsync accepts a file of any type and it is ready at once; each step receives the file itself when its model reads that type, and the run's input carries a heading per file instead of the file's extracted text
2026-10-18 DocumentImages defaults to true on a new source with a text-only embedder too
2026-10-19 CreateSourceAsync accepts PollingMaxItems on RSS sources only; any other source type rejects it with a 400
2026-10-21 A result whose evaluator returned no verdict (error) is counted only in Error by GetNonManualEvaluationSummaryAsync, not in Failed or either rate, and GetEvaluationCriteriaSummaryAsync averages AverageScore over passed and failed results only. TestDraftEvaluationAsync receives a null score and verdict for an error result, which this client reads as Score 0 and Passed false (earlier versions send 0.5 and false), so check Status
2026-10-28 An if_else or switch step's AgentRunStepResponse.Output is the result of the arm it took (its input when that arm is empty or it took none) rather than the decision object. The arm taken is in AgentRunStepResponse.Decision on every version
2026-11-02 A definition or sampling-rule write (other than an import) that references a metadata key no trigger declares is refused (UpdateAgentDefinitionAsync answers 400); older versions declare each such key optional instead. Declare keys with SetMetadataKeysAsync
2026-11-04 The API refuses the agent evaluation mode eval_and_retry, a new evaluation criterion StepId that does not name the step carrying run_result, and CreateEvaluationResultRequest.RetryTriggered = true, each with a 400. Older versions store eval_and_retry as sample_and_flag and accept any step id
2026-11-08 A cancelled agent run (CancelAgentRunAsync, CancelQueuedEmailRunsAsync) ends with status cancelled; older versions show failed. RunAgentAndPollAsync stops on cancelled as on completed and failed
2026-11-09 ListAgentExamplesAsync's query describes what the agent should do, and entries are ranked by how well they match its words and meaning, best first; a query of several words that are all filler (such as "create an agent") counts as no query. Older versions list only entries containing every word
2026-11-14 RunAgentAsync, RunAgentAndPollAsync and the streaming run methods refuse an agent whose definition fails to validate with a 409 and start no run; older versions return the run, already failed with the validation error as its cause
2026-11-19 CreateAlertConfigAsync accepts the agent alert type step_failure_continued in CreateAlertConfigRequest.AlertType

Typed responses

Some methods return JsonElement for historical reasons. The same endpoints are available deserialized under client.Typed, which issues the identical request:

var raw   = await client.SearchAsync("disk");        // JsonElement
var typed = await client.Typed.SearchAsync("disk");  // SearchResponse
foreach (var hit in typed.Results) Console.WriteLine(hit.Name);

Prefer client.Typed. The raw methods are kept only for source compatibility; they will be deprecated and then removed in a future major.

API Coverage

Filters. List methods whose endpoint takes filters beyond paging have an overload taking an options object (AlertListOptions, ModelListOptions, AgentRunListOptions and so on); the original signatures are unchanged. Set only the properties you need. The options types are structs, so a bare null still binds to the original overload, as it did before. A bare default literal fits both and does not compile; pass null or name the argument:

var failed = await client.ListAgentRunsAsync("ag1", new AgentRunListOptions { Status = "failed", Limit = 20 });
var recent = await client.Typed.ListAlertsAsync(new AlertListOptions
{
    AgentId = "ag1",
    TimeFrom = DateTimeOffset.UtcNow.AddDays(-7),
});

Identity

var me = await client.GetMeAsync();
foreach (var org in me.Organizations)
    Console.WriteLine($"{org.Name} {org.AccountId}");

// Act as an organization: new SeclaiClientOptions { AccountId = org.AccountId }

Agents

// CRUD
var agents = await client.ListAgentsAsync(page: 1, limit: 20);
var agent = await client.CreateAgentAsync(new CreateAgentRequest { Name = "Bot" });

// Start from the agent gallery: bind the resources the template needs, or let the
// API create the missing ones (grouped with the agent in a new solution).
var examples = await client.ListAgentExamplesAsync(query: "support", limit: 10);
var key = examples.Data[0].GetProperty("key").GetString();
var fromTemplate = await client.CreateAgentAsync(new CreateAgentRequest
{
    Name = "Support triage",
    AgentTemplate = key,
    ResourceBindings = new Dictionary<string, string> { ["knowledge_base"] = "kb1" },
    CreateMissingResources = true,
});
// fromTemplate.CreatedResources maps each created slot to its new resource id.

// Run limits. A null property is left unchanged; to remove a limit, set its
// SetMax… flag and leave the value null.
await client.UpdateAgentAsync(agent.Id, new UpdateAgentRequest { MaxRunsPerDay = 100 });
await client.UpdateAgentAsync(agent.Id, new UpdateAgentRequest { SetMaxRunsPerDay = true });

// Evaluation and prompt-model settings. SetSamplingConfig (or SetDefaultEvaluationTier,
// SetPromptModelAutoRollbackTriggers) with a null value clears it.
var sampling = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(
    "{\"combinator\": \"or\", \"rules\": [{\"type\": \"percentage\", \"value\": 10}]}")!;
await client.UpdateAgentAsync(agent.Id, new UpdateAgentRequest
{
    EvaluationMode = "sample_and_flag",   // eval_and_retry is refused from API version 2026-11-04
    SamplingConfig = sampling,
    DefaultEvaluationTier = "balanced",
    PromptModelAutoUpgradeStrategy = "cautious_adopter",
    PromptModelAutoRollbackEnabled = true,
});
await client.UpdateAgentAsync(agent.Id, new UpdateAgentRequest { SetSamplingConfig = true });

// Pause / resume — a disabled agent stops firing from every trigger path
var callers = await client.GetAgentCallersAsync("a1");  // live agents calling this one
await client.DisableAgentAsync("a1");                   // 409 if a caller is still live
await client.EnableAgentAsync("a1");
var fetched = await client.GetAgentAsync(agent.Id);
var updated = await client.UpdateAgentAsync(agent.Id, new UpdateAgentRequest { Name = "Updated" });
await client.DeleteAgentAsync(agent.Id);

// Agent definitions
var def = await client.GetAgentDefinitionAsync(agent.Id);
await client.UpdateAgentDefinitionAsync(agent.Id, new UpdateAgentDefinitionRequest
{
    ExpectedChangeId = def.ChangeId
});

// Export / import an agent
var exported = await client.ExportAgentAsync(agent.Id, download: false);

// Round-trip the export through a Dictionary so the import endpoints can accept it.
var payloadJson = JsonSerializer.Serialize(exported);
var payload = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(payloadJson)!;

// Validate the payload first to surface unresolved entity refs in this account.
var preview = await client.PreviewImportAgentAsync(new AgentImportPreviewRequest { AgentDefinition = payload });
var entityRemap = new Dictionary<string, string>();
foreach (var refEntry in preview.UnresolvedRefs ?? new())
{
    if (refEntry.TryGetValue("ref_id", out var refId) && refId.ValueKind == JsonValueKind.String)
    {
        // Replace "<target-uuid>" with an id from refEntry["alternatives"]
        // before calling CreateAgentAsync; empty values are rejected.
        entityRemap[refId.GetString()!] = "<target-uuid>";
    }
}

// Commit — EntityRemap substitutes workflow refs before save.
var imported = await client.CreateAgentAsync(new CreateAgentRequest
{
    Name = "Imported",
    AgentDefinition = payload,
    EntityRemap = entityRemap,
});
// imported.ImportWarnings lists any items that couldn't be applied.

Accepted attachments

A trigger declares the input files it accepts as named slots; steps read one as {{agent.attachments.<name>}}. The trigger's id is on AgentSummaryResponse.TriggerId.

var slots = await client.SetAcceptedAttachmentsAsync(agent.Id!, agent.TriggerId!,
    new SetAcceptedAttachmentsRequest
    {
        AcceptedAttachments = new List<AcceptedAttachmentSlot>
        {
            new() { Name = "invoice", ContentTypes = new List<string> { "application/pdf" }, Min = 1, Max = 1 },
            new() { Name = "receipts", ContentTypes = new List<string> { "image/*" } },
        },
    });

// A null list is sent as-is and accepts any files (one slot named "files").
await client.SetAcceptedAttachmentsAsync(agent.Id!, agent.TriggerId!, new SetAcceptedAttachmentsRequest());

// What a run must supply
var refs = await client.GetAgentAttachmentReferencesAsync(agent.Id!);
foreach (var slot in refs.AcceptedAttachments ?? new()) Console.WriteLine($"{slot.Name}: min {slot.Min}");

CreateAgentRequest.AcceptedAttachments and UpdateAgentDefinitionRequest.AcceptedAttachments declare the same slots in the same save; left null, they are omitted.

Metadata keys

A trigger declares the run metadata keys its agent's steps may reference as {{metadata.<key>}}, each required or optional. system and source keys are written by the platform; custom keys are sent by the caller, and only a custom key can be required. A run you start is refused with a 400 when it lacks a required key or sends a custom key the trigger does not declare, on every API version, so declare custom keys with SetMetadataKeysAsync before sending them in a run's metadata.

SetMetadataKeysRequest is built with its list, and its constructor and MetadataKeys setter throw ArgumentNullException on null, so a request cannot go out without a declaration and wipe it. To declare no keys, pass an empty list.

var keys = await client.GetMetadataKeysAsync(agent.Id!, agent.TriggerId!);
foreach (var k in keys.DeclarableKeys) Console.WriteLine($"{k.Key} ({k.Origin}) always present: {k.AlwaysPresent}");

// Replaces the whole declaration. Refused with a 400 if the agent references a key it leaves out.
var updated = await client.SetMetadataKeysAsync(agent.Id!, agent.TriggerId!, new SetMetadataKeysRequest(new List<MetadataKeyDeclaration>
{
    new() { Key = "customer_id", Origin = "custom", Required = true },
    new() { Key = "title", Origin = "source" },   // Required omitted: false
}));
foreach (var w in updated.Warnings) Console.WriteLine(w);   // callers whose call_agent mapping no longer fits

For a content trigger, GetKnowledgeBaseMetadataKeyStatsAsync (under Knowledge Bases) shows which item-metadata keys its content actually carries.

Agent Runs

// Start a run
var run = await client.RunAgentAsync("ag1", new AgentRunRequest { Input = "hello" });

// List runs, get details, cancel
var runs = await client.ListAgentRunsAsync("ag1", page: 1, limit: 20);
var failedRuns = await client.ListAgentRunsAsync("ag1", new AgentRunListOptions { Status = "failed" });
var detail = await client.GetAgentRunAsync("run1", includeStepOutputs: true);
// detail.ResultReportedAt is set once the run reported success; from then on Output is final,
// even though Status keeps following the remaining steps.
await client.CancelAgentRunAsync("run1");
await client.DeleteAgentRunAsync("run1");

// Search across runs
var results = await client.SearchAgentRunsAsync(new AgentTraceSearchRequest { Query = "error" });

// Discover which files (if any) an agent expects before staging uploads
var refs = await client.GetAgentAttachmentReferencesAsync("ag1");
// refs.RequiresUploads reports whether the agent accepts files; refs.Agent lists the
// exact names / indexes / glob patterns a run-time upload batch must satisfy.

// Files a run produced are listed on the run and on each step, on every API version.
// Download one by its Id (raw HttpResponseMessage).
foreach (var file in detail.Attachments)
{
    using var attachment = await client.DownloadAgentRunAttachmentAsync("run1", file.Id, file.Name);
}

// Download part of one with a byte range, on every API version: RangeStart alone (bytes=start-),
// RangeStart and RangeEnd, inclusive (bytes=start-end), or RangeSuffix alone for the last N bytes
// (bytes=-N). Any other combination, a negative offset, an end before the start or a suffix below 1
// throws ArgumentException before a request is sent.
using var head = await client.DownloadAgentRunAttachmentWithOptionsAsync("run1", "att1",
    new DownloadAgentRunAttachmentOptions { RangeStart = 0, RangeEnd = 1023 });
// 206 PartialContent with Content-Range for a range of a non-empty file. A range on an empty file
// is ignored and answered 200 with the whole (empty) file, so check the status. A range starting at
// or past the end of a non-empty file is answered 416, which throws ApiException; the file size is
// then in its Content-Range header (bytes */52341), when the server sends one:
//   ex.Headers.TryGetValue("Content-Range", out var cr) ? cr[0] : null
if (head.StatusCode == HttpStatusCode.PartialContent)
{
    Console.WriteLine(head.Content.Headers.ContentRange);   // bytes 0-1023/52341
}

Streaming

// SSE streaming — yields AgentRunEvent items as they arrive
await foreach (var evt in client.RunStreamingAgentAsync("ag1",
    new AgentRunStreamRequest { Input = "hello", IncludeReasoning = true, IncludeCommentary = true }))
{
    // "stream_reasoning" events carry the model's reasoning for a prompt_call step whose
    // run_result enables show_reasoning. "stream_commentary" events carry the text a model on
    // OpenAI's Responses API writes outside its final answer (phase, message, text), for a
    // prompt_call whose run_result enables show_commentary. Read evt.Data for both.
    Console.WriteLine($"[{evt.Event}] {evt.Run?.Status}");
}

// Wait for the done event of the SSE stream. It reads only the init, result, done, error and
// timeout events, so it does not send IncludeReasoning or IncludeCommentary.
var final = await client.RunStreamingAgentAndWaitAsync("ag1",
    new AgentRunStreamRequest { Input = "hello" },
    timeout: TimeSpan.FromSeconds(120));

// Recommended: ThrowOnIncomplete never returns a run that has not finished.
// ReturnOnResult returns the result event's snapshot without waiting for done.
var answer = await client.RunStreamingAgentAndWaitWithOptionsAsync("ag1",
    new AgentRunStreamRequest { Input = "hello" },
    new RunStreamingAgentAndWaitOptions
    {
        Timeout = TimeSpan.FromSeconds(120),
        ReturnOnResult = true,
        ThrowOnIncomplete = true,
    });

// Poll-based alternative, with the same two options.
var polled = await client.RunAgentAndPollAsync("ag1",
    new AgentRunRequest { Input = "hello" },
    pollInterval: TimeSpan.FromSeconds(2),
    timeout: TimeSpan.FromMinutes(5));
var early = await client.RunAgentAndPollAsync("ag1",
    new AgentRunRequest { Input = "hello" },
    new RunAgentAndPollOptions { Timeout = TimeSpan.FromMinutes(5), ReturnOnResult = true, ThrowOnIncomplete = true });

A run returned because of ReturnOnResult may still be in progress: its Status is not terminal yet and the run can still fail. Check ResultReportedAt, not Status; once it is set, Output is the answer.

By default RunStreamingAgentAndWaitAsync can return a run that has not finished: when the stream ends without a done event it returns the latest snapshot (the result one if that event arrived, else init), so check Status and ResultReportedAt. A connection cut mid-stream throws the transport's IOException or HttpRequestException. Its own timeout, or cancelling your CancellationToken, throws StreamingException, whose message says which. When the server ends the stream with an error event (the message includes the server's error text) or a timeout event, it throws StreamingException with the latest snapshot in Run, with or without ThrowOnIncomplete. When the HttpClient's own timeout cancels its request, it throws StreamingException with a message saying the request was cancelled by neither its timeout nor your token. When the server answers with plain JSON that cannot be read as a run, it throws StreamingException. RunAgentAndPollAsync's timeout throws OperationCanceledException. RunAgentAndPollOptions.Timeout bounds only waiting for an unfinished run. As in 1.7.0, the request that starts the run is bounded by the HttpClient's timeout (SeclaiClientOptions.Timeout when the SDK creates the client) and your CancellationToken, not by Timeout. The HttpClient's timeout on any request RunAgentAndPollAsync makes throws OperationCanceledException (a TaskCanceledException), with or without ThrowOnIncomplete, even when your token was not cancelled.

We recommend setting ThrowOnIncomplete, which becomes the default in the next major version. With it, neither helper returns an unfinished run: its own timeout, a stream that ends or breaks without done, or a plain JSON reply for a run that has not ended, throws StreamingException, whose Run holds the latest snapshot (for polling, the last poll). Cancelling your CancellationToken throws OperationCanceledException.

try
{
    var run = await client.RunStreamingAgentAndWaitWithOptionsAsync("ag1",
        new AgentRunStreamRequest { Input = "hello" },
        new RunStreamingAgentAndWaitOptions { Timeout = TimeSpan.FromSeconds(30), ThrowOnIncomplete = true });
    Console.WriteLine(run.Output);
}
catch (StreamingException ex) when (ex.Run?.ResultReportedAt is not null)
{
    Console.WriteLine(ex.Run.Output);   // the answer, though the run had not finished
}

RunStreamingAgentAsync yields a result event once the run has reported its result: take the answer from it rather than from stream_token events. done.Status says whether the whole run succeeded, which can still fail after its result. When the server answers with plain JSON instead of an SSE stream, RunStreamingAgentAsync yields only a done event, so read the answer from it. evt.Run holds the snapshot on init, result and done, only RunId and Status on status, and only RunId (the run to poll) on error and timeout. On events that carry no run, such as stream_token, stream_reasoning, stream_commentary, step_progress and tool_call_*, it is null, and the payload is in evt.Data.

Sources & Content

// CRUD
var sources = await client.ListSourcesAsync(page: 1, limit: 20);
var source = await client.CreateSourceAsync(new CreateSourceRequest { Name = "Docs", SourceType = "upload" });
await client.DeleteSourceAsync(source.Id);

// Upload file (max 200 MiB; MIME type auto-inferred from file extension)
var bytes = File.ReadAllBytes("./doc.pdf");
var upload = await client.UploadFileToSourceAsync("sc1", bytes, "doc.pdf",
    title: "My Doc", mimeType: "application/pdf");

// Stream-based upload — avoids loading the entire file into memory
await using var stream = File.OpenRead("./large.pdf");
var upload2 = await client.UploadFileToSourceAsync("sc1", stream, "large.pdf",
    title: "Large Doc");

// Inline text upload
await client.UploadInlineTextToSourceAsync("sc1", new InlineTextUploadRequest
{
    Text = "Hello world", Title = "greeting"
});

// Content management
var content = await client.GetContentDetailAsync("cv1");
await client.DeleteContentAsync("cv1");
var embeddings = await client.ListContentEmbeddingsAsync("cv1", page: 1, limit: 50);

// Indexing status of a source's content, keyed by the ContentVersionId an upload returns
var failed = await client.ListSourceContentsAsync("sc1", status: "failed");
var batch = await client.ListSourceContentsAsync("sc1",
    contentVersionIds: new[] { upload.ContentVersionId!, upload2.ContentVersionId! });
var one = await client.GetSourceContentStatusAsync("sc1", upload.ContentVersionId!);
Console.WriteLine($"{one.ContentStatus} {one.Error} held={one.HeldForReview}");

// Files attached to a content item: email attachments, feed files, web-page media,
// images inside documents, and files an agent step wrote
var attachments = await client.ListContentAttachmentsAsync("cv1", page: 1, limit: 20);
foreach (var att in attachments.Data)
{
    var detail = await client.GetContentAttachmentAsync("cv1", att.Id, start: 0, end: 5000);
    var chunks = await client.ListContentAttachmentEmbeddingsAsync("cv1", att.Id);
    if (detail.FileWithheld is null)   // otherwise the download answers 403
    {
        using var file = await client.DownloadContentAttachmentAsync("cv1", att.Id);
        // The key comes from a third party (an email filename, feed media): keep only its
        // file name so it cannot write outside the current directory.
        // An empty name (an empty key, or one ending in a slash) falls back to the id.
        var name = Path.GetFileName(att.Key);
        await using var output = File.Create(string.IsNullOrEmpty(name) ? att.Id : name);
        await file.Content.CopyToAsync(output);
    }
}

Email and cloud-drive sources

// An email source stores mail from its allowed senders; mail goes to EmailAddress
var inbox = await client.CreateSourceAsync(new CreateSourceRequest
{
    Name = "Newsletters",
    SourceType = "email",
    EmailAllowedSenders = new List<string> { "[email protected]", "example.org" },
});
Console.WriteLine(inbox.EmailAddress);

// What it refused, and why — never the subject or body
var refused = await client.ListEmailSourceRejectionsAsync(inbox.Id!, page: 1, limit: 20);
foreach (var r in refused.Data) Console.WriteLine($"{r.FromAddress} {r.Reason} auth={r.Authenticated}");

// Parts of a message that were not stored as attachments
var item = await client.GetContentDetailAsync("cv1");
foreach (var part in item.SkippedAttachments ?? new()) Console.WriteLine($"{part.Filename}: {part.Reason}");

// A cloud_drive source indexes a connected drive's folder
await client.CreateSourceAsync(new CreateSourceRequest
{
    Name = "Contracts",
    SourceType = "cloud_drive",
    CloudDriveConnectionId = "cd1",
    CloudDriveFolderPath = "/contracts",
    CloudDrivePathPattern = "**/*.pdf",
    CloudDriveMaxFileMb = 50,
});

Every request body omits a property left null, so the API applies its default on a create and leaves the stored value unchanged on an update. On UpdateSourceRequest, send "" (or 0 for CloudDriveMaxFileMb, an empty list for MediaTypes and FeedAttachments) to clear a setting. The two properties where null itself is the value are still sent: SetAcceptedAttachmentsRequest.AcceptedAttachments (accept any files) and UpdateApiVersionRequest.Version (clear the pin); they are the only model properties marked [JsonIgnore(Condition = JsonIgnoreCondition.Never)], and no model marks a property to be omitted, since the client's serializer omits every null. Upload metadata is your own data and is sent as written, nulls included. Where a stored value is removed by sending null, the client has a named way to do it: ClearSourceFieldsAsync removes a source's retention window (SourceField.RetentionDays, so content is kept indefinitely) or its spend limit (SourceField.MaxCreditsPerPeriod), ClearSourceRetentionAsync is the shorthand for the first, ClearSlackTriggerMaxTurnsAsync removes a Slack trigger's turn limit, ClearEvaluationCriteriaFieldsAsync clears evaluation-criteria fields (see Evaluations), and CreateMemoryBankRequest.RetainIndefinitely creates a memory bank that keeps entries indefinitely (see Memory Banks):

await client.UpdateSourceAsync("s1", new UpdateSourceRequest { RetentionDays = 90 });
await client.ClearSourceRetentionAsync("s1");

// Spend limit: credits the source may commit per billing period, and what happens
// when it is reached ("stop", or "delete" entries in SpendCapDeleteOrder).
await client.UpdateSourceAsync("s1", new UpdateSourceRequest
{
    MaxCreditsPerPeriod = 500, SpendCapAction = "delete", SpendCapDeleteOrder = "oldest_added",
});
await client.ClearSourceFieldsAsync("s1", new[] { SourceField.MaxCreditsPerPeriod });

Cloud Drives

var providers = await client.ListCloudDriveProvidersAsync();
var drives = await client.ListCloudDrivesAsync();
var drive = await client.GetCloudDriveAsync("cd1");

// Only the properties you set are sent; the rest are left unchanged
await client.UpdateCloudDriveAsync("cd1", new CloudDriveUpdateRequest { Name = "Contracts" });

// Which agents depend on it, and which files it skipped and why
var users = await client.GetAgentsUsingCloudDriveAsync("cd1");
var skipped = await client.ListCloudDriveRejectionsAsync("cd1", limit: 20);

await client.DisconnectCloudDriveAsync("cd1");  // keeps the connection
await client.DeleteCloudDriveAsync("cd1");

Connecting a drive happens in the app; the API manages connections that exist.

Source Exports

var estimate = await client.EstimateSourceExportAsync("s1",
    new EstimateExportRequest { Format = "csv" });
var export = await client.CreateSourceExportAsync("s1",
    new CreateExportRequest { Format = "csv" });
var status = await client.GetSourceExportAsync("s1", export.Id);
using var response = await client.DownloadSourceExportAsync("s1", export.Id);
await client.DeleteSourceExportAsync("s1", export.Id);

Knowledge Bases

var kbs = await client.ListKnowledgeBasesAsync(sort: "created_at");
var kb = await client.CreateKnowledgeBaseAsync(new CreateKnowledgeBaseRequest
{
    Name = "KB",
    SourceIds = new List<string> { "s1" },  // at least one source is required
});
// kb.Sources lists the linked sources.
await client.UpdateKnowledgeBaseAsync(kb.Id, new UpdateKnowledgeBaseRequest { Name = "Renamed" });
await client.DeleteKnowledgeBaseAsync(kb.Id);

// How often each item-metadata key appears on the knowledge base's content, over all time and
// the last 30 and 7 days, for declaring a content trigger's metadata keys.
var stats = await client.GetKnowledgeBaseMetadataKeyStatsAsync(kb.Id);
foreach (var window in stats.Windows)
    foreach (var key in window.Keys)
        Console.WriteLine($"{window.Window}: {key.Key} on {key.Items}/{window.TotalItems} items, {key.DistinctValues} values");

Memory Banks

var banks = await client.ListMemoryBanksAsync();
var chatBanks = await client.ListMemoryBanksAsync(new MemoryBankListOptions { Type = "conversation" });
var bank = await client.CreateMemoryBankAsync(new CreateMemoryBankRequest
{
    Name = "Chat Memory", Type = "conversation"
});
// Omit RetentionDays for the API default (from 2026-08-03: 90 days for a conversation bank,
// indefinite for a general bank), set it to a number of days, or keep entries indefinitely:
var archive = await client.CreateMemoryBankAsync(new CreateMemoryBankRequest
{
    Name = "Archive", Type = "conversation", RetainIndefinitely = true
});
var stats = await client.GetMemoryBankStatsAsync(bank.Id);          // JsonElement
var weekStats = await client.GetMemoryBankStatsAsync(bank.Id, new MemoryBankStatsOptions { Days = 7 });
var templates = await client.Typed.ListMemoryBankTemplatesAsync();   // List<Dictionary<string, JsonElement>>
var usedBy = await client.Typed.GetAgentsUsingMemoryBankAsync(bank.Id);
await client.CompactMemoryBankAsync(bank.Id);
await client.DeleteMemoryBankAsync(bank.Id);

// AI-assisted configuration
var config = await client.GenerateMemoryBankConfigAsync(
    new MemoryBankAiAssistantRequest { UserInput = "build a chat memory" });

Evaluations

// Criteria
var criteria = await client.ListEvaluationCriteriaAsync("ag1", page: 1, limit: 50);
// ListEvaluationCriteriaPageAsync returns the same criteria plus Total/Page/Limit.
var created = await client.CreateEvaluationCriteriaAsync("ag1",
    new CreateEvaluationCriteriaRequest { StepId = "s1" });
var summary = await client.GetEvaluationCriteriaSummaryAsync(created.Id);
// UpdateEvaluationCriteriaAsync leaves a property it is not given unchanged; to remove a
// stored value, clear it. A cleared tier falls back to the agent's default tier.
await client.ClearEvaluationCriteriaFieldsAsync(created.Id,
    new[] { EvaluationCriteriaField.EvaluationTier, EvaluationCriteriaField.Description });
await client.DeleteEvaluationCriteriaAsync(created.Id);

// Results
var results = await client.ListAgentEvaluationResultsAsync("ag1", page: 1);
var flagged = await client.ListAgentEvaluationResultsAsync("ag1",
    new AgentEvaluationResultListOptions { FlaggedOnly = true, TimeFrom = DateTimeOffset.UtcNow.AddDays(-1) });
var nonManual = await client.GetNonManualEvaluationSummaryAsync();
var lastWeek = await client.GetNonManualEvaluationSummaryAsync(new NonManualEvaluationSummaryOptions { Days = 7 });

// Test before creating
var test = await client.TestDraftEvaluationAsync("ag1",
    new TestDraftEvaluationRequest { AgentInput = "test input" });

Solutions

var solutions = await client.ListSolutionsAsync();
var billing = await client.ListSolutionsAsync(new SolutionListOptions { Search = "billing" });
var sol = await client.CreateSolutionAsync(new CreateSolutionRequest { Name = "My Solution" });

// Link/unlink resources
await client.LinkAgentsToSolutionAsync(sol.Id, new LinkResourcesRequest { Ids = new List<string> { "ag1" } });
await client.LinkSourceConnectionsToSolutionAsync(sol.Id, new LinkResourcesRequest { Ids = new List<string> { "s1" } });
await client.LinkKnowledgeBasesToSolutionAsync(sol.Id, new LinkResourcesRequest { Ids = new List<string> { "kb1" } });

// AI-assisted solution planning
var plan = await client.GenerateSolutionAiPlanAsync(sol.Id,
    new AiAssistantGenerateRequest { UserInput = "add a FAQ bot" });
var accepted = await client.AcceptSolutionAiPlanAsync(
    sol.Id, plan.ConversationId!, new AiAssistantAcceptRequest());

Governance

// AI-assisted governance
var gov = await client.GenerateGovernanceAiPlanAsync(
    new GovernanceAiAssistantRequest { UserInput = "create a content safety policy" });
var conversations = await client.ListGovernanceAiConversationsAsync();
var latest = await client.ListGovernanceAiConversationsAsync(limit: 5);

Alerts

var alerts = await client.ListAlertsAsync(status: "active");           // JsonElement
var agentAlerts = await client.Typed.ListAlertsAsync(new AlertListOptions { AgentId = "ag1" });
var alert = await client.GetAlertAsync("al1");                         // JsonElement
await client.ChangeAlertStatusAsync("al1", new ChangeStatusRequest { Status = "resolved" });
await client.AddAlertCommentAsync("al1", new AddCommentRequest { Body = "Fixed" });

// Alert configs
var configs = await client.ListAlertConfigsAsync();                    // JsonElement
var sourceConfigs = await client.Typed.ListAlertConfigsAsync(new AlertConfigListOptions { Scope = "source" });
await client.DeleteAlertConfigAsync("ac1");

// Organization preferences
var prefs = await client.ListOrganizationAlertPreferencesAsync();
var withDefaults = await client.ListOrganizationAlertPreferencesAsync(
    new OrganizationAlertPreferenceListOptions { IncludeDefaults = true });

Agent Email Triggers

A property left null is omitted from the request, so the server leaves that field unchanged. To clear a field, send its empty value — "" for Alias, an empty list for AllowedSenders. Setting null does not clear anything.

// IgnoreAutoGenerated and QueueOnQuota are left null, so they stay as they are.
var cfg = await client.SetEmailTriggerConfigAsync("a1", "t1",
    new SetEmailTriggerConfigRequest
    {
        Alias = "support",
        AllowedSenders = new List<string> { "example.com" },
        RequireSenderAuth = true,
    });
Console.WriteLine(string.Join(", ", cfg.EmailAddresses ?? new List<string>()));

// Run even when an email's attachments don't fit the accepted slots; the problems
// are listed in the run's email_attachment_issues metadata.
await client.SetEmailTriggerConfigAsync("a1", "t1",
    new SetEmailTriggerConfigRequest { RunOnAttachmentMismatch = true });

// Clear the alias and open the inbox to any sender.
await client.SetEmailTriggerConfigAsync("a1", "t1",
    new SetEmailTriggerConfigRequest { Alias = "", AllowedSenders = new List<string>() });

Agent Slack Triggers

A SLACK_COMMAND trigger runs the agent from Slack with /seclai <alias> or the message shortcut. The run's input is the text after the alias, or the message the shortcut was used on, and its files; form values reach the run as {{metadata.<key>}}. As with email triggers, a property left null is omitted and stays as it is. SetSlackTriggerConfigRequest.Input is obsolete and ignored by the API.

var slack = await client.SetSlackTriggerConfigAsync("a1", "t1",
    new SetSlackTriggerConfigRequest
    {
        McpClientId = "mcp1",            // the account's Slack (Bot) connection
        Alias = "triage",                // people type /seclai triage; generated from the agent's name when unset
        Scope = "selected_channels",
        ChannelIds = new List<string> { "C0123" },
        Visibility = "private",          // reply in the person's DM
        TurnsEnabled = true,             // replies in the thread continue the conversation
        MaxTurns = 10,
    });
foreach (var scope in slack.MissingScopes) Console.WriteLine($"missing Slack scope: {scope}");

// An empty list clears the form or the channels; null would leave them unchanged.
await client.SetSlackTriggerConfigAsync("a1", "t1",
    new SetSlackTriggerConfigRequest { Form = new(), ChannelIds = new() });

// Remove the turn limit, so a thread may run any number of turns.
await client.ClearSlackTriggerMaxTurnsAsync("a1", "t1");

Agent Email Governance

// Recipients who opted out of this account's agent emails
var optOuts = await client.ListAgentEmailOptOutsAsync(agentId: "a1", limit: 50);
await client.RemoveAgentEmailOptOutAsync("oo1");   // opt them back in

// Blocked inbound senders (owner/admin only); paginates by limit/offset
var blocked = await client.ListBlockedEmailSendersAsync(limit: 50, offset: 0);
await client.BlockEmailSenderAsync(
    new BlockEmailSenderRequest { SenderEmail = "spam.example.com", MatchType = "domain" });
await client.UnblockEmailSenderAsync("b1");

// "disabled" | "input" | "input_and_output"
await client.SetAutoBlockModeAsync(new SetAutoBlockModeRequest { Mode = "input_and_output" });

// Inbound mail discarded before running an agent
var rejections = await client.ListInboundEmailRejectionsAsync(agentId: "a1");

// Account-wide overload circuit breaker
var status = await client.GetInboundEmailStatusAsync();
await client.CancelQueuedEmailRunsAsync();   // cancel all QUEUED (over-quota parked) runs
await client.ResumeInboundEmailAsync();      // one-shot; re-arms if still overloaded

Email Domains

Send and receive agent email on your own domain instead of the shared agent.seclai.com. Requires a user-bound credential; mutations require an account owner/admin.

var listing = await client.ListEmailDomainsAsync();

var vanity = await client.AddEmailDomainAsync(
    new AddEmailDomainRequest { Kind = "vanity", Value = "acme" });
var custom = await client.AddEmailDomainAsync(
    new AddEmailDomainRequest { Kind = "custom", Value = "agent.mycompany.com" });

// Publish custom.DnsRecords, then check without waiting for the background sweep
await client.VerifyEmailDomainAsync(custom.Id);

await client.SetPrimaryEmailDomainAsync(custom.Id);
await client.UseSharedEmailDomainAsync();  // revert; domains stay configured & verified

await client.SendEmailDomainTestEmailAsync(custom.Id);  // always to the account owner
var dmarc = await client.GetDmarcSummaryAsync(custom.Id, days: 30, topSources: 10);

var removed = await client.RemoveEmailDomainAsync(custom.Id);
// removed.CleanupNote is set when the domain was Seclai-managed

Models & Model Alerts

// Media-generation quality tiers (fast/balanced/thorough) and what each resolves to
var tiers = await client.GetGenerationTiersAsync();                    // JsonElement

// Embedding and reranker models, with their pricing
var embedders = await client.ListEmbeddingModelsAsync(supportsInputMedia: "image");
foreach (var m in embedders.Items)
    Console.WriteLine($"{m.ModelType} {string.Join(",", m.Dimensions)}");
var rerankers = await client.ListRerankerModelsAsync();
Console.WriteLine(rerankers.DefaultModelType);

var alerts = await client.ListModelAlertsAsync();                      // JsonElement
var unread = await client.Typed.ListModelAlertsAsync(new ModelAlertListOptions { UnreadOnly = true });
var imageModels = await client.Typed.ListModelsAsync(new ModelListOptions { SupportsInputMedia = "image" });
await client.MarkModelAlertReadAsync("ma1");
await client.MarkAllModelAlertsReadAsync();
var recs = await client.GetModelRecommendationsAsync("model1");        // JsonElement
var toolRecs = await client.Typed.GetModelRecommendationsAsync("model1",
    new ModelRecommendationOptions { RequireToolUse = true, MinContextTokens = 100_000 });

// Model playground experiments
var experiment = await client.CreateExperimentAsync(
    new PlaygroundCreateRequest { Prompt = "...", ModelIds = new List<string> { "model1" } });
var experiments = await client.ListExperimentsAsync();                 // JsonElement
var detail = await client.GetExperimentAsync("exp1");                  // JsonElement
await client.CancelExperimentAsync("exp1");
await client.DeleteExperimentAsync("exp1");  // soft-delete, preserves audit history

Search

var results = await client.SearchAsync(query: "my bot", entityType: "agent");  // JsonElement

Documentation Search

Results are global (not account-scoped); each carries a doc_slug plus an optional anchor for building a https://seclai.com/docs/<doc_slug>[#<anchor>] link.

var hits = await client.SearchDocsAsync("email triggers");                       // JsonElement
var deep = await client.SearchDocsAsync("how do I stop auto-reply loops",
                                        mode: "semantic", limit: 5);

AI Assistant (Top-Level)

// Knowledge base assistant
var plan = await client.AiAssistantKnowledgeBaseAsync(
    new AiAssistantGenerateRequest { UserInput = "create a docs knowledge base" });
await client.AcceptAiAssistantPlanAsync(
    plan.ConversationId!, new AiAssistantAcceptRequest());

// Source and memory bank assistants
await client.AiAssistantSourceAsync(new AiAssistantGenerateRequest { UserInput = "plan" });
await client.AiAssistantMemoryBankAsync(new MemoryBankAiAssistantRequest { UserInput = "plan" });

// Feedback
await client.SubmitAiFeedbackAsync(new AiAssistantFeedbackRequest
{
    Feature = "chat", Rating = "positive"
});

Error Handling

try
{
    await client.GetAgentAsync("nonexistent");
}
catch (ApiValidationException ex)
{
    // 422 — validation errors
    Console.WriteLine(ex.Message);
    foreach (var err in ex.Errors)
        Console.WriteLine($"  {err.Loc}: {err.Msg}");
}
catch (ApiException ex)
{
    // Other HTTP errors (401, 403, 404, 500, …)
    Console.WriteLine($"{ex.StatusCode}: {ex.Message}");
}

Documentation

Full API reference is available on the Seclai docs site.

To generate docs locally:

make docs

License

Apache-2.0

Development

Tests target net10.0 (requires the .NET 10 SDK).

dotnet test

Docs

This repo uses DocFX to generate and publish API docs to GitHub Pages.

Pages structure:

  • /latest/ is updated on each release build from main
  • /<version>/ is published for each release tag (e.g. 1.2.3)

Build docs locally:

dotnet tool restore
rm -rf build/docs build/api
dotnet tool run docfx docfx.json

# static site output (upload `build/docs` to any static host, incl. GitHub Pages)
open build/docs/index.html

# if your browser/preview blocks JS/CSS when using file://, serve it locally:
# cd build/docs && python3 -m http.server 8000

Or using the Makefile:

make docs
make docs-serve

About

Official Seclai C# SDK

seclai.github.io/seclai-csharp/latest/

Topics

agent-evaluationsagent-observabilityaiai-agentsai-governancecsharpjailbreak-protectionllmmanagedprompt-injection-protectionsdkserverless

Resources

Readme
MIT license
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.