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 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.
Cancel a running agent run.
Run identifier.
Updated run (with cancelled status).
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 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.
Delete an agent run.
Run identifier.
Delete an alert configuration.
Alert config identifier.
Delete a specific content version.
Content version identifier.
Delete an evaluation criteria and all associated results.
Criteria 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.
Download a source export file.
Returns the raw Response so you can stream or save the binary data.
Source connection identifier.
Export identifier.
Raw response with the export file.
Estimate a source export.
Source connection identifier.
Estimate request.
Export estimate.
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 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.
Get agents that are using a specific memory bank.
Memory bank identifier.
Get AI assistant memory bank conversation history.
Get alert details by ID.
Alert identifier.
Alert details.
Get an alert configuration by ID.
Alert config identifier.
Alert config details.
Get content detail for a specific content version.
Content version identifier.
Range options for slicing large content.
Content details for the requested range.
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 knowledge base by ID.
Knowledge base identifier.
Knowledge base details.
Get a memory bank by ID.
Memory bank identifier.
Memory bank details.
Get the last AI conversation for memory banks.
Get stats for a memory bank.
Memory bank identifier.
Get model recommendations.
Model identifier.
Get a summary of non-manual evaluations across an agent's runs.
Agent identifier.
Get a solution by ID.
Solution identifier.
Solution details.
Get a source by ID.
Source connection identifier.
Source details.
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 all evaluation results for an agent.
Agent identifier.
Pagination options.
List runs for a specific agent.
Agent identifier.
Pagination and filter options.
Paginated list of runs.
List agents.
Pagination options.
Paginated list of agents.
List alert configurations.
Pagination options.
Paginated list of alert configs.
List alerts.
Pagination and filter options.
Paginated list of alerts.
List runs compatible with a specific evaluation criteria.
Criteria identifier.
Pagination options.
List embeddings for a content version.
Content version identifier.
Pagination options.
Paginated list of embeddings.
List evaluation criteria for an agent.
Agent identifier.
Pagination options.
List evaluation results for a specific criteria.
Criteria identifier.
Pagination options.
List evaluation run summaries for an agent.
Agent identifier.
Pagination options.
List governance AI conversations.
List knowledge bases.
Pagination and sorting options.
Paginated list of knowledge bases.
List memory banks.
Pagination and sorting options.
Paginated list of memory banks.
List available memory bank templates.
List organization alert preferences.
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 and sorting options.
Paginated list of solutions.
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, automatically fetching the next page until all items have been returned.
A function that fetches a single page given { page, limit }.
Optionalopts: { limit?: number }Page size (default: 50).
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.
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.
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).
Optionalsignal?: AbortSignalOptionaltimeoutMs?: numberMaximum time to wait in ms (default: 300000 = 5 min).
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.
Agent identifier.
Streaming run request payload.
Optionalopts: { signal?: AbortSignal; timeoutMs?: number }Timeout and abort signal options.
AgentRunEvent for each SSE message.
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.
Agent identifier.
Streaming run request payload.
Optionalopts: { signal?: AbortSignal; timeoutMs?: number }Timeout and abort signal options.
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.
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.
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.
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.
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.
After uploading, poll getAgentInputUploadStatus until status is ready,
then pass input_upload_id to runAgent.
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.
Seclai JavaScript/TypeScript client.
Provides typed methods for every Seclai API endpoint, plus higher-level abstractions for streaming, polling, and pagination.
Example