Skip to content

FluxbaseAdminAI

Admin AI manager for managing AI chatbots and providers Provides create, update, delete, sync, and monitoring operations

new FluxbaseAdminAI(fetch): FluxbaseAdminAI

Parameter Type
fetch FluxbaseFetch

FluxbaseAdminAI

clearEmbeddingProvider(id): Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Clear the embedding provider assignment for a provider

Parameter Type Description
id string Provider ID

Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Promise resolving to { data, error } tuple


createIntegration(request): Promise<{ data: ToolIntegration | null; error: Error | null; }>

Create a new tool integration. api_key in config is encrypted at the storage layer; never appears in plaintext in API responses.

Parameter Type
request CreateToolIntegrationRequest

Promise<{ data: ToolIntegration | null; error: Error | null; }>


createProvider(params): Promise<{ data: AIProvider | null; error: Error | null; }>

Create a new AI provider

Parameter Type Description
params { config?: Record<string, unknown>; display_name?: string; is_default?: boolean; name: string; provider_type: string; } Provider configuration including name, provider_type, and optional config
params.config? Record<string, unknown> -
params.display_name? string -
params.is_default? boolean -
params.name string -
params.provider_type string -

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with created provider


deleteChatbot(id): Promise<{ data: null; error: Error | null; }>

Delete a chatbot

Parameter Type Description
id string Chatbot ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple

const { data, error } = await client.admin.ai.deleteChatbot('uuid')

deleteIntegration(id): Promise<{ error: Error | null; }>

Delete a tool integration. Refuses to delete read-only integrations configured via env/YAML.

Parameter Type
id string

Promise<{ error: Error | null; }>


deleteProvider(id): Promise<{ data: null; error: Error | null; }>

Delete an AI provider

Parameter Type Description
id string Provider ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple


getChatbot(id): Promise<{ data: AIChatbot | null; error: Error | null; }>

Get details of a specific chatbot

Parameter Type Description
id string Chatbot ID

Promise<{ data: AIChatbot | null; error: Error | null; }>

Promise resolving to { data, error } tuple with chatbot details

const { data, error } = await client.admin.ai.getChatbot('uuid')
if (data) {
console.log('Chatbot:', data.name)
}

getIntegration(id): Promise<{ data: ToolIntegration | null; error: Error | null; }>

Get a single tool integration by ID.

Parameter Type
id string

Promise<{ data: ToolIntegration | null; error: Error | null; }>


getProvider(id): Promise<{ data: AIProvider | null; error: Error | null; }>

Get details of a specific AI provider

Parameter Type Description
id string Provider ID

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with provider details


getTableDetails(schema, table): Promise<{ data: TableDetails | null; error: Error | null; }>

Get detailed table information including columns

Use this to discover available columns before exporting.

Parameter Type Description
schema string Schema name (e.g., ‘public’)
table string Table name

Promise<{ data: TableDetails | null; error: Error | null; }>

Promise resolving to { data, error } tuple with table details

const { data, error } = await client.admin.ai.getTableDetails('public', 'users')
if (data) {
console.log('Columns:', data.columns.map(c => c.name))
console.log('Primary key:', data.primary_key)
}

linkKnowledgeBase(chatbotId, request): Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Link a knowledge base to a chatbot

Parameter Type Description
chatbotId string Chatbot ID
request LinkKnowledgeBaseRequest Link configuration

Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Promise resolving to { data, error } tuple with link details

const { data, error } = await client.admin.ai.linkKnowledgeBase('chatbot-uuid', {
knowledge_base_id: 'kb-uuid',
priority: 1,
max_chunks: 5,
similarity_threshold: 0.7,
})

listChatbotKnowledgeBases(chatbotId): Promise<{ data: ChatbotKnowledgeBaseLink[] | null; error: Error | null; }>

List knowledge bases linked to a chatbot

Parameter Type Description
chatbotId string Chatbot ID

