Orchardcore ai

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps.OrchardCore.AI foundation module (AI Services) in CrestApps.OrchardCore 3.0. Covers the CrestApps.OrchardCore.AI, AI.Chat.Core, AI.Chat.Api, AI.ConnectionManagement, AI.ToolInstances and AI.Personas features, the Artificial Intelligence admin screens and permissions, appsetti

How to use this skill

Skill file

Orchard Core AI Services

CrestApps.OrchardCore.AI is the Orchard foundation of the CrestApps AI suite. It wires the shared

CrestApps.Core AI services into Orchard Core and adds connection, deployment, profile, template, tool

instance and persona management, AI site settings, recipes, deployment steps and workflow activities.

Guidelines

CrestApps.OrchardCore.OpenAI.Azure, CrestApps.OrchardCore.AzureAIInference, CrestApps.OrchardCore.Ollama)

in the web/startup project.

model capabilities, and an AI profile names deployments by technical name. Where a deployment is

used is a slot (chat, utility, embedding, ...) resolved from site defaults. See

orchardcore-ai-model-capabilities.

production.

CrestApps.Core. Use crestapps-core-ai-profiles and crestapps-core-ai-runtime for framework detail.

Features

| Feature ID | Name | Notes |

| --- | --- | --- |

| CrestApps.OrchardCore.AI | AI Services | Dependency only. Deployments, profiles, profile templates, AI settings, the Cascaded Realtime deployment provider |

| CrestApps.OrchardCore.AI.Chat.Core | AI Chat Services | Dependency only. Chat sessions, session processing, response-handler selection. Depends on CrestApps.OrchardCore.AI.Prompting |

| CrestApps.OrchardCore.AI.Chat.Api | AI Chat WebAPI | REST endpoints for chat and completion, and the AG-UI endpoint POST /api/ai/v1/agui (with AI Chat; see orchardcore-ai-chat) |

| CrestApps.OrchardCore.AI.ConnectionManagement | AI Connection Management | Provider connection editor and the AIProviderConnections recipe step. See orchardcore-ai-connections |

| CrestApps.OrchardCore.AI.ToolInstances | AI Tool Instances | See orchardcore-ai-tool-instances |

| CrestApps.OrchardCore.AI.Personas | AI Personas | See orchardcore-ai-personas |

| CrestApps.OrchardCore.AI.UsageAnalytics | AI Usage Analytics | Records AI usage and adds the AI Usage Analytics report. See orchardcore-ai-usage-analytics |

| CrestApps.OrchardCore.AI.Quality | AI Quality | Simulation test cases, QA cohorts, the AI QA Dashboard report and alert rules. See orchardcore-ai-conversations |

| CrestApps.OrchardCore.AI.Webhooks | AI Webhooks | Offers AI events to the Webhooks feature (CrestApps.OrchardCore.Webhooks). See orchardcore-ai-conversations |

| CrestApps.OrchardCore.AI.CustomLlm | Custom LLM (WebSocket) | A provider that streams turns from your own WebSocket server. See orchardcore-ai-providers |

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.ConnectionManagement",
        "CrestApps.OrchardCore.OpenAI",
        "CrestApps.OrchardCore.AI.Chat"
      ],
      "disable": []
    }
  ]
}

Admin screens and permissions

| Screen | Permission |

| --- | --- |

| Artificial Intelligence > Provider Connections | ManageProviderConnections |

| Artificial Intelligence > Deployments | ManageAIDeployments |

| Artificial Intelligence > Profiles | ManageAIProfiles |

| Artificial Intelligence > Templates | ManageAIProfileTemplates |

| Artificial Intelligence > Tool Instances | ManageAIToolInstances |

| Artificial Intelligence > Personas | ManageAIPersonas |

| Artificial Intelligence > Speaking Styles, Guardrail Topics | ManageAIProfileTemplates (they are System Prompt templates in their own categories) |

| Artificial Intelligence > Voice library | ManageAIDeployments |

| Artificial Intelligence > API keys (AI Chat WebAPI) | ManageAIApiKeys |

| Artificial Intelligence > Tests, QA, Alert rules (AI Quality) | ManageAIQuality |

| Settings > Artificial Intelligence (group ai-settings) | ManageAIProfiles, plus the permission each feature's card registers |

