/abp-sensei:abp-aifrom ABP Sensei
Integrates AI into ABP Framework v10.x using Microsoft.Extensions.AI, Semantic Kernel, and Microsoft Agent Framework. Covers AI workspaces, RAG, document indexing, and MCP servers.
Ships in ABP Sensei. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Guide to ABP Framework v10.x (10.4–10.6) AI integration. Microsoft.Extensions.AI, Semantic Kernel, Microsoft Agent Framework, AI Workspaces, AI Management module (Pro), RAG with document indexing and chunking.
ABP integrates AI via Microsoft's AI libraries around one core concept: the AI Workspace — an isolated, named AI configuration scope. You configure workspaces once, then resolve AI services per workspace.
abp add-package Volo.Abp.AI
The Volo.Abp.AI package integrates with three libraries:
| Library | When to use |
|---|---|
| Microsoft.Extensions.AI | Library/module developers — minimal, simple abstractions (IChatClient) |
Microsoft Agent Framework (Microsoft.Agents.AI) | Recommended for applications — successor of AutoGen + Semantic Kernel; single/multi-agent patterns, thread-based state, filters, telemetry |
| Microsoft.SemanticKernel | Only if you need its specific AI integration features |
public class MyService
{
private readonly IChatClient _chatClient;
public MyService(IChatClient chatClient) => _chatClient = chatClient;
public async Task<string> GetResponseAsync(string prompt)
{
return await _chatClient.GetResponseAsync(prompt);
}
}
Use the accessor when AI is optional (e.g., a reusable module that may or may not have AI configured):
public class MyService
{
private readonly IChatClientAccessor _chatClientAccessor;
public MyService(IChatClientAccessor chatClientAccessor) => _chatClientAccessor = chatClientAccessor;
public async Task<string> GetResponseAsync(string prompt)
{
var chatClient = _chatClientAccessor.ChatClient;
if (chatClient is null)
{
return "No chat client configured";
}
return await chatClient.GetResponseAsync(prompt);
}
}
A workspace is a class decorated with WorkspaceNameAttribute:
using Volo.Abp.AI;
[WorkspaceName("CommentSummarization")]
public class CommentSummarization
{
}
Rules:
Resolve a typed (workspace-scoped) chat client:
public class MyService
{
private readonly IChatClient<CommentSummarization> _chatClient;
public MyService(IChatClient<CommentSummarization> chatClient) => _chatClient = chatClient;
public async Task<string> GetResponseAsync(string prompt)
{
return await _chatClient.GetResponseAsync(prompt);
}
}
Fallback: if a chat client is not configured for the specified workspace, the default workspace's chat client is returned. IChatClientAccessor<TWorkSpace>.ChatClient is null only when neither the workspace nor the default is configured — always null-check the accessor.
Workspaces are configured with AbpAIWorkspaceOptions in PreConfigureServices — it must run before services are registered. You need a provider package such as Microsoft.Extensions.AI.OpenAI or OllamaSharp.
[DependsOn(typeof(AbpAIModule))]
public class MyProjectModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpAIWorkspaceOptions>(options =>
{
// Default workspace
options.Workspaces.ConfigureDefault(configuration =>
{
configuration.ConfigureChatClient(chatClientConfiguration =>
{
chatClientConfiguration.Builder = new ChatClientBuilder(
sp => new OllamaApiClient("http://localhost:11434", "mistral")
);
});
});
// Isolated workspace
options.Workspaces.Configure<CommentSummarization>(configuration =>
{
configuration.ConfigureChatClient(chatClientConfiguration =>
{
chatClientConfiguration.Builder = new ChatClientBuilder(
sp => new OllamaApiClient("http://localhost:11434", "mistral")
);
});
});
});
}
}
Builder is set once and builds the IChatClient instance.BuilderConfigurers is a list of actions applied to the builder for incremental changes, executed in order.Works on top of IChatClient — the workspace configuration is identical to Microsoft.Extensions.AI. Create agents with the CreateAIAgent extension method:
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
public class MyService
{
private readonly IChatClient _chatClient;
public MyService(IChatClient chatClient) => _chatClient = chatClient;
public async Task<string> GetResponseAsync(string userMessage)
{
AIAgent agent = _chatClient.CreateAIAgent(
instructions: "You are a helpful assistant that provides concise answers."
);
AgentRunResponse response = await agent.RunAsync(userMessage);
return response.Text;
}
}
Workspace-scoped agents work the same way — inject IChatClient<CustomerSupport> and call CreateAIAgent on it. For optional AI, use IChatClientAccessor / IChatClientAccessor<TWorkSpace> and null-check before CreateAIAgent.
Resolve IKernelAccessor (or IKernelAccessor<TWorkSpace> for a workspace). The Kernel may be null if not configured — always check:
public class MyService
{
private readonly IKernelAccessor _kernelAccessor;
public MyService(IKernelAccessor kernelAccessor) => _kernelAccessor = kernelAccessor;
public async Task<string> GetResponseAsync(string prompt)
{
var kernel = _kernelAccessor.Kernel;
if (kernel is null)
{
return "No kernel configured";
}
return await kernel.InvokeAsync(prompt);
}
}
Configuration mirrors the chat client, but uses ConfigureKernel (requires a connector package, e.g. Microsoft.SemanticKernel.Connectors.AzureOpenAI):
PreConfigure<AbpAIWorkspaceOptions>(options =>
{
options.Workspaces.ConfigureDefault(configuration =>
{
configuration.ConfigureKernel(kernelConfiguration =>
{
kernelConfiguration.Builder = Kernel.CreateBuilder()
.AddAzureOpenAIChatClient("...", "...");
});
});
});
Note: unlike the typed chat client, a workspace-scoped kernel does not fall back to the default — IKernelAccessor<TWorkSpace>.Kernel is null if that workspace has no kernel configured.
The AI Management module (commercial) manages workspaces dynamically — database-persisted, with admin UI (MVC, Angular, Blazorise, MudBlazor, React Admin Console) and API endpoints — on top of the framework's AI Workspaces.
abp add-module Volo.AIManagement
At least one provider package is required:
abp add-package Volo.AIManagement.OpenAI # OpenAI / Azure OpenAI-compatible
abp add-package Volo.AIManagement.Ollama # Local models
| System | Dynamic | |
|---|---|---|
| Defined | In code via PreConfigure<AbpAIWorkspaceOptions> | UI, or ApplicationWorkspaceManager + IWorkspaceRepository |
| Deletable in UI | No | Yes |
| Config source | Code-defined client by default; DB settings only when OverrideSystemConfiguration = true | Database |
| Synchronized | Automatically at startup | — |
Programmatic creation (data seeding):
public class WorkspaceDataSeederContributor : IDataSeedContributor, ITransientDependency
{
// Inject: IConfiguration, IWorkspaceRepository, ApplicationWorkspaceManager
public async Task SeedAsync(DataSeedContext context)
{
var workspace = await _applicationWorkspaceManager.CreateAsync(
name: "CustomerSupportWorkspace",
provider: "OpenAI",
modelName: "gpt-4");
workspace.ApiKey = _configuration["AI:OpenAI:ApiKey"];
workspace.SystemPrompt = "You are a helpful customer support assistant.";
await _workspaceRepository.InsertAsync(workspace);
}
}
Security: API keys, embedding keys, vector-store connection settings and MCP credentials are sensitive persisted configuration — never hard-code them in source control; supply from a secure configuration provider and restrict admin permissions. Duplicating a workspace also duplicates its credentials.
Resolution precedence: no persisted config / inactive / system workspace without override → code-defined keyed IChatClient, then default IChatClient. Active dynamic (or overridden system) workspace → the factory registered for its persisted Provider value.
Use Volo.AIManagement.Client.HttpApi.Client to consume a central AI Management service:
// Inject IChatCompletionClientAppService
var request = new ChatClientCompletionRequestDto
{
Messages = [new ChatMessageDto { Role = ChatRole.User, Content = prompt }]
};
var response = await _chatService.ChatCompletionsAsync(workspaceName, request);
return response.Text;
Streaming: await foreach (var update in _chatService.StreamChatCompletionsAsync(workspaceName, request)).
The module exposes an OpenAI-compatible REST API at /v1 (/v1/chat/completions, /v1/completions, /v1/models, /v1/embeddings), so tools like AnythingLLM, Open WebUI or the OpenAI SDK can connect directly. The model value is a workspace name; all endpoints require an authenticated Bearer token; GET /v1/models returns only workspaces the user may consume.
Manage external MCP servers as tools for workspaces. Transports: Stdio, SSE, StreamableHttp; HTTP auth: None / API Key / Bearer / Custom header. Tune timeouts:
Configure<McpClientFactoryOptions>(options =>
{
options.DefaultTimeoutMs = 180_000; // default 120s
options.StdioInitializationTimeoutMs = 240_000;
options.StdioConnectionTestTimeoutSeconds = 300; // default 180s, clamped 30–600
});
One registered IChatClientFactory per provider name:
public class AzureOpenAIChatClientFactory : IChatClientFactory, ITransientDependency
{
public string Provider => "AzureOpenAI";
public Task<IChatClient> CreateAsync(ChatClientCreationConfiguration configuration)
{
var client = new AzureOpenAIClient(
new Uri(configuration.ApiBaseUrl ?? throw new ArgumentNullException(nameof(configuration.ApiBaseUrl))),
new AzureKeyCredential(configuration.ApiKey ?? throw new ArgumentNullException(nameof(configuration.ApiKey)))
);
var modelName = configuration.ModelName ??
throw new ArgumentNullException(nameof(configuration.ModelName));
var builder = new ChatClientBuilder(sp =>
client.GetChatClient(modelName).AsIChatClient());
builder.UseFunctionInvocation(); // required for RAG/MCP tools
return Task.FromResult<IChatClient>(builder.Build());
}
}
// Registration
Configure<ChatClientFactoryOptions>(options =>
{
options.AddFactory<AzureOpenAIChatClientFactory>("AzureOpenAI");
});
RAG requires an embedder (e.g., OpenAI text-embedding-3-small, Ollama nomic-embed-text) and a vector store per workspace:
abp add-package Volo.AIManagement.VectorStores.Pgvector # or .MongoDB / .Qdrant
Built-in provider names: embedders OpenAI, Ollama; vector stores MongoDb, Pgvector, Qdrant. The MongoDb provider requires MongoDB Atlas ($vectorSearch) with a vector_index on the AIVectorEmbeddings collection. Qdrant settings discard the URL scheme — do not rely on https:// for TLS.
When a file (.txt, .md, .pdf by default, max 10 MB — configurable via WorkspaceDataSourceOptions) is uploaded as a workspace data source:
IndexDocumentJob queued.DocumentProcessingManager extracts text via content-type-specific IDocumentTextExtractors.IDocumentChunkRepository.IsProcessed = true after the final batch succeeds.Each indexing run has an identifier and a per-data-source distributed lock; stale/duplicate batches are ignored, out-of-order batches retried by the background job system. A failed run can leave partial vector data until retry or re-index. Deleting a data source removes its vector embeddings, document chunks and blob.
v10.6+: indexing gained bounded-batch resilience (batch work is bounded so a failing or oversized batch cannot wedge the whole indexing run), and IDocumentChunkRepository gained a new paged datasource query overload — page through a data source's chunks instead of loading them all when building custom re-indexing or inspection logic.
Configure<AIManagementIndexingOptions>(options =>
{
options.EmbeddingBatchSize = 100; // default 50
options.MaxConcurrentIndexingJobs = 2; // default 1
options.DistributedLockTimeoutSeconds = 15; // default 0 = immediate attempt
});
Both the concurrency limiter and per-data-source lock use the ABP distributed lock — cross-instance only with a real distributed lock provider.
A resolved dynamic (or overridden system) workspace with embedder config gets a search_documents tool function wrapped around its chat client (delegates to IDocumentSearchService, TopK = 5). The client must be a FunctionInvokingChatClient — built-in factories call UseFunctionInvocation(); custom factories must too. If RAG retrieval fails, chat continues without injected context.
Under /api/ai-management/workspace-data-sources: POST /workspace/{workspaceId} (upload), GET /by-workspace/{workspaceId}, GET /{id}, PUT /{id}, DELETE /{id}, GET /{id}/download, POST /{id}/reindex, POST /workspace/{workspaceId}/reindex-all.
PreConfigureServices: AbpAIWorkspaceOptions must be set before service registration.IChatClientAccessor / IKernelAccessor return null when unconfigured — always null-check.IConfiguration/secret stores; restrict AI Management admin permissions.UseFunctionInvocation() in custom chat client factories, or RAG/MCP tools will not execute.MaxConcurrentIndexingJobs only after checking embedder rate limits and vector-store capacity; use a real distributed lock provider in clusters.RequiredPermissionName or the Volo.AIManagement.Workspaces.Workspace.Consume resource permission — consumption grants do not allow editing workspaces or uploading documents.PreConfigureServices, DIWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub burakdmir/abp-skills --plugin abp-sensei26 skills in this plugin
/abp-apiABP Framework v10.x (10.4–10.6) API development: Auto API Controllers, dynamic and static C#/JS client proxies, Swagger, API versioning, Integration Services. Use when you need a REST API, controller, dynamic proxy or client generation in ABP./abp-audit-loggingABP Framework v10.x (10.4–10.6) audit logging: AbpAuditingOptions, entity history, IAuditingStore, audit log storage and filtering. Use when configuring audit trails, audit logs, or entity history in ABP./abp-authorizationABP Framework v10.x (10.4–10.6) authorization: defining permissions (PermissionDefinitionProvider), [Authorize], CheckPolicyAsync/IsGrantedAsync, CurrentUser, IPermissionManager, resource-based auth, multi-tenancy permissions. Use when you need permission, role or access checks in ABP./abp-cliABP Framework v10.x (10.4–10.6) CLI and tooling: abp new, add-package, generate-proxy, ABP Studio, ABP Suite, --modern flag. Use when working with ABP CLI commands, creating projects, adding packages, or generating proxies./abp-daprABP Framework v10.x (10.4–10.6) Dapr integration: Volo.Abp.Dapr packages, service invocation via C# API client proxies (Volo.Abp.Http.Client.Dapr), distributed event bus over Dapr pub/sub (Volo.Abp.EventBus.Dapr + Volo.Abp.AspNetCore.Mvc.Dapr.EventBus), distributed lock, AbpDaprOptions, API token security. Use when you need Dapr sidecar communication, Dapr pub/sub, or Dapr service invocation in ABP./abp-dddABP Framework v10.x (10.4–10.6) Domain Driven Design: Entity, AggregateRoot, repository, domain service, application service, DTO, domain events (AddLocalEvent/AddDistributedEvent), specification, value object, UOW. Use when designing the domain layer, entities, aggregates, or repositories in ABP.Other plugins' skills for the same job