Class Seclai

Seclai JavaScript/TypeScript client.

Provides typed methods for every Seclai API endpoint, plus higher-level abstractions for streaming, polling, and pagination.

import { Seclai } from "@seclai/sdk";

const client = new Seclai({ apiKey: "sk-..." });

// List agents
const { items } = await client.listAgents();

// Run an agent
const run = await client.runAgent("agent-id", { input: "Hello!" });

// Stream an agent run
for await (const event of client.runStreamingAgent("agent-id", { input: "Hello!" })) {
console.log(event.event, event.data);
}

Constructors

Methods

acceptAiAssistantPlan acceptAiMemoryBankSuggestion acceptGovernanceAiPlan acceptMemoryBankAiSuggestion acceptSolutionAiPlan addAlertComment addEmailDomain addSolutionConversationTurn aiAssistantKnowledgeBase aiAssistantMemoryBank aiAssistantSolution aiAssistantSource blockEmailSender cancelAgentRun cancelExperiment cancelQueuedEmailRuns cancelSourceEmbeddingMigration cancelSourceExport changeAlertStatus compactMemoryBank createAgent createAlertConfig createEvaluationCriteria createEvaluationResult createExperiment createKnowledgeBase createMemoryBank createSolution createSource createSourceExport declineAiAssistantPlan declineGovernanceAiPlan declineSolutionAiPlan deleteAgent deleteAgentRun deleteAlertConfig deleteContent deleteEvaluationCriteria deleteExperiment deleteKnowledgeBase deleteMemoryBank deleteMemoryBankSource deleteSolution deleteSource deleteSourceExport disableAgent downloadAgentRunAttachment downloadSourceExport enableAgent estimateSourceExport exportAgent generateAgentSteps generateGovernanceAiPlan generateMemoryBankConfig generateSolutionAiKnowledgeBase generateSolutionAiPlan generateSolutionAiSource generateStepConfig getAgent getAgentAiConversationHistory getAgentAttachmentReferences getAgentCallers getAgentDefinition getAgentInputUploadStatus getAgentRun getAgentsUsingMemoryBank getAiAssistantMemoryBankHistory getAlert getAlertConfig getApiVersion getContentDetail getDmarcSummary getEvaluationCriteria getEvaluationCriteriaSummary getExperiment getGenerationTiers getInboundEmailStatus getKnowledgeBase getMe getMemoryBank getMemoryBankAiLastConversation getMemoryBankStats getModel getModelRecommendations getNonManualEvaluationSummary getSolution getSource getSourceEmbeddingMigration getSourceExport getUnreadModelAlertCount linkAgentsToSolution linkKnowledgeBasesToSolution linkSourceConnectionsToSolution listAgentEmailOptOuts listAgentEvaluationResults listAgentRuns listAgents listAlertConfigs listAlerts listBlockedEmailSenders listCompatibleRuns listContentEmbeddings listEmailDomains listEvaluationCriteria listEvaluationCriteriaPage listEvaluationResults listEvaluationRuns listExperiments listGovernanceAiConversations listInboundEmailRejections listKnowledgeBases listMemoryBanks listMemoryBankTemplates listModelAlerts listModels listOrganizationAlertPreferences listRunEvaluationResults listSolutionConversations listSolutions listSourceExports listSources markAgentAiSuggestion markAllModelAlertsRead markModelAlertRead markSolutionConversationTurn paginate previewImportAgent removeAgentEmailOptOut removeEmailDomain replaceContentWithInlineText request requestRaw resumeInboundEmail runAgent runAgentAndPoll runStreamingAgent runStreamingAgentAndWait search searchAgentRuns searchDocs sendEmailDomainTestEmail setAutoBlockMode setEmailTriggerConfig setPrimaryEmailDomain startSourceEmbeddingMigration submitAiFeedback subscribeToAlert testCompactionPromptStandalone testDraftEvaluation testMemoryBankCompaction unblockEmailSender unlinkAgentsFromSolution unlinkKnowledgeBasesFromSolution unlinkSourceConnectionsFromSolution unsubscribeFromAlert updateAgent updateAgentDefinition updateAlertConfig updateApiVersion updateEvaluationCriteria updateKnowledgeBase updateMemoryBank updateOrganizationAlertPreference updateSolution updateSource uploadAgentInput uploadFileToContent uploadFileToSource uploadInlineTextToSource useSharedEmailDomain verifyEmailDomain