AI Webhooks subscriptions are managed on Settings > Webhooks with the Webhooks module's Manage webhooks permission (stored name ManageCommerceWebhooks); the old Manage AI webhooks permission is no longer registered, and AIWebhookIndexMigrations carries roles that held it over to ManageCommerceWebhooks. Every saved profile is a version under the profile's

Versions page (see orchardcore-ai-conversations).

Permissions are declared in AIPermissions with LocalizationSource.Create(...) descriptions. Every list

(profiles AIProfiles, deployments AIDeployments, connections AIProviderConnections, templates

AITemplates, tool instances AIToolInstances, personas AIPersonas) renders through Orchard Core's

AdminList shape; configuration-backed deployments and connections render in a separate read-only list

(AIDeploymentsReadOnly, AIProviderConnectionsReadOnly). Rows are {Model}_SummaryAdmin (List layout)

and SummaryAdminGrid zones (Grid layout). See orchardcore-admin-lists to add columns or row actions.

Configuration (appsettings.json)

Connections and deployments are two sibling arrays under OrchardCore:CrestApps:AI. Configuration

entries appear beside stored ones and are read-only in the admin.

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "DefaultParameters": {
          "Temperature": 0,
          "MaxOutputTokens": 800,
          "PastMessagesCount": 10,
          "MaximumIterationsPerRequest": 10
        },
        "Connections": [
          {
            "Name": "openai-cloud",
            "ClientName": "OpenAI",
            "ApiKey": "<from a secret store>"
          }
        ],
        "Deployments": [
          {
            "Name": "chat-default",
            "ClientName": "OpenAI",
            "ConnectionName": "openai-cloud",
            "ModelName": "gpt-4o",
            "Properties": {
              "AIDeploymentMetadata": {
                "Features": [ "textGeneration", "toolCalling", "streaming" ]
              }
            }
          },
          {
            "Name": "embedding-default",
            "ClientName": "OpenAI",
            "ConnectionName": "openai-cloud",
            "ModelName": "text-embedding-3-large",
            "Properties": {
              "AIDeploymentMetadata": {
                "Features": [ "textEmbedding" ]
              }
            }
          }
        ]
      }
    }
  }
}

DefaultParameters keys are Temperature, MaxOutputTokens, TopP, FrequencyPenalty, PresencePenalty,

PastMessagesCount, MaximumIterationsPerRequest (default 10), AbsoluteMaximumIterationsPerRequest

(100), EnableOpenTelemetry and EnableDistributedCaching. Environment variables use __, for example

OrchardCore__CrestApps__AI__Connections__0__ApiKey. The old CrestApps_AI:DefaultParameters and

CrestApps_AI:Providers sections are still read; use the names above for new configuration.

Per-provider connection keys are in orchardcore-ai-providers.

AI site settings

Settings > Artificial Intelligence is built from cards contributed by enabled features.

| Settings class (recipe key) | Holds | Read through |

| --- | --- | --- |

| GeneralAISettings | EnablePreemptiveMemoryRetrieval, OverrideMaximumIterationsPerRequest/MaximumIterationsPerRequest, OverrideEnableDistributedCaching/EnableDistributedCaching, OverrideEnableOpenTelemetry/EnableOpenTelemetry | IOptionsMonitor<GeneralAIOptions> |

| DefaultAIDeploymentSettings | DefaultChatDeploymentName, DefaultUtilityDeploymentName, DefaultEmbeddingDeploymentName, DefaultImageDeploymentName, DefaultVisionDeploymentName, DefaultSpeechToTextDeploymentName, DefaultTextToSpeechDeploymentName, DefaultTextToSpeechVoiceId, DefaultRealtimeDeploymentName | the slot resolver |

{
  "steps": [
    {
      "name": "Settings",
      "GeneralAISettings": {
        "EnablePreemptiveMemoryRetrieval": false,
        "OverrideMaximumIterationsPerRequest": true,
        "MaximumIterationsPerRequest": 20
      },
      "DefaultAIDeploymentSettings": {
        "DefaultChatDeploymentName": "chat-default",
        "DefaultUtilityDeploymentName": "chat-default",
        "DefaultEmbeddingDeploymentName": "embedding-default"
      }
    }
  ]
}

