Open Closed

Questions about AI Framework & AI Management modules (availability and custom chat client integration) #10089


User avatar
0
Frontis2 created

I’m currently exploring the new AI-related features in ABP based on the following documentation pages:

https://abp.io/docs/10.0/framework/infrastructure/artificial-intelligence

https://abp.io/docs/10.0/modules/ai-management

I understand that these AI modules are currently in preview, and that’s perfectly fine for our use case.

I have a few concrete questions:

Using the preview modules

Is there anything specific we need to do or enable in order to start using and testing these AI modules in a real (but controlled) project?

Are there any important current limitations or “known gaps” we should be aware of when adopting the preview (e.g. missing scenarios, not-yet-implemented providers, configuration restrictions)?

Roadmap / planning

What is the current roadmap for these AI modules?

Are there specific milestones or upcoming features you can already share (for example around agent support, orchestration, management UI, etc.)?

Do you expect significant breaking changes in the APIs/configuration as the modules evolve, or do you aim to keep the current abstractions relatively stable?

Custom chat client calling an external API (AI agents)

We have a concrete customer scenario:

The customer wants us to build AI agents using ABP-based application.

At the same time, the customer is building their own API endpoint so they can host and manage AI agents themselves.

Our application should act as a client to that external AI/agent API.

In this context, we would like to know:

Can we configure a custom chat client that calls this external API endpoint using the ConfigureChatClient configuration?

If yes:

What is the recommended way to plug such a custom chat client into the AI infrastructure / AI Management module so that it behaves similarly to the built-in providers?

Do you have a minimal example (or guidance) for implementing a custom chat client that forwards requests to an arbitrary HTTP endpoint?

Our goal is to leverage the ABP AI abstractions (for consistency and future maintainability), while letting the actual AI/agent logic run in the customer’s own API.


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • Using the preview modules
      • Install and enable:
        • Add Volo.Abp.AI and Volo.Abp.AI.Management packages to your solution and add the corresponding module dependencies in your module classes.
        • Configure an IChatClient via Microsoft.Extensions.AI in your web (or application) module. ABP’s AI infrastructure is designed to work with Microsoft.Extensions.AI abstractions.
        • Example minimal setup (OpenAI shown as a reference provider):
    using Microsoft.Extensions.AI;
          using OpenAI;
    
          [DependsOn(
              typeof(AbpAIModule),          // AI infrastructure
              typeof(AiManagementModule)    // AI Management module
          )]
          public class MyProjectWebModule : AbpModule
          {
              public override void ConfigureServices(ServiceConfigurationContext context)
              {
                  var configuration = context.Services.GetConfiguration();
    
                  context.Services.AddSingleton(new OpenAIClient(configuration["AI:OpenAI:Key"]));
    
                  context.Services.AddChatClient(services =>
                      services.GetRequiredService<OpenAIClient>()
                              .AsChatClient(configuration["AI:OpenAI:Chat:ModelId"] ?? "gpt-4o-mini"));
              }
          }
    
    - appsettings.json example:
    
    {
            "AI": {
              "OpenAI": {
                "Key": "YOUR-KEY",
                "Chat": { "ModelId": "gpt-4o-mini" }
              }
            }
          }
    
    • Current limitations to be aware of (preview):

      • Provider coverage is driven by Microsoft.Extensions.AI integrations; features vary per provider (e.g., tool/function calling, images, embeddings). Ensure the chosen provider supports your required capabilities.
      • The AI Management module is evolving: management UI and orchestration features are being expanded; some scenarios may be incomplete in preview.
      • Expect changes while in preview; validate your configuration and keep packages in sync with the related ABP version.
    • Roadmap / planning

      • The modules are in preview; ABP aims to build on Microsoft.Extensions.AI and add management, configuration, and orchestration capabilities on top. Some features (like deeper agent/orchestration support and richer management UI) are planned and rolling out. While abstractions are intended to be stable, preview implies there may be breaking changes. Follow the docs/changelogs for updates as versions progress from preview to stable.
    • Custom chat client calling an external API (AI agents)

      • Yes, you can plug a custom chat client using ConfigureChatClient/AddChatClient. The recommended way is to implement Microsoft.Extensions.AI.IChatClient (or adapt an existing client) and register it, so the rest of ABP AI infrastructure and AI Management can use it like built-in providers.
      • Minimal example: forwarding to an arbitrary HTTP endpoint
    using System.Net.Http;
        using System.Net.Http.Json;
        using System.Threading;
        using System.Threading.Tasks;
        using Microsoft.Extensions.AI;
    
        public sealed class HttpForwardingChatClient : IChatClient
        {
            private readonly HttpClient _http;
            private readonly string _endpoint; // e.g. https://customer-api.example.com/agent/chat
    
            public HttpForwardingChatClient(HttpClient http, string endpoint)
            {
                _http = http;
                _endpoint = endpoint;
            }
    
            public async Task<ChatCompletion> CompleteAsync(
                ChatMessage message,
                ChatOptions options = null,
                CancellationToken cancellationToken = default)
            {
                var payload = new
                {
                    input = message.Text,
                    // optionally map options (system prompt, temperature, tools, etc.)
                };
    
                var response = await _http.PostAsJsonAsync(_endpoint, payload, cancellationToken);
                response.EnsureSuccessStatusCode();
                var result = await response.Content.ReadFromJsonAsync<ExternalResponse>(cancellationToken: cancellationToken);
    
                return new ChatCompletion(new ChatMessage(Role.Assistant, result?.Output ?? string.Empty));
            }
    
            // Implement other IChatClient members if needed by your use-cases (e.g., streaming)
            private sealed class ExternalResponse
            {
                public string Output { get; set; }
            }
        }
    
    - Registering the custom client with ABP AI:
    
    [DependsOn(typeof(AbpAIModule), typeof(AiManagementModule))]
          public class MyProjectWebModule : AbpModule
          {
              public override void ConfigureServices(ServiceConfigurationContext context)
              {
                  var configuration = context.Services.GetConfiguration();
                  context.Services.AddHttpClient<HttpForwardingChatClient>(client =>
                  {
                      client.BaseAddress = new Uri(configuration["AI:ExternalAgent:BaseUrl"]);
                  });
    
                  context.Services.AddChatClient(sp =>
                      sp.GetRequiredService<HttpForwardingChatClient>());
              }
          }
    
    - After registration, you can inject IChatClient anywhere (app services, pages, components) and AI Management can treat it similarly to built-in providers, as the integration point is the same abstraction (IChatClient). If your scenario requires streaming, tools/functions, or multi-turn context, implement the corresponding members or map the needed options to your external API.
    
    1. Sources
    • ABP AI infrastructure (preview) overview:
      • https://abp.io/docs/10.0/framework/infrastructure/artificial-intelligence
    • AI Management module:
      • https://abp.io/docs/10.0/modules/ai-management
    • Example of configuring IChatClient via Microsoft.Extensions.AI in ABP (community article showing the same patterns used by ABP AI):
      • https://abp.io/community/articles/rsfvihla

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    Frontis2 created

    AI agent answer is not relevant for us :)

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 07, 2025, 08:20