Create a new Seclai client.
Credentials are resolved via a chain (first match wins):
apiKey optionaccessToken option (static string or provider function)SECLAI_API_KEY environment variable~/.seclai/config + cached tokens in ~/.seclai/sso/cache/Client configuration.
SeclaiConfigurationError If no fetch implementation is available.
SeclaiConfigurationError If both apiKey and accessToken are provided.
Accept an AI assistant suggestion.
Conversation identifier.
Acceptance request payload.
Accept/mark an AI memory bank suggestion.
Conversation identifier.
Acceptance payload for the memory bank suggestion.
Accept a governance AI plan.
Conversation identifier.
Acceptance result.
Accept a memory bank AI suggestion.
Conversation identifier.
Accept request payload.
Accept a solution AI plan.
Solution identifier.
Conversation identifier.
Accept request.
Acceptance result with executed actions.
Add a comment to an alert.
Alert identifier.
Comment payload.
Add and provision a new agent-email domain.
Pass kind: "vanity" with value: "<slug>", or kind: "custom" with
value: "agent.mycompany.com" (optionally delegated: true to let Seclai
manage a dedicated Route53 zone). Stands up the SES identity + DNS and
returns the records the customer must publish. Requires an account
owner/admin.
The domain to add. delegated defaults to false server-side.
Add a conversation turn to a solution.
Solution identifier.
Conversation turn payload.
Updated conversation.
Generate a knowledge base configuration via AI assistant.
Generation request.
Generate a memory bank configuration via AI assistant.
Generation request.
Generate a solution via AI assistant.
Generation request.
Generate a source configuration via AI assistant.
Generation request.
Add a sender address or a whole domain to the account blocklist.
Idempotent. match_type is "address" (default) or "domain".
Requires an account owner/admin.
The sender or domain to block.
The blocked-sender entry.
Cancel a running agent run.
Cancellation is DELETE on the run resource — the API exposes no
POST .../cancel route, and no operation that deletes a run. Rejected when
the run has already reached a terminal state.
Run identifier.
Updated run (with cancelled status).
Cancel a running model playground experiment.
Experiment identifier.
Fail all of the account's QUEUED (over-quota parked) inbound-email runs at once.
A queued run consumed no quota or credits at queue time, so this merely fails them. Requires an account owner/admin.
The count cancelled.
Cancel a source embedding migration.
Source connection identifier.
Updated migration status.
Cancel a source export.
Source connection identifier.
Export identifier.
Change the status of an alert.
Alert identifier.
Status change request.
Compact a memory bank (trigger compaction).
Memory bank identifier.
Create a new agent.
Agent creation payload (name, trigger type, template, etc.).
Summary of the created agent.
Create an alert configuration.
Alert config definition.
Created alert config.
Create evaluation criteria for an agent.
Agent identifier.
Criteria definition.
Created evaluation criteria.
Create a manual evaluation result for a criteria.
Criteria identifier.
Evaluation result payload.
Created evaluation result.
Create a model playground experiment.
Experiment configuration.
Create a new knowledge base.
Knowledge base configuration.
The created knowledge base.
Create a new memory bank.
Memory banks give agents persistent memory across conversations.
Types: conversation (chat-style history) or general (flat factual entries).
Memory bank configuration.
The created memory bank.
Create a new solution.
Solution configuration.
The created solution.
Create a new content source.
Source configuration (type, name, knowledge base link, etc.).
The created source.
Create a source data export.
Source connection identifier.
Export configuration (format, etc.).
Export response with job status.
Decline an AI assistant suggestion.
Conversation identifier.
Decline a governance AI plan.
Conversation identifier.
Decline a solution AI plan.
Solution identifier.
Conversation identifier.
Delete an agent.
Agent identifier.
Cancel an agent run.
Run identifier.
This never deleted anything — the endpoint it calls is documented as "Cancel an agent run", and the API has no delete-a-run operation. It also discards the returned run state. Use cancelAgentRun instead.
Delete an alert configuration.
Alert config identifier.
Delete a cloud-drive connection.
Cloud-drive connection identifier.
Delete a specific content version.
Content version identifier.
Delete an evaluation criteria and all associated results.
Criteria identifier.
Soft-delete a model playground experiment.
Removes the experiment from list/detail views while preserving audit history. Returns HTTP 204 with no body.
Experiment identifier.
Delete a knowledge base.
Knowledge base identifier.
Delete a memory bank.
Memory bank identifier.
Delete a memory bank source.
Memory bank identifier.
Delete a solution.
Solution identifier.
Delete a source.
Source connection identifier.
Delete a source export.
Source connection identifier.
Export identifier.
Pause (disable) an agent so it stops firing from every trigger path.
API runs return HTTP 409, inbound email is turned away, and scheduled / content triggers are skipped.
Fails with HTTP 409 when other live agents still call this one via a
call_agent step — use getAgentCallers to list them, and disable
those first.
Agent identifier.
The updated agent summary.
Disconnect a cloud-drive connection, keeping the connection itself.
Cloud-drive connection identifier.
The connection in its disconnected state.
Download a file attachment emitted by a step in an agent run.
Returns the raw Response so you can stream or save the binary data.
Run identifier.
URL-safe-base64-encoded storage_key of the attachment
(as surfaced in run output manifests and webhook/email payloads).
Optional downloadName filename hint for the download
disposition, and signal, which cancels the request; with a standard fetch this
includes reading the body, so AbortSignal.timeout(ms) bounds the whole
transfer.
Raw response with the attachment bytes.
Download a content attachment's bytes.
Returns the raw Response so you can stream or save the binary data. The
API answers 403 when the file is withheld — blocked or redacted by a
governance policy, or still being indexed after arriving from outside; the
attachment's file_withheld field says which before you ask.
Content version identifier.
Attachment identifier.
Optional signal, which cancels the request; with a standard fetch this
includes reading the body, so AbortSignal.timeout(ms) bounds the whole
transfer.
Raw response with the attachment bytes.
Download a source export file.
Returns the raw Response so you can stream or save the binary data.
Source connection identifier.
Export identifier.
Optional signal, which cancels the request; with a standard fetch this
includes reading the body, so AbortSignal.timeout(ms) bounds the whole
transfer.
Raw response with the export file.
Resume (enable) a paused agent.
Clears the disable state whether the agent was paused manually or auto-paused by the inbound-email overload safeguard.
Agent identifier.
The updated agent summary.
Estimate a source export.
Source connection identifier.
Estimate request.
Export estimate.
Export an agent definition as a portable JSON snapshot.
Agent identifier.
When true (default), the server sets Content-Disposition: attachment.
The exported agent snapshot.
Generate agent workflow steps from natural language using AI.
Agent identifier.
Generation request with user instructions.
AI-generated step configuration.
Generate governance policy suggestions using AI.
AI governance request.
AI-generated governance suggestions.
Generate memory bank configuration using AI.
AI assistant request with user instructions.
AI-generated memory bank config.
Generate a knowledge base configuration via solution AI.
Solution identifier.
Generation request.
AI-generated knowledge base config.
Generate a solution AI plan.
Solution identifier.
Generation request.
AI-generated plan.
Generate a source configuration via solution AI.
Solution identifier.
Generation request.
AI-generated source config.
Generate a single step configuration using AI.
Agent identifier.
Step config generation request.
AI-generated step config.
Get agent details including its definition.
Agent identifier.
Full agent metadata.
Get AI conversation history for an agent.
Agent identifier.
Conversation history.
Get the static attachment-reference contract for an agent — what files (if any) its definition expects on a run.
Call this before staging uploads to learn whether the agent accepts files
at all (requires_uploads) and which specific filenames, indexes, or glob
patterns its templates reference. A run-time upload batch that doesn't
satisfy every declared selector is rejected with HTTP 400.
Agent identifier.
The agent's attachment-reference contract.
List the live agents that call this agent via a call_agent step.
These must be disabled before this agent can be paused.
Agent identifier.
The calling agents.
Get an agent's full definition (steps, model config, etc.).
Agent identifier.
The agent definition.
Get the status of an agent input upload.
Agent identifier.
Upload identifier.
Upload status and metadata.
Get details of a specific agent run.
Run identifier.
Optionalopts: { includeStepOutputs?: boolean }Optional flags.
Agent run details.
List the agents that use a cloud-drive connection.
Cloud-drive connection identifier.
The agents, read from either wire shape.
Get agents that are using a specific memory bank.
Memory bank identifier.
Get AI assistant memory bank conversation history.
Turns to return (server default 5) and most-recent turns to skip (default 0).
Get alert details by ID.
Alert identifier.
Alert details.
Get an alert configuration by ID.
Alert config identifier.
Alert config details.
Read the API version this request resolved to, and the versions available.
Resolution order is the Seclai-Version header, then the account pin, then
the default — so effective_version reflects the client's apiVersion
option when that is set.
The pinned, effective, default and latest versions.
Get a cloud-drive connection.
Cloud-drive connection identifier.
Get one file attached to a content item: its indexing status and reason, its metadata, and the text it is indexed by.
Content version identifier.
The id of an entry from listContentAttachments.
start and end character offsets for paging through long text
(server defaults 0 and 5000). Both are sent as given, so end: 0 asks for
the metadata without any text. A file that was not indexed has no text.
The attachment with the requested range of its text.
Get content detail for a specific content version.
Content version identifier.
Range options for slicing large content.
Content details for the requested range.
Get the DMARC aggregate-report summary for a domain.
Pass rate, disposition breakdown (none/quarantine/reject), and top
failing source IPs from the DMARC rua reports over the last days
(clamped by the service).
Populated for domains whose DNS zone Seclai controls (vanity + delegated custom); a self-managed custom domain keeps its own DMARC reporting and returns an all-zero summary.
Domain identifier.
Reporting window options.
Optionaldays?: numberWindow length in days (default 30).
OptionaltopSources?: numberNumber of top failing sources to return (default 10).
Get a single evaluation criteria by ID.
Criteria identifier.
Evaluation criteria details.
Get the evaluation summary for a specific criteria.
Criteria identifier.
Evaluation result summary.
Get a model playground experiment by ID.
Experiment identifier.
List the media-generation quality tiers and the model + cost each resolves to.
On a prompt_call's media_generation tool — and the dedicated
generate_* steps via tier routing — the author/LLM picks a tier
(fast/balanced/thorough), never a model. This maps each
(modality, tier) to its concrete generator, raw credits_per_unit,
unit_label, and a human-readable scaled price_label.
Global routing/pricing (the same for every account); read-only.
Get the account's inbound-email overload status — whether the circuit breaker has paused new inbound email, and the size of the QUEUED (over-quota parked) run backlog.
Get a knowledge base by ID.
Knowledge base identifier.
Knowledge base details.
Get the item-metadata keys seen in a knowledge base's content.
Reports, for all time and the last 30 and 7 days, each key's item count, number of distinct values and five most frequent values.
Knowledge base identifier.
The key statistics per window.
Get the authenticated user's identity.
Returns the personal account_id plus every organization the user belongs
to — each with its own id, display name, and account_id. Use it to
discover the account IDs that can be passed as the client's accountId
option (sent as the X-Account-Id header) to target an org context.
The current user's account ID and organization memberships.
Get a memory bank by ID.
Memory bank identifier.
Memory bank details.
Get the last AI conversation for memory banks.
Turns to return (server default 5) and most-recent turns to skip (default 0).
Get stats for a memory bank.
Memory bank identifier.
Date range. Only startDate and endDate together replace
days; either one alone is ignored and the last days days apply (server default 30).
Get the run metadata keys a trigger declares.
Steps may reference a declared key as {{metadata.<key>}}. The response
also lists the system and source keys the trigger's type can declare.
Agent identifier.
Trigger identifier, as getAgent() returns it.
The trigger's declared and declarable metadata keys.
Get full details for a specific model.
Model identifier.
Get model recommendations.
Model identifier.
Capabilities and limits a recommended model must have.
Get a summary of non-manual evaluations, for one agent or the whole account.
OptionalagentId: stringAgent identifier. Omit (pass undefined) for the account-wide summary.
Date range. startDate and endDate together set the range;
startDate alone runs from it through today; otherwise the last days
days apply (server default 30), and an endDate without startDate is ignored.
Get a solution by ID.
Solution identifier.
Solution details.
Get a source by ID.
Source connection identifier.
Source details.
Get one content item's indexing status.
Source connection identifier.
The content_version_id an upload returned.
Get the status of a source embedding migration.
Source connection identifier.
Migration status.
Get a specific source export.
Source connection identifier.
Export identifier.
Export details.
Get unread model alert count.
Link agents to a solution.
Solution identifier.
Resource IDs to link.
Updated solution.
Link knowledge bases to a solution.
Solution identifier.
Resource IDs to link.
Updated solution.
Link source connections to a solution.
Solution identifier.
Resource IDs to link.
Updated solution.
List recipients who have opted out of this account's agent emails.
Optional agent filter and limit/offset pagination.
OptionalagentId?: stringFilter to one agent (account-wide opt-outs still apply).
Optionallimit?: numberPage size (1-200, default 50).
Optionaloffset?: numberRows to skip (default 0).
The page of opt-outs plus the total count.
List all evaluation results for an agent.
Agent identifier.
Pagination, status, step, flag and time-range filters.
List the agent gallery: example agents to start from.
Pass an entry's key as agent_template to createAgent, with
resource_bindings for the resources it needs.
Text search, use-case filter and pagination.
A page of gallery entries.
List runs for a specific agent.
Agent identifier.
Pagination and filter options.
Paginated list of runs.
List agents.
Pagination options.
Paginated list of agents.
configs and total are populated on every API version; data and
pagination are also present once apiVersion is 2026-07-27 or later.
List alerts.
Pagination and filter options.
Paginated list of alerts.
List the account's blocked inbound email senders (newest first), plus the
governance auto_block_mode.
Optional limit/offset pagination.
Offset paging. Each method documents its server defaults and bounds.
List the cloud-drive providers this deployment has configured.
The providers, read from either wire shape.
List the files a cloud-drive connection skipped, newest first.
A skipped file fires no trigger, so this is where to look when an agent did not run for a file.
Cloud-drive connection identifier.
Optionallimit?: numberMaximum number of rejections (1-200, default 50).
The rejections with their reasons, read from either wire shape.
List the account's cloud-drive connections.
The connections, read from either wire shape.
List runs compatible with a specific evaluation criteria.
Criteria identifier.
Pagination and a startedAfter filter.
List the embeddings (chunk vectors) a content attachment is indexed by. The list is empty for a file that has no completed index.
Content version identifier.
Attachment identifier.
Pagination options (limit 1-100).
Paginated list of embeddings.
List the files attached to a content item.
Files arrive from an agent's write_content_attachment step, with an email
message, from an RSS feed's feed_attachments, from a web page's media, or
as the images inside a document. Each entry says whether it is indexed for
search and, when indexing failed, why.
Content version identifier.
Pagination options.
The attachments under data with pagination.
List embeddings for a content version.
Content version identifier.
Pagination options.
Paginated list of embeddings.
List the account's vanity (<slug>.seclai.com) and custom
(agent.mycompany.com) agent-email domains.
Includes each domain's verification status and the DNS records the customer
must publish, plus the plan capabilities (can_add_vanity /
can_add_custom) and whether one of each kind already exists
(has_vanity / has_custom — the per-kind limit is 1).
Requires a user-bound credential; an account-only API key is refused with 403.
List mail an email content source refused, newest first.
Each entry says who sent the message and why it was refused, never its
subject or body. To accept a refused sender, add its from_address or that
address's domain to the source's email_allowed_senders — which only helps
when authenticated is true. Requires an account owner or administrator;
the API answers 404 for a source that is not an email source.
Source connection identifier.
Pagination options (limit 1-100).
The rejections under data with pagination.
List the embedding models a source can index with, and their pricing.
The endpoint lists the embedders under models by default and under data
once the caller opts in with apiVersion 2026-07-27 or later; models is
populated on either, with the defaults and pricing beside it.
OptionalsupportsInputMedia?: stringKeep only embedders that can index this input modality — a coarse kind (text, image, video, audio) or a full MIME.
List evaluation criteria for an agent.
Agent identifier.
Pagination options.
List evaluation criteria for an agent, with pagination metadata.
The endpoint answers with a bare array by default and with {data, pagination} once apiVersion is 2026-07-27 or later; pagination is
absent on the bare array.
Agent identifier.
Pagination options.
The criteria under data, plus the page metadata when present.
List evaluation results for a specific criteria.
Criteria identifier.
Pagination, status, flag and time-range filters.
List evaluation run summaries for an agent.
Agent identifier.
Pagination, status, step and time-range filters.
List model playground experiments.
Date range and offset paging. Only startDate and endDate
together replace days; either one alone is ignored and the last days
days apply (server default 30).
List governance AI conversations.
limit: how many conversations (the server defaults to 20).
List recent inbound emails that were quietly discarded before running an agent (unauthorized sender, unknown alias, spam/virus, flood-shed).
Optional agent filter and result limit.
OptionalagentId?: stringFilter to a single agent's rejections.
Optionallimit?: numberMaximum results (1-200, default 50).
List knowledge bases.
Pagination and sorting options.
Paginated list of knowledge bases.
List memory banks.
Pagination, sorting and a type filter.
Paginated list of memory banks.
List available memory bank templates.
List model alerts.
Pagination, an agent filter and unreadOnly.
List all enabled LLM models grouped by provider.
Optional filters.
List organization alert preferences.
Organization filter, and whether to include default subscriptions.
List the reranker models a knowledge base can use, and their pricing.
models is populated on either wire shape, as for Seclai.listEmbeddingModels.
List evaluation results for a specific agent run.
Agent identifier.
Run identifier.
Pagination options.
Paginated list of evaluation results.
List conversations for a solution.
Solution identifier.
List of conversations.
List solutions.
Pagination, sorting and a name search.
Paginated list of solutions.
List a source's content items and their indexing status.
Source connection identifier.
Pagination, sorting, and filters. Pass the content_version_id
values the upload methods return as contentVersionIds to poll a batch of
uploads in one request — about 100 at a time, since the ids travel in the
query string and a URL over 8,192 bytes is rejected with a 414. An empty
contentVersionIds matches nothing, so it returns an empty page without
sending a request.
The items under data with pagination, on every API version.
List exports for a source.
Source connection identifier.
Pagination options.
Paginated list of exports.
List sources.
Pagination, sorting, and filter options.
Paginated list of sources.
Mark an AI suggestion as accepted or rejected.
Agent identifier.
Conversation turn identifier.
Mark request payload.
Mark all model alerts as read.
Mark a specific model alert as read.
Model alert identifier.
Mark a conversation turn (e.g. accepted/rejected).
Solution identifier.
Conversation identifier.
Mark payload.
Auto-paginate through a list endpoint.
Yields individual items from each page, fetching the next page until the response reports there is none. A fetcher that answers with a bare array has no further pages, so its items are yielded once.
A function that fetches a single page given { page, limit }.
Optionalopts: { limit?: number }Page size (default: 50).
SeclaiError When a page carries its items under neither data nor items.
Validate an agent_definition payload (same shape as exportAgent)
without creating or modifying any agent.
Use this before createAgent or updateAgent with an
agent_definition to surface unresolved_refs — workflow references to
knowledge bases, memory banks, source connections, or sub-agents that
don't exist in the target account. Pass the returned ids back in
entity_remap on the commit call to substitute them.
The preview payload ({ agent_definition: ... }).
Summary of the validated payload (step counts, schedules,
alert configs, evaluation criteria, governance policies, and any
unresolved_refs).
On HTTP 422 — the body is an
AgentDefinitionImportErrorResponse with 1-indexed
line/column-anchored errors against a canonical source echo.
Revoke an opt-out, opting the recipient back in to agent emails.
Opt-out identifier.
Remove a domain and tear down its SES identity + DNS / receipt-rule recipient.
Returns a cleanup_note when the removed domain was Seclai-managed
(delegated), reminding you to delete the registrar NS delegation record
(dangling-delegation / subdomain-takeover guard). Requires an account
owner/admin.
Domain identifier.
Replace content with inline text.
Content version identifier.
Inline text replacement payload.
Make a raw HTTP request to the Seclai API.
This is a low-level escape hatch. For most operations, prefer the typed convenience methods.
HTTP method (e.g. "GET", "POST").
Request path relative to baseUrl (e.g. "/sources/").
Optionalopts: {Query params, JSON body, per-request headers, and optional AbortSignal.
Parsed JSON for JSON responses, raw text for non-JSON responses, or null for empty bodies.
SeclaiAPIValidationError For validation errors (typically HTTP 422).
SeclaiAPIStatusError For other non-success HTTP status codes.
Make a raw HTTP request and return the raw Response object (for binary downloads, etc.).
HTTP method.
Request path relative to baseUrl.
Optionalopts: {Query params, JSON body, per-request headers, and optional AbortSignal.
The raw Response object.
Manually lift the account-wide inbound-email pause.
If the queued backlog is still above the ceiling the breaker re-arms on the next evaluation — this is a one-shot override, not a permanent disable. Requires an account owner/admin.
Start an agent run.
Agent identifier.
Run request payload (input, metadata, priority, etc.).
The created agent run.
Run an agent and poll until it reaches a terminal status.
This is useful in environments where SSE streaming is unavailable.
A run's answer can be ready before its last step finishes: once
result_reported_at is set, output holds the answer. Pass
returnOnResult: true to return as soon as a run has it set, the run
runAgent() returns included. With includeStepOutputs, when that run
would end the poll and signal is not aborted, it is fetched again at
once for its step outputs.
Such a run may still be in progress: its status is not terminal and the
run can still fail, so check result_reported_at, not status.
When timeoutMs elapses first, this throws SeclaiStreamingError
with the latest run it has (the runAgent() response if no poll ran) in
run. If that run has result_reported_at
set, its output is the answer.
signal is checked at the top of each poll, after the check for a run
that ends the poll. A run that has ended the poll by then, whether the
start run or a polled one, is returned even after an abort; the start run
then comes back without step outputs, even when includeStepOutputs is
set. Otherwise an abort throws SeclaiError("Polling aborted."), which is
not an AbortError and does not carry signal.reason.
Agent identifier.
Run request payload.
Optionalopts: {Polling configuration and abort signal.
OptionalincludeStepOutputs?: booleanInclude per-step outputs in the final result.
OptionalpollIntervalMs?: numberPolling interval in ms (default: 2000).
OptionalreturnOnResult?: booleanReturn as soon as a run, the runAgent() response included, has
result_reported_at set (its answer is in output), without waiting
for later steps to finish (default: false).
Optionalsignal?: AbortSignalOptionaltimeoutMs?: numberMaximum time to wait in ms (default: 300000 = 5 min).
The terminal agent run, or, with returnOnResult, the first run
with result_reported_at set.
SeclaiStreamingError If timeoutMs elapses before the run
finished. Its run holds the latest run it has (the runAgent()
response if no poll ran).
SeclaiError "Polling aborted." If signal is aborted and,
at the next poll's check, the run has not ended the poll. It is not an
AbortError and does not carry signal.reason.
Run an agent in streaming mode and yield each SSE event as it arrives.
This is an AsyncGenerator suitable for real-time UIs that want to render
step progress as it happens.
Agent identifier.
Streaming run request payload.
Optionalopts: { signal?: AbortSignal; timeoutMs?: number }Timeout and abort signal options.
AgentRunEvent for each SSE message.
for await (const event of client.runStreamingAgent("agent-id", { input: "Hello!" })) {
// `result` carries the answer in `output`, possibly before later steps finish.
if (event.event === "result") {
console.log("Answer:", (event.data as AgentRunResponse).output);
}
if (event.event === "done") {
console.log("Final:", event.data);
}
}
Run an agent in streaming mode (SSE) and wait for the final result.
Consumes the entire SSE stream and returns only the terminal done payload.
For real-time event access, use runStreamingAgent instead. The body
takes no include_reasoning, and one passed anyway is not sent: this method
returns no stream_reasoning events.
A result event carries the run's answer in output once
result_reported_at is set, and can arrive while later steps still run.
Pass returnOnResult: true to return that result snapshot as soon as it
arrives, without waiting for done. Such a run may still be in progress:
its status is not terminal and the run can still fail, so check
result_reported_at, not status.
If timeoutMs elapses, this throws SeclaiStreamingError with the
latest snapshot in run: the result snapshot if one arrived, else the
init snapshot. An abort from signal rethrows the abort error.
By default, a stream that ends before done returns the latest snapshot
when its status is not pending, so the run returned may not have
finished: check status and result_reported_at. A stream that breaks
throws the fetch error. Pass throwOnIncomplete: true to throw
SeclaiStreamingError with the snapshot in run in both cases
instead; it is recommended, and becomes the default in the next major
version.
Agent identifier.
Streaming run request payload, without include_reasoning.
Optionalopts: {Timeout, abort signal and returnOnResult options.
OptionalreturnOnResult?: booleanReturn the result snapshot as soon as a result event arrives (its
answer is in output), without waiting for done (default: false).
Optionalsignal?: AbortSignalOptionalthrowOnIncomplete?: booleanThrow SeclaiStreamingError, with the latest snapshot in run,
whenever the stream ends or breaks before done, or the server answers
with plain JSON for a run that has not finished, instead of returning
an unfinished run or throwing the fetch error (default: false). This
becomes the default in the next major version.
OptionaltimeoutMs?: numberThe run from the done event; with returnOnResult, the
result snapshot; without throwOnIncomplete, possibly an unfinished
snapshot (see above).
SeclaiStreamingError If timeoutMs elapses, or, with
throwOnIncomplete, the stream ends or breaks, before the run finished.
Its run holds the latest snapshot.
try {
const run = await client.runStreamingAgentAndWait("agent-id", { input: "Hello" }, { throwOnIncomplete: true });
console.log(run.output);
} catch (err) {
if (err instanceof SeclaiStreamingError && err.run?.result_reported_at) {
console.log("Answer (run not finished):", err.run.output);
} else throw err;
}
Search across all resource types in your account.
Accepts a free-text keyword query or a UUID. Results are ranked: name-prefix > name-substring > description-substring.
Search options.
OptionalentityType?: stringOptional entity type filter (e.g. "agent", "knowledge_base").
Optionallimit?: numberMaximum results (1-50, default 10).
Search query string (required, 1-200 chars).
Search results.
Search agent runs (traces) across all agents.
Search query and filters.
Search results with matching runs.
Search the Seclai documentation by content.
mode: "keyword" matches page titles and summaries (fast, no AI cost);
mode: "semantic" matches page body content by meaning (uses an embedding).
Each result carries a doc_slug and an optional section anchor for
building a https://seclai.com/docs/<doc_slug>[#<anchor>] link, a score
(not comparable across modes), and — in semantic mode — a highlight
(best matching verbatim sentence; null for keyword).
Documentation is global, so results are not account-scoped.
Search options.
Optionallimit?: numberMaximum results (1-20, default 8).
Optionalmode?: "keyword" | "semantic"Search strategy (default "keyword").
Search query string (required, 1-200 chars).
Send a test message FROM a verified domain (noreply@<domain>) TO the
account owner's email.
Confirms end-to-end that the domain actually sends (SES verified, DKIM/SPF aligned). Never sends to any other address, so it can't be used as an open relay. Requires an account owner/admin.
Domain identifier.
Replace the input attachments a trigger accepts.
A run's files are each assigned to one declared attachment before any step
runs, and steps reference one as {{agent.attachments.<name>}}. The API
answers 400 when the agent references an attachment the new declaration
leaves out.
Agent identifier.
Trigger identifier, as getAgent() returns it.
The full list of accepted attachments; a slot's min defaults to 0.
The trigger's accepted attachments.
Set whether a governance BLOCK on an authenticated inbound sender auto-adds them to the blocklist.
mode is "disabled", "input", or "input_and_output".
Requires an account owner/admin.
The mode to set.
The updated blocked-sender list.
Configure an agent's EMAIL_RECEIVED trigger and return its computed
email address(es).
Sets the custom alias, the sender allowlist, and the inbound-handling flags
(ignore_auto_generated, require_sender_auth, queue_on_quota). Omitted
fields are left unchanged; passing null (or "" for alias) clears them.
Agent identifier.
Trigger identifier.
The fields to set.
The trigger's resolved addresses and config.
Replace the run metadata keys a trigger declares.
The body is the whole declaration and replaces the current one. The API answers 400 when the agent references a key that no trigger of its branch declares.
Agent identifier.
Trigger identifier, as getAgent() returns it.
The full declaration; each key's required defaults to false.
The trigger's metadata keys, with warnings naming agents whose
call_agent mapping no longer fits.
Promote a verified domain to the account's primary domain.
Agent email then sends FROM and receives ON this domain
(<agentID>@<domain>, <alias>@<domain>) instead of the shared
agent.seclai.com. The domain must be verified. Requires an account
owner/admin.
Domain identifier.
Configure an agent's SLACK_COMMAND trigger, which people run from Slack
with /seclai or the message shortcut.
Sets the Slack connection, alias (the name people type after /seclai),
form, channels, reply visibility and conversation settings. Omitted fields
are left unchanged. input is deprecated and ignored by the API.
Agent identifier.
Trigger identifier.
The fields to set.
The trigger's full Slack config, including any missing_scopes.
Start a source embedding migration.
Source connection identifier.
Migration configuration (target embedding model, etc.).
Migration status.
Submit feedback on an AI assistant interaction.
Feedback payload (thumbs up/down, optional comment).
Feedback response.
Subscribe to an alert.
Alert identifier.
Test compaction prompt standalone (not tied to a specific memory bank).
Standalone compaction test request.
Test a draft evaluation criteria without persisting it.
Agent identifier.
Draft evaluation to test.
Test evaluation response.
Test compaction for a specific memory bank.
Memory bank identifier.
Test compaction request.
Remove a blocked sender by id. Requires an account owner/admin.
Blocked-sender identifier.
Unlink agents from a solution.
Solution identifier.
Resource IDs to unlink.
Updated solution.
Unlink knowledge bases from a solution.
Solution identifier.
Resource IDs to unlink.
Updated solution.
Unlink source connections from a solution.
Solution identifier.
Resource IDs to unlink.
Updated solution.
Unsubscribe from an alert.
Alert identifier.
Update an agent.
Agent identifier.
Fields to update.
Updated agent summary.
Update an agent's definition.
Agent identifier.
Updated definition payload.
Updated agent definition.
Update an alert configuration.
Alert config identifier.
Fields to update.
Updated alert config.
Pin the account to a dated API version, or clear the pin.
Owner/admin only. The pin applies to later header-less requests; a
Seclai-Version header still overrides it, so effective_version in the
response describes this request rather than the pin just written.
A YYYY-MM-DD date to pin to, or null to clear the pin.
The updated version state.
Update a cloud-drive connection.
Cloud-drive connection identifier.
Fields to change — name and/or folder_path.
The updated connection.
Update an evaluation criteria.
Criteria identifier.
Fields to update.
Updated evaluation criteria.
Update a knowledge base.
Knowledge base identifier.
Fields to update.
Updated knowledge base.
Update a memory bank.
Memory bank identifier.
Fields to update.
Updated memory bank.
Update a solution.
Solution identifier.
Fields to update.
Updated solution.
Update a source.
Source connection identifier.
Fields to update.
Updated source.
Upload a file to use as input for a dynamic_input agent run. Any other
agent rejects the upload with HTTP 400. Files are limited to 200 MB.
From API version 2026-10-16 a file of any type is accepted and is ready
at once: pass its id as input_upload_id to runAgent.
Earlier versions accept only a fixed list of extensions and write each
file's extracted text into the run's input, so poll
getAgentInputUploadStatus until status is ready before running.
Agent identifier.
File payload and optional metadata.
Upload response with the upload ID and status.
Upload a file to replace content for an existing content version.
Content version identifier.
File payload and optional metadata.
Upload response.
Upload a file to a source.
Maximum file size: 200 MiB. Supports text, PDF, DOCX, audio, video, images, and more.
If mimeType is omitted, it will be inferred from the fileName extension when possible.
Source connection identifier.
File payload and optional metadata.
Upload response details.
Upload inline text to a source.
Source connection identifier.
Inline text upload payload.
Upload response.
Revert to the shared agent.seclai.com sending/inbound domain.
Clears the account's primary domain WITHOUT removing the configured domain(s) — they stay verified and can be promoted again later. Requires an account owner/admin.
Run a verification check immediately ("Check now").
Re-polls SES + DNS for this domain instead of waiting for the background verification sweep, and returns its updated status + DNS-record check results. Useful right after publishing the required records. Requires an account owner/admin.
Domain identifier.
Seclai JavaScript/TypeScript client.
Provides typed methods for every Seclai API endpoint, plus higher-level abstractions for streaming, polling, and pagination.
Example