On the General card, Maximum iterations, Distributed caching and Enable OpenTelemetry show the

value in effect. A saved value overrides configuration (CrestApps:AI:DefaultParameters) only when it differs from

it: saving sets the matching Override... flag, and a value equal to configuration keeps following configuration.

(Before #1306 the flags were never set, so saved values had no effect.) In a recipe, set the Override... flag

together with the value.

Usage tracking is no longer a setting: enable the CrestApps.OrchardCore.AI.UsageAnalytics feature. The

Costs card and AICostSettings are gone: model prices are on each deployment's Pricing card, and the

carrier's call price is on the Costs tab of Settings → Communication → Telephony (TelephonyCostSettings;

see orchardcore-ai-usage-analytics and orchardcore-telephony).

Saving General no longer reloads the tenant: GeneralAIOptions is refreshed live through

AddSignalOptionsChangeTokenSource<GeneralAIOptions>(). Code that reads it must use

IOptionsMonitor<GeneralAIOptions> (see orchardcore-site-settings).

Deployments by recipe

{
  "steps": [
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "chat-default",
          "ModelName": "gpt-4o",
          "ClientName": "OpenAI",
          "ConnectionName": "openai-cloud",
          "Properties": {
            "AIDeploymentMetadata": {
              "Features": [ "textGeneration", "toolCalling", "streaming", "structuredOutputs" ]
            }
          }
        }
      ]
    }
  ]
}

writes Deployments, so an exported plan validates against the recipe schema.

them. See orchardcore-ai-usage-analytics.

textGeneration only. Declare toolCalling and streaming explicitly for a chat model.

"IncludeAll": true.

AI profiles

| Type | Purpose |

| --- | --- |

| Chat | An assistant people talk to (chat page, widget, automated SMS and voice) |

| Utility | Background work invoked from code or workflows |

| TemplatePrompt | A prompt run against an existing chat session (PromptTemplate, PromptSubject) |

| Agent | A specialist other profiles call as a tool. Description is required |

Profile by recipe

{
  "steps": [
    {
      "name": "AIProfile",
      "Profiles": [
        {
          "Name": "support-assistant",
          "DisplayText": "Support Assistant",
          "Type": "Chat",
          "TitleType": "Generated",
          "WelcomeMessage": "How can I help?",
          "ChatDeploymentName": "chat-default",
          "UtilityDeploymentName": "chat-default",
          "Properties": {
            "AIProfileMetadata": {
              "SystemMessage": "You are a helpful support assistant.",
              "Temperature": 0.3,
              "MaxTokens": 2048,
              "PastMessagesCount": 10
            },
            "FunctionInvocationMetadata": { "Names": [] },
            "AgentInvocationMetadata": { "Names": [ "research-agent" ] },
            "PromptTemplateMetadata": {
              "Templates": [ { "TemplateId": "customer-support-tone" } ]
            },
            "AIDeploymentParametersMetadata": {
              "Values": { "reasoningEffort": "Medium" }
            }
          },
          "Settings": {
            "AIChatProfileSettings": { "IsOnAdminMenu": true },
            "ChatModeProfileSettings": { "ChatMode": "TextInput" }
          }
        }
      ]
    }
  ]
}

UtilityDeploymentName. Leave them empty to use the site defaults.

model parameter choices; a parameter the deployment does not declare is never sent.

automatically"); the property name did not change.

ConversationDeploymentName, VoiceName and EnableTextToSpeechPlayback. See

orchardcore-ai-realtime-voice.

Profile in a migration

using CrestApps.Core.AI.Models;
using CrestApps.Core.AI.Profiles;
using OrchardCore.Data.Migration;

public sealed class SupportProfileMigrations : DataMigration
{
    private readonly IAIProfileManager _profileManager;

    public SupportProfileMigrations(IAIProfileManager profileManager)
    {
        _profileManager = profileManager;
    }