Promise<{ data: ChatbotKnowledgeBaseLink[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with linked knowledge bases

const { data, error } = await client.admin.ai.listChatbotKnowledgeBases('chatbot-uuid')
if (data) {
console.log('Linked KBs:', data.map(l => l.knowledge_base_id))
}

listChatbots(namespace?): Promise<{ data: AIChatbotSummary[] | null; error: Error | null; }>

List all chatbots (admin view)

Parameter Type Description
namespace? string Optional namespace filter

Promise<{ data: AIChatbotSummary[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with array of chatbot summaries

const { data, error } = await client.admin.ai.listChatbots()
if (data) {
console.log('Chatbots:', data.map(c => c.name))
}

listIntegrations(params?): Promise<{ data: ToolIntegration[] | null; error: Error | null; }>

List tool integrations, optionally filtered by integration_type.

Parameter Type
params? { integration_type?: IntegrationType; }
params.integration_type? IntegrationType

Promise<{ data: ToolIntegration[] | null; error: Error | null; }>

const { data, error } = await client.admin.ai.listIntegrations({ integration_type: "web_search" })

listProviders(): Promise<{ data: AIProvider[] | null; error: Error | null; }>

List all AI providers

Promise<{ data: AIProvider[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with array of providers

const { data, error } = await client.admin.ai.listProviders()
if (data) {
console.log('Providers:', data.map(p => p.name))
}

setDefaultIntegration(id): Promise<{ error: Error | null; }>

Mark an integration as the default for its integration_type within the current tenant. The server clears any prior default in the same transaction.

Parameter Type
id string

Promise<{ error: Error | null; }>


setDefaultProvider(id): Promise<{ data: AIProvider | null; error: Error | null; }>

Set a provider as the default provider

Parameter Type Description
id string Provider ID

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider


setEmbeddingProvider(id): Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Set a provider as the embedding provider

Parameter Type Description
id string Provider ID

Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider


sync(options?): Promise<{ data: SyncChatbotsResult | null; error: Error | null; }>

Sync chatbots from filesystem or API payload

Can sync from:

  1. Filesystem (if no chatbots provided) - loads from configured chatbots directory
  2. API payload (if chatbots array provided) - syncs provided chatbot specifications

Requires service_role or admin authentication.

Parameter Type Description
options? SyncChatbotsOptions Sync options including namespace and optional chatbots array

Promise<{ data: SyncChatbotsResult | null; error: Error | null; }>

Promise resolving to { data, error } tuple with sync results

// Sync from filesystem
const { data, error } = await client.admin.ai.sync()
// Sync with provided chatbot code
const { data, error } = await client.admin.ai.sync({
namespace: 'default',
chatbots: [{
name: 'sql-assistant',
code: myChatbotCode,
}],
options: {
delete_missing: false, // Don't remove chatbots not in this sync
dry_run: false, // Preview changes without applying
}
})
if (data) {
console.log(`Synced: ${data.summary.created} created, ${data.summary.updated} updated`)
}

testIntegration(id): Promise<{ data: TestToolIntegrationResult | null; error: Error | null; }>

Test an integration by running a real “hello world” call against its provider. Stores last_tested_at + last_test_status + error on the integration row so the admin UI can display health.

Parameter Type
id string

Promise<{ data: TestToolIntegrationResult | null; error: Error | null; }>

const { data, error } = await client.admin.ai.testIntegration(integrationId)
if (data?.status === "ok") { console.log("Tavily credentials verified") }

toggleChatbot(id, enabled): Promise<{ data: AIChatbot | null; error: Error | null; }>

Enable or disable a chatbot

Parameter Type Description
id string Chatbot ID
enabled boolean Whether to enable or disable

Promise<{ data: AIChatbot | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated chatbot

const { data, error } = await client.admin.ai.toggleChatbot('uuid', true)

unlinkKnowledgeBase(chatbotId, knowledgeBaseId): Promise<{ data: null; error: Error | null; }>

Unlink a knowledge base from a chatbot

Parameter Type Description
chatbotId string Chatbot ID
knowledgeBaseId string Knowledge base ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple

const { data, error } = await client.admin.ai.unlinkKnowledgeBase('chatbot-uuid', 'kb-uuid')

updateChatbotKnowledgeBase(chatbotId, knowledgeBaseId, updates): Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Update a chatbot-knowledge base link

Parameter Type Description
chatbotId string Chatbot ID
knowledgeBaseId string Knowledge base ID
updates UpdateChatbotKnowledgeBaseRequest Fields to update

Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated link

const { data, error } = await client.admin.ai.updateChatbotKnowledgeBase(
'chatbot-uuid',
'kb-uuid',
{ max_chunks: 10, enabled: true }
)

updateIntegration(id, request): Promise<{ data: ToolIntegration | null; error: Error | null; }>

Update an existing tool integration. Passing config.api_key = “masked” preserves the existing encrypted value (useful when the admin changes only the name and not the API key).

Parameter Type
id string
request UpdateToolIntegrationRequest

Promise<{ data: ToolIntegration | null; error: Error | null; }>


updateProvider(id, updates): Promise<{ data: AIProvider | null; error: Error | null; }>

Update an existing AI provider

Parameter Type Description
id string Provider ID
updates { config?: Record<string, unknown>; display_name?: string; embedding_model?: string | null; enabled?: boolean; } Fields to update
updates.config? Record<string, unknown> -
updates.display_name? string -
updates.embedding_model? string | null -
updates.enabled? boolean -

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider