Skip to content
Menu

AI providers

View .md

Beacon’s AI layer powers natural-language questions (ask), project documentation, grounding and the learning loop, and AI actors. It is optional, except that the MCP package depends on the AI package, so an MCP host always registers it.

builder.Services.AddBeaconServices(builder.Configuration, options =>
{
options.UseAI = true;
// …
});
builder.Services.AddBeaconAI(builder.Configuration); // binds Beacon:LLM, registers providers and the queue

Set both. UseAI = false registers stand-ins for the AI-only services; UseAI = true without AddBeaconAI leaves those services unregistered.

Configure the provider in host configuration (Beacon:LLM). At startup Beacon builds the provider from that section. An Admin can also change the provider in Admin settings (/beacon/admin-settings): saving swaps the active provider immediately, without a restart. If the new configuration cannot be built, no provider is active until it is fixed; the previous one is never kept.

ProviderRequiredNotes
OpenAIApiKey, ModelCalls the public OpenAI API.
Claude (shown as Anthropic in the UI)ApiKey, ModelCalls https://api.anthropic.com.
AzureOpenAIEndpoint, ApiKey, Model (the deployment name)Endpoint is an https URL; http only for a loopback host or with Beacon:LLM:AllowInsecureEndpoint (configuration).
BedrockRegion, Model (model id)Needs the Moberg.Beacon.AI.Bedrock package and AddBeaconBedrock(); without them a stored Bedrock setting leaves no active provider. BedrockAuthMode: IamRole (default) → the default AWS credential chain (instance role, environment); AccessKey → AwsAccessKeyId and AwsSecretAccessKey; TemporaryCredentials → those plus SessionToken. A legacy ApiKey of accessKey:secretKey is used when both key fields are empty; under IamRole a warning is logged.
{
"Beacon": {
"LLM": {
"Provider": "Claude",
"ApiKey": "<from a secret store>",
"Model": "<model id>",
"FastModel": "<smaller model id>",
"Limits": { "MaxConcurrentRequests": 20 }
}
}
}
{
"Beacon": {
"LLM": {
"Provider": "Bedrock",
"Region": "eu-central-1",
"Model": "<bedrock model id>"
}
}
}

Model and FastModel are free text. Use whatever model ids your provider offers. Model does the work (SQL generation, documentation, actors); FastModel names a smaller model for the short classification calls on the ask path (intent classification and data-source routing); every other call uses Model. Leave it empty, or equal to Model, to use Model for all calls; if the fast model cannot be set up or fails when called, those calls also fall back to Model.

Every LLM call goes through one queue that allows at most Limits:MaxConcurrentRequests calls at a time (default 50). Background work (documentation generation, document indexing, learning, scheduled AI actor cycles, eval judging) holds at most half of them (at least one), so interactive calls always find room. A call waits for a slot at most Limits:InteractiveQueueWaitSeconds (default 60) or, for background work, Limits:BackgroundQueueWaitSeconds (default 300), each capped at an hour, and at most Limits:MaxQueuedRequests interactive calls (default 200) and half as many background calls (at least one) wait at once, so a burst of background work cannot turn interactive calls away; past either limit the call fails with LlmQueueSaturatedException (The LLM is busy. Try again later.) without reaching the provider. The wait and waiter limits are read at startup; the concurrency limit follows Max concurrent requests in Admin Settings as soon as it is saved (a lower limit takes effect as running calls finish and never cancels one).

Each attempt holds a slot only while it runs. For Claude and Bedrock the queue is the only retry layer (the Bedrock SDK makes no retries of its own, except that a request the service refuses because the host’s clock is more than four minutes off is signed again with the service’s time and sent once more): a transient failure (Claude 408, 429, 5xx or 529; Bedrock throttling, service unavailable, model not ready, model timeout, internal error or any 408, 429 or 5xx; a connection failure; a provider timeout) is tried up to three times, waiting a random share of 1, 2, 4… seconds (at most 30) or, when the provider sent Retry-After, that wait plus up to 10 % and never less than the random share (a wait over 60 seconds fails the call); a call that still fails surfaces as LlmTransientException. OpenAI and Azure OpenAI retry 408, 429, 5xx and connection failures themselves (up to three retries) and the queue does not retry them again: a status they stopped retrying surfaces as an HttpRequestException carrying it, a connection failure or timeout as an AiServiceException. A cancelled call is never retried.

TokensPerMinute and RequestsPerMinute apply only while Limits:RateLimitsEnabled (Admin Settings: Enforce requests/tokens per minute) is on; it is off by default. Each is then a token bucket holding a minute’s allowance and refilling evenly over the minute: every attempt reserves one request and an estimate of its tokens (prompt characters / 4 plus MaxTokens) before it is sent, waits for them within its queue wait (or fails with LlmQueueSaturatedException when they cannot come in time), holds them while it waits for a slot (an attempt that is never sent gives them back), and settles the tokens with the usage the response reports when it reports the input tokens (otherwise the estimate stands). Calls wait for the buckets in arrival order, so a large call is never overtaken by smaller ones; an interactive call may pass waiting background work, and background work leaves a quarter of each bucket for interactive calls. 0 or less is unlimited. MonthlyBudget is recorded, not enforced; use your provider’s own spend limits for a hard cap.

Semantic retrieval (finding the right tables, examples and documentation chunks for a question) can use a local ONNX embedding model. Nothing leaves your process. The model support is a separate package: dotnet add package Moberg.Beacon.AI.Embeddings.Onnx, then call services.AddBeaconOnnxEmbeddings() before or after AddBeaconAI. Without it, AddBeaconAI registers a disabled service; if Enabled is true it logs one warning the first time the embedding service is used (not at startup).

{
"Beacon": {
"Embeddings": {
"Enabled": true,
"ModelPath": "/models/bge-small-en-v1.5/model.onnx",
"TokenizerPath": "/models/bge-small-en-v1.5/vocab.txt"
}
}
}
  • Model: bge-small-en-v1.5 (384 dimensions, 512 tokens). Beacon does not ship the model files; download them and mount them read-only.
  • Embeddings are used only when Enabled is true and both files exist. Otherwise Beacon falls back to keyword retrieval.
  • On PostgreSQL vectors live in a pgvector column with an HNSW index; on SQL Server they are compared in memory.
  • Schedule the re-index jobs (mcp-embedding-reindex, mcp-docchunk-reindex); see Background jobs.

By default Beacon sends schema and documentation, not row values:

DataSent?
Table and column names, types, relationships, documentation, glossary, verified examplesYes (this is the grounding)
The user’s questionYes
Sample values from tablesOnly with the per-project setting sample-value collection (off by default); never from PII or secret-like columns
Values probed to ground a question (value grounding)Only with value grounding on (off by default)
Query results for an LLM judge in evaluationsOnly with eval judge on (off by default)
Database error textRedacted: value-carrying errors are reduced to their class

Set the deployment lock Beacon:Mcp:ForbidRowDataToLlm: true to pin all three switches off for every project. Every LLM request that carries row-derived data is logged as event 7123 RowDataSentToLlm with caller, project, data source ids and categories, never the values.

FeatureNeeds
MCP ask, get_query_contextAI on; a provider for ask
Project documentationAI on, a provider, EnqueueProjectDocumentation in your scheduler
Learning loop, evaluationsAI on; scheduled maintenance jobs; EnqueueMcpEval for eval runs
AI actorsAI on, a provider, EnqueueAiActorThinkCycle in your scheduler

The MCP query, dry_run, search, get_context and get_documentation tools work without an LLM provider.

More: AI integration · Knowledge base & grounding · AI actors.