    public async Task<int> CreateAsync()
    {
        var profile = await _profileManager.NewAsync();

        profile.Name = "support-assistant";
        profile.DisplayText = "Support Assistant";
        profile.Type = AIProfileType.Chat;

        profile.WithSettings(new AIProfileSettings
        {
            LockSystemMessage = true,
            IsRemovable = false,
        });

        profile.AlterSettings<ChatModeProfileSettings>(settings =>
        {
            settings.ChatMode = ChatMode.TextInput;
        });

        profile.Put(new AIProfileMetadata
        {
            SystemMessage = "You are a helpful support assistant.",
            Temperature = 0.3f,
            MaxTokens = 2048,
        });

        await _profileManager.CreateAsync(profile);

        return 1;
    }
}

Settings classes (AIProfileSettings, ChatModeProfileSettings, ResponseHandlerProfileSettings,

AIChatProfileSettings) live on profile.Settings: read them with GetSettings<T>()/TryGetSettings<T>()

and write them with WithSettings/AlterSettings<T>(). Metadata (AIProfileMetadata, AgentMetadata,

PromptTemplateMetadata) lives on Properties: use Put, TryGet and GetOrCreate.

IAIProfileManager is an INamedCatalogManager<AIProfile>: NewAsync, ValidateAsync, CreateAsync,

UpdateAsync, FindByNameAsync, DeleteAsync, plus GetAsync(AIProfileType). There is no SaveAsync.

Register the migration with services.AddDataMigration<SupportProfileMigrations>(). Framework-level profile

construction is covered by crestapps-core-ai-profiles.

Resolving deployments and clients in code

Pick a deployment for a slot, then create the client from it. The purpose-based APIs are gone.

using CrestApps.Core.AI.Clients;
using CrestApps.Core.AI.Deployments;
using CrestApps.Core.AI.Models;

public sealed class TranscriptionService
{
    private readonly IAIDeploymentManager _deploymentManager;
    private readonly IAIClientFactory _clientFactory;

    public TranscriptionService(IAIDeploymentManager deploymentManager, IAIClientFactory clientFactory)
    {
        _deploymentManager = deploymentManager;
        _clientFactory = clientFactory;
    }

    public async Task<string> TranscribeAsync(Stream audio, string deploymentName = null)
    {
        var deployment = await _deploymentManager.ResolveSlotAsync(
            AIDeploymentSlotNames.SpeechToText,
            deploymentName: deploymentName);

        if (deployment is null)
        {
            return null;
        }

        using var client = await _clientFactory.CreateSpeechToTextClientAsync(deployment);
        var response = await client.GetTextAsync(audio);

        return response.Text;
    }
}

the requested name, the site default for the slot, the fallback slot (utility falls back to chat), then

the first capable deployment.

text-to-speech and realtime clients from an AIDeployment. Each overload accepts a builder callback,

for example builder => builder.UseDefaultResilience().UseUsageLabels(purpose: "MyPurpose").

usage labels by orchardcore-ai-usage-analytics.

Recipes and deployment steps

| Recipe step | Deployment step (title) | Export selector |

| --- | --- | --- |

| AIProviderConnections | AI Provider Connections | ConnectionIds |

| AIDeployment | AI Deployments | DeploymentNames |

| DeleteAIDeployments | Delete AI Deployments | DeploymentNames |

| AIProfile | AI Profiles | ProfileNames |

| AIProfileTemplate, CreateAIProfileFromTemplate | AI Profile Templates | TemplateNames |

| AIToolInstances | AI Tool Instances | InstanceIds |

| AIPersonas | AI Personas | PersonaIds |

Every deployment step supports IncludeAll. Exported connections have their API keys blanked. The

CrestApps Recipes feature publishes the JSON schemas of these steps (see orchardcore-crestapps-recipes).

Upgrading from 2.x

GetByPurposeAsync, GetAllByPurposeAsync and ResolveOrDefaultAsync(purpose, ...) are removed. Use

GetAllBySlotAsync(AIDeploymentSlotNames.X) and ResolveSlotAsync(AIDeploymentSlotNames.X, ...).

Stored records with a legacy purpose keep working because they are projected onto capabilities on read.

ChatModeProfileSettings.ConversationDeploymentName with ChatMode.Conversation.

SummaryAdminGrid location.

instead of an ocat-wrapper / ocat-end-offset row; update overridden editor views and UI tests.

admin warning for people with ManageAIProfiles; other modules join through services.AddMigrationSkipLog().

Related skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.