Constructors

  • Create a new Seclai client.

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

    1. Explicit apiKey option
    2. Explicit accessToken option (static string or provider function)
    3. SECLAI_API_KEY environment variable
    4. SSO profile from ~/.seclai/config + cached tokens in ~/.seclai/sso/cache/

    Parameters

    Returns Seclai

    SeclaiConfigurationError If no fetch implementation is available.

    SeclaiConfigurationError If both apiKey and accessToken are provided.

Methods

  • Accept an AI assistant suggestion.

    Parameters

    • conversationId: string

      Conversation identifier.

    • body: {}

      Acceptance request payload.

    Returns Promise<{}>

  • Accept/mark an AI memory bank suggestion.

    Parameters

    • conversationId: string

      Conversation identifier.

    • body: {}

      Acceptance payload for the memory bank suggestion.

    Returns Promise<{}>

  • Accept a governance AI plan.

    Parameters

    • conversationId: string

      Conversation identifier.

    Returns Promise<{}>

    Acceptance result.

  • Accept a memory bank AI suggestion.

    Parameters

    • conversationId: string

      Conversation identifier.

    • body: {}

      Accept request payload.

    Returns Promise<{}>

  • Accept a solution AI plan.

    Parameters

    • solutionId: string

      Solution identifier.

    • conversationId: string

      Conversation identifier.

    • body: {}

      Accept request.

    Returns Promise<{}>

    Acceptance result with executed actions.

  • Add a comment to an alert.

    Parameters

    • alertId: string

      Alert identifier.

    • body: {}

      Comment payload.

    Returns Promise<{}>

  • 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.

    Parameters

    Returns Promise<{}>

  • Add a conversation turn to a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Conversation turn payload.

    Returns Promise<{}>

    Updated conversation.

  • Generate a knowledge base configuration via AI assistant.

    Parameters

    • body: {}

      Generation request.

    Returns Promise<{}>

  • Generate a memory bank configuration via AI assistant.

    Parameters

    • body: {}

      Generation request.

    Returns Promise<{}>

  • Generate a solution via AI assistant.

    Parameters

    • body: {}

      Generation request.

    Returns Promise<{}>

  • Generate a source configuration via AI assistant.

    Parameters

    • body: {}

      Generation request.

    Returns Promise<{}>

  • 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.

    Parameters

    • body: {}

      The sender or domain to block.

    Returns Promise<{}>

    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.

    Parameters

    • runId: string

      Run identifier.

    Returns Promise<{}>

    Updated run (with cancelled status).

  • Cancel a running model playground experiment.

    Parameters

    • experimentId: string

      Experiment identifier.

    Returns Promise<{}>

  • 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.

    Returns Promise<{}>

    The count cancelled.

  • Cancel a source embedding migration.

    Parameters

    • sourceId: string

      Source connection identifier.

    Returns Promise<{}>

    Updated migration status.

  • Cancel a source export.

    Parameters

    • sourceId: string

      Source connection identifier.

    • exportId: string

      Export identifier.

    Returns Promise<{}>

  • Change the status of an alert.

    Parameters

    • alertId: string

      Alert identifier.

    • body: {}

      Status change request.

    Returns Promise<{}>

  • Compact a memory bank (trigger compaction).

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<void>

  • Create a new agent.

    Parameters

    • body: {}

      Agent creation payload (name, trigger type, template, etc.).

    Returns Promise<{}>

    Summary of the created agent.

  • Create an alert configuration.

    Parameters

    • body: {}

      Alert config definition.

    Returns Promise<{}>

    Created alert config.

  • Create evaluation criteria for an agent.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Criteria definition.

    Returns Promise<{}>

    Created evaluation criteria.

  • Create a manual evaluation result for a criteria.

    Parameters

    • criteriaId: string

      Criteria identifier.

    • body: {}

      Evaluation result payload.

    Returns Promise<{}>

    Created evaluation result.

  • Create a new knowledge base.

    Parameters

    • body: {}

      Knowledge base configuration.

    Returns Promise<{}>

    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).

    Parameters

    • body: {}

      Memory bank configuration.

    Returns Promise<{}>

    The created memory bank.

  • Create a new solution.

    Parameters

    • body: {}

      Solution configuration.

    Returns Promise<{}>

    The created solution.

  • Create a new content source.

    Parameters

    • body: {}

      Source configuration (type, name, knowledge base link, etc.).

    Returns Promise<{}>

    The created source.

  • Create a source data export.

    Parameters

    • sourceId: string

      Source connection identifier.

    • body: {}

      Export configuration (format, etc.).

    Returns Promise<{}>

    Export response with job status.

  • Decline an AI assistant suggestion.

    Parameters

    • conversationId: string

      Conversation identifier.

    Returns Promise<void>

  • Decline a governance AI plan.

    Parameters

    • conversationId: string

      Conversation identifier.

    Returns Promise<void>

  • Decline a solution AI plan.

    Parameters

    • solutionId: string

      Solution identifier.

    • conversationId: string

      Conversation identifier.

    Returns Promise<void>

  • Delete an agent.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<void>

  • Cancel an agent run.

    Parameters

    • runId: string

      Run identifier.

    Returns Promise<void>

    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.

    Parameters

    • configId: string

      Alert config identifier.

    Returns Promise<void>

  • Delete a specific content version.

    Parameters

    • contentVersionId: string

      Content version identifier.

    Returns Promise<void>

  • Delete an evaluation criteria and all associated results.

    Parameters

    • criteriaId: string

      Criteria identifier.

    Returns Promise<void>

  • Soft-delete a model playground experiment.

    Removes the experiment from list/detail views while preserving audit history. Returns HTTP 204 with no body.

    Parameters

    • experimentId: string

      Experiment identifier.

    Returns Promise<void>

  • Delete a knowledge base.

    Parameters

    • knowledgeBaseId: string

      Knowledge base identifier.

    Returns Promise<void>

  • Delete a memory bank.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<void>

  • Delete a memory bank source.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<void>

  • Delete a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    Returns Promise<void>

  • Delete a source.

    Parameters

    • sourceId: string

      Source connection identifier.

    Returns Promise<void>

  • Delete a source export.

    Parameters

    • sourceId: string

      Source connection identifier.

    • exportId: string

      Export identifier.

    Returns Promise<void>

  • 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.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

    The updated agent summary.

  • 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.

    Parameters

    • runId: string

      Run identifier.

    • attachmentId: string

      URL-safe-base64-encoded storage_key of the attachment (as surfaced in run output manifests and webhook/email payloads).

    • opts: { downloadName?: string } = {}

      Optional downloadName filename hint for the download disposition.

    Returns Promise<Response>

    Raw response with the attachment bytes.

  • Download a source export file.

    Returns the raw Response so you can stream or save the binary data.

    Parameters

    • sourceId: string

      Source connection identifier.

    • exportId: string

      Export identifier.

    Returns Promise<Response>

    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.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

    The updated agent summary.

  • Estimate a source export.

    Parameters

    • sourceId: string

      Source connection identifier.

    • body: {}

      Estimate request.

    Returns Promise<{}>

    Export estimate.

  • Export an agent definition as a portable JSON snapshot.

    Parameters

    • agentId: string

      Agent identifier.

    • download: boolean = true

      When true (default), the server sets Content-Disposition: attachment.

    Returns Promise<{}>

    The exported agent snapshot.

  • Generate agent workflow steps from natural language using AI.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Generation request with user instructions.

    Returns Promise<{}>

    AI-generated step configuration.

  • Generate governance policy suggestions using AI.

    Parameters

    • body: {}

      AI governance request.

    Returns Promise<{}>

    AI-generated governance suggestions.

  • Generate memory bank configuration using AI.

    Parameters

    • body: {}

      AI assistant request with user instructions.

    Returns Promise<{}>

    AI-generated memory bank config.

  • Generate a knowledge base configuration via solution AI.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Generation request.

    Returns Promise<{}>

    AI-generated knowledge base config.

  • Generate a solution AI plan.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Generation request.

    Returns Promise<{}>

    AI-generated plan.

  • Generate a source configuration via solution AI.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Generation request.

    Returns Promise<{}>

    AI-generated source config.

  • Generate a single step configuration using AI.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Step config generation request.

    Returns Promise<{}>

    AI-generated step config.

  • Get agent details including its definition.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

    Full agent metadata.

  • Get AI conversation history for an agent.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: { limit?: number; offset?: number; stepId?: string; stepType?: string } = {}

    Returns Promise<{}>

    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.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

    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.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}[]>

    The calling agents.

  • Get an agent's full definition (steps, model config, etc.).

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

    The agent definition.

  • Get the status of an agent input upload.

    Parameters

    • agentId: string

      Agent identifier.

    • uploadId: string

      Upload identifier.

    Returns Promise<{}>

    Upload status and metadata.

  • Get details of a specific agent run.

    Parameters

    • runId: string

      Run identifier.

    • Optionalopts: { includeStepOutputs?: boolean }

      Optional flags.

    Returns Promise<{}>

    Agent run details.

  • Get agents that are using a specific memory bank.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<unknown>

  • Get AI assistant memory bank conversation history.

    Returns Promise<{}>

  • Get alert details by ID.

    Parameters

    • alertId: string

      Alert identifier.

    Returns Promise<{}>

    Alert details.

  • Get an alert configuration by ID.

    Parameters

    • configId: string

      Alert config identifier.

    Returns Promise<{}>

    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.

    Returns Promise<{}>

    The pinned, effective, default and latest versions.

  • Get content detail for a specific content version.

    Parameters

    • contentVersionId: string

      Content version identifier.

    • opts: { end?: number; start?: number } = {}

      Range options for slicing large content.

    Returns Promise<{}>

    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.

    Parameters

    • domainId: string

      Domain identifier.

    • opts: { days?: number; topSources?: number } = {}

      Reporting window options.

      • Optionaldays?: number

        Window length in days (default 30).

      • OptionaltopSources?: number

        Number of top failing sources to return (default 10).

    Returns Promise<{}>

  • Get a single evaluation criteria by ID.

    Parameters

    • criteriaId: string

      Criteria identifier.

    Returns Promise<{}>

    Evaluation criteria details.

  • Get the evaluation summary for a specific criteria.

    Parameters

    • criteriaId: string

      Criteria identifier.

    Returns Promise<{}>

    Evaluation result summary.

  • Get a model playground experiment by ID.

    Parameters

    • experimentId: string

      Experiment identifier.

    Returns Promise<{}>

  • 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.

    Returns Promise<Record<string, unknown>>

  • 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.

    Returns Promise<{}>

  • Get a knowledge base by ID.

    Parameters

    • knowledgeBaseId: string

      Knowledge base identifier.

    Returns Promise<{}>

    Knowledge base details.

  • 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.

    Returns Promise<{}>

    The current user's account ID and organization memberships.

  • Get a memory bank by ID.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<{}>

    Memory bank details.

  • Get the last AI conversation for memory banks.

    Returns Promise<{}>

  • Get stats for a memory bank.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    Returns Promise<unknown>

  • Get full details for a specific model.

    Parameters

    • modelId: string

      Model identifier.

    Returns Promise<{}>

  • Get model recommendations.

    Parameters

    • modelId: string

      Model identifier.

    Returns Promise<{}>

  • Get a summary of non-manual evaluations across an agent's runs.

    Parameters

    • agentId: string

      Agent identifier.

    Returns Promise<{}>

  • Get a solution by ID.

    Parameters

    • solutionId: string

      Solution identifier.

    Returns Promise<{}>

    Solution details.

  • Get a source by ID.

    Parameters

    • sourceId: string

      Source connection identifier.

    Returns Promise<{}>

    Source details.

  • Get the status of a source embedding migration.

    Parameters

    • sourceId: string

      Source connection identifier.

    Returns Promise<{}>

    Migration status.

  • Get a specific source export.

    Parameters

    • sourceId: string

      Source connection identifier.

    • exportId: string

      Export identifier.

    Returns Promise<{}>

    Export details.

  • Get unread model alert count.

    Returns Promise<{}>

  • Link agents to a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to link.

    Returns Promise<{}>

    Updated solution.

  • Link knowledge bases to a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to link.

    Returns Promise<{}>

    Updated solution.

  • Link source connections to a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to link.

    Returns Promise<{}>

    Updated solution.

  • List recipients who have opted out of this account's agent emails.

    Parameters

    • opts: { agentId?: string; limit?: number; offset?: number } = {}

      Optional agent filter and limit/offset pagination.

      • OptionalagentId?: string

        Filter to one agent (account-wide opt-outs still apply).

      • Optionallimit?: number

        Page size (1-200, default 50).

      • Optionaloffset?: number

        Rows to skip (default 0).

    Returns Promise<{}>

    The page of opt-outs plus the total count.

  • List runs for a specific agent.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: ListOptions & { status?: string } = {}

      Pagination and filter options.

    Returns Promise<{}>

    Paginated list of runs.

  • List agents.

    Parameters

    Returns Promise<{}>

    Paginated list of agents.

  • List alerts.

    Parameters

    • opts: ListOptions & { severity?: string; status?: string } = {}

      Pagination and filter options.

    Returns Promise<{}>

    Paginated list of alerts.

  • List the account's blocked inbound email senders (newest first), plus the governance auto_block_mode.

    Parameters

    • opts: { limit?: number; offset?: number } = {}

      Optional limit/offset pagination.

      • Optionallimit?: number

        Page size (1-200, default 50).

      • Optionaloffset?: number

        Rows to skip (default 0).

    Returns Promise<{}>

  • List runs compatible with a specific evaluation criteria.

    Parameters

    • criteriaId: string

      Criteria identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}>

  • List embeddings for a content version.

    Parameters

    • contentVersionId: string

      Content version identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}>

    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.

    Returns Promise<{}>

  • List evaluation criteria for an agent.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}[]>

  • List evaluation criteria for an agent, with pagination metadata.

    Accepts either wire shape. The endpoint answered with a bare array before 2026-07 and with a paginated envelope after, so a client that decodes only one breaks the day the other ships. total, page and limit are absent when the endpoint answers with a bare array.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<EvaluationCriteriaListResponse>

    The criteria under data, plus the page metadata when present.

  • List evaluation results for a specific criteria.

    Parameters

    • criteriaId: string

      Criteria identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}>

  • List evaluation run summaries for an agent.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}>

  • List model playground experiments.

    Parameters

    • opts: {
          days?: number;
          endDate?: string;
          limit?: number;
          offset?: number;
          startDate?: string;
      } = {}

      Optional filters and pagination.

    Returns Promise<{}>

  • List governance AI conversations.

    Returns Promise<{}[]>

  • List recent inbound emails that were quietly discarded before running an agent (unauthorized sender, unknown alias, spam/virus, flood-shed).

    Parameters

    • opts: { agentId?: string; limit?: number } = {}

      Optional agent filter and result limit.

      • OptionalagentId?: string

        Filter to a single agent's rejections.

      • Optionallimit?: number

        Maximum results (1-200, default 50).

    Returns Promise<{}[]>

  • List available memory bank templates.

    Returns Promise<unknown>

  • List all enabled LLM models grouped by provider.

    Parameters

    • opts: {
          provider?: string;
          supportsInputMedia?: string;
          supportsOutputMedia?: string;
          supportsThinking?: boolean;
          supportsToolUse?: boolean;
      } = {}

      Optional filters.

    Returns Promise<{}[]>

  • List organization alert preferences.

    Returns Promise<{}>

  • List conversations for a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    Returns Promise<{}[]>

    List of conversations.

  • List exports for a source.

    Parameters

    • sourceId: string

      Source connection identifier.

    • opts: ListOptions = {}

      Pagination options.

    Returns Promise<{}>

    Paginated list of exports.

  • List sources.

    Parameters

    • opts: SortableListOptions & { accountId?: string } = {}

      Pagination, sorting, and filter options.

    Returns Promise<{}>

    Paginated list of sources.

  • Mark an AI suggestion as accepted or rejected.

    Parameters

    • agentId: string

      Agent identifier.

    • conversationId: string

      Conversation turn identifier.

    • body: {}

      Mark request payload.

    Returns Promise<void>

  • Mark all model alerts as read.

    Returns Promise<void>

  • Mark a specific model alert as read.

    Parameters

    • alertId: string

      Model alert identifier.

    Returns Promise<void>

  • Mark a conversation turn (e.g. accepted/rejected).

    Parameters

    • solutionId: string

      Solution identifier.

    • conversationId: string

      Conversation identifier.

    • body: {}

      Mark payload.

    Returns Promise<void>

  • Auto-paginate through a list endpoint.

    Yields individual items from each page, automatically fetching the next page until all items have been returned.

    Type Parameters

    • T

    Parameters

    • fetchPage: (
          opts: { limit: number; page: number },
      ) => Promise<
          { items: T[]; pagination?: { page: number; total_pages: number } },
      >

      A function that fetches a single page given { page, limit }.

    • Optionalopts: { limit?: number }

      Page size (default: 50).

    Returns AsyncGenerator<T, void, undefined>

    for await (const agent of client.paginate(
    (opts) => client.listAgents(opts),
    )) {
    console.log(agent);
    }
  • 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.

    Parameters

    • body: {}

      The preview payload ({ agent_definition: ... }).

    Returns Promise<{}>

    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.

    Parameters

    • optoutId: string

      Opt-out identifier.

    Returns Promise<void>

  • 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.

    Parameters

    • domainId: string

      Domain identifier.

    Returns Promise<{}>

  • Replace content with inline text.

    Parameters

    • contentVersionId: string

      Content version identifier.

    • body: {}

      Inline text replacement payload.

    Returns Promise<{}>

  • Make a raw HTTP request to the Seclai API.

    This is a low-level escape hatch. For most operations, prefer the typed convenience methods.

    Parameters

    • method: string

      HTTP method (e.g. "GET", "POST").

    • path: string

      Request path relative to baseUrl (e.g. "/sources/").

    • Optionalopts: {
          headers?: Record<string, string>;
          json?: unknown;
          query?: Record<string, unknown>;
          signal?: AbortSignal;
      }

      Query params, JSON body, per-request headers, and optional AbortSignal.

    Returns Promise<unknown>

    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.).

    Parameters

    • method: string

      HTTP method.

    • path: string

      Request path relative to baseUrl.

    • Optionalopts: {
          headers?: Record<string, string>;
          json?: unknown;
          query?: Record<string, unknown>;
          signal?: AbortSignal;
      }

      Query params, JSON body, per-request headers, and optional AbortSignal.

    Returns Promise<Response>

    The raw Response object.

    On HTTP 422 responses.

    On other non-2xx responses.

  • 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.

    Returns Promise<{}>

  • Start an agent run.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Run request payload (input, metadata, priority, etc.).

    Returns Promise<{}>

    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.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Run request payload.

    • Optionalopts: {
          includeStepOutputs?: boolean;
          pollIntervalMs?: number;
          signal?: AbortSignal;
          timeoutMs?: number;
      }

      Polling configuration and abort signal.

      • OptionalincludeStepOutputs?: boolean

        Include per-step outputs in the final result.

      • OptionalpollIntervalMs?: number

        Polling interval in ms (default: 2000).

      • Optionalsignal?: AbortSignal
      • OptionaltimeoutMs?: number

        Maximum time to wait in ms (default: 300000 = 5 min).

    Returns Promise<{}>

    The terminal agent run.

    SeclaiStreamingError On timeout.

  • 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.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Streaming run request payload.

    • Optionalopts: { signal?: AbortSignal; timeoutMs?: number }

      Timeout and abort signal options.

    Returns AsyncGenerator<AgentRunEvent, void, undefined>

    AgentRunEvent for each SSE message.

    for await (const event of client.runStreamingAgent("agent-id", { input: "Hello!" })) {
    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.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Streaming run request payload.

    • Optionalopts: { signal?: AbortSignal; timeoutMs?: number }

      Timeout and abort signal options.

    Returns Promise<{}>

    Final agent run payload from the done event.

    SeclaiStreamingError If the stream ends before a done event.

  • 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.

    Parameters

    • opts: { entityType?: string; limit?: number; query: string }

      Search options.

      • OptionalentityType?: string

        Optional entity type filter (e.g. "agent", "knowledge_base").

      • Optionallimit?: number

        Maximum results (1-50, default 10).

      • query: string

        Search query string (required, 1-200 chars).

    Returns Promise<{}>

    Search results.

  • Search agent runs (traces) across all agents.

    Parameters

    • body: {}

      Search query and filters.

    Returns Promise<{}>

    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.

    Parameters

    • opts: { limit?: number; mode?: "keyword" | "semantic"; query: string }

      Search options.

      • Optionallimit?: number

        Maximum results (1-20, default 8).

      • Optionalmode?: "keyword" | "semantic"

        Search strategy (default "keyword").

      • query: string

        Search query string (required, 1-200 chars).

    Returns Promise<Record<string, unknown>>

  • 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.

    Parameters

    • domainId: string

      Domain identifier.

    Returns Promise<{}>

  • 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.

    Parameters

    • body: {}

      The mode to set.

    Returns Promise<{}>

    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.

    Parameters

    • agentId: string

      Agent identifier.

    • triggerId: string

      Trigger identifier.

    • body: {}

      The fields to set.

    Returns Promise<{}>

    The trigger's resolved addresses and config.

  • 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.

    Parameters

    • domainId: string

      Domain identifier.

    Returns Promise<{}>

  • Start a source embedding migration.

    Parameters

    • sourceId: string

      Source connection identifier.

    • body: {}

      Migration configuration (target embedding model, etc.).

    Returns Promise<{}>

    Migration status.

  • Submit feedback on an AI assistant interaction.

    Parameters

    • body: {}

      Feedback payload (thumbs up/down, optional comment).

    Returns Promise<{}>

    Feedback response.

  • Subscribe to an alert.

    Parameters

    • alertId: string

      Alert identifier.

    Returns Promise<{}>

  • Test compaction prompt standalone (not tied to a specific memory bank).

    Parameters

    • body: {}

      Standalone compaction test request.

    Returns Promise<{}>

  • Test a draft evaluation criteria without persisting it.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Draft evaluation to test.

    Returns Promise<{}>

    Test evaluation response.

  • Test compaction for a specific memory bank.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    • body: {}

      Test compaction request.

    Returns Promise<{}>

  • Remove a blocked sender by id. Requires an account owner/admin.

    Parameters

    • blockedId: string

      Blocked-sender identifier.

    Returns Promise<void>

  • Unlink agents from a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to unlink.

    Returns Promise<{}>

    Updated solution.

  • Unlink knowledge bases from a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to unlink.

    Returns Promise<{}>

    Updated solution.

  • Unlink source connections from a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Resource IDs to unlink.

    Returns Promise<{}>

    Updated solution.

  • Unsubscribe from an alert.

    Parameters

    • alertId: string

      Alert identifier.

    Returns Promise<{}>

  • Update an agent.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated agent summary.

  • Update an agent's definition.

    Parameters

    • agentId: string

      Agent identifier.

    • body: {}

      Updated definition payload.

    Returns Promise<{}>

    Updated agent definition.

  • Update an alert configuration.

    Parameters

    • configId: string

      Alert config identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    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.

    Parameters

    • version: null | string

      A YYYY-MM-DD date to pin to, or null to clear the pin.

    Returns Promise<{}>

    The updated version state.

  • Update an evaluation criteria.

    Parameters

    • criteriaId: string

      Criteria identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated evaluation criteria.

  • Update a knowledge base.

    Parameters

    • knowledgeBaseId: string

      Knowledge base identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated knowledge base.

  • Update a memory bank.

    Parameters

    • memoryBankId: string

      Memory bank identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated memory bank.

  • Update an organization alert preference.

    Parameters

    • organizationId: string

      Organization identifier.

    • alertType: string

      Alert type.

    • body: {}

      Preference update.

    Returns Promise<{}>

  • Update a solution.

    Parameters

    • solutionId: string

      Solution identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated solution.

  • Update a source.

    Parameters

    • sourceId: string

      Source connection identifier.

    • body: {}

      Fields to update.

    Returns Promise<{}>

    Updated source.

  • Upload a file to use as input for a dynamic_input agent run.

    After uploading, poll getAgentInputUploadStatus until status is ready, then pass input_upload_id to runAgent.

    Parameters

    • agentId: string

      Agent identifier.

    • opts: {
          file: Blob | Uint8Array<ArrayBufferLike> | BufferSource;
          fileName?: string;
          mimeType?: string;
      }

      File payload and optional metadata.

    Returns Promise<{}>

    Upload response with the upload ID and status.

  • Upload a file to replace content for an existing content version.

    Parameters

    • contentVersionId: string

      Content version identifier.

    • opts: {
          file: Blob | Uint8Array<ArrayBufferLike> | BufferSource;
          fileName?: string;
          metadata?: Record<string, unknown>;
          mimeType?: string;
          title?: string;
      }

      File payload and optional metadata.

    Returns Promise<{}>

    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.

    Parameters

    • sourceId: string

      Source connection identifier.

    • opts: {
          file: Blob | Uint8Array<ArrayBufferLike> | BufferSource;
          fileName?: string;
          metadata?: Record<string, unknown>;
          mimeType?: string;
          title?: string;
      }

      File payload and optional metadata.

    Returns Promise<{}>

    Upload response details.

  • Upload inline text to a source.

    Parameters

    • sourceId: string

      Source connection identifier.

    • body: {}

      Inline text upload payload.

    Returns Promise<{}>

    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.

    Returns Promise<void>

  • 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.

    Parameters

    • domainId: string

      Domain identifier.

    Returns Promise<{}>