crestapps/crestapps.agentskills/crestapps-core-ai-runtime

Claude Code and agent skill by crestapps/crestapps.agentskills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Skill for the provider-agnostic AI runtime in CrestApps.Core 2.0. Covers AddCoreAIServices and AddAISuite registration, provider connections and configured deployments under CrestApps AI Connections and Deployments, declaring deployment Features instead of the removed Purpose or Type, resolving deployments through slots with IAIDeploymentManager ResolveSlotAsync, GetAllBySlotAsync, ResolveUtilityOrDefaultAsync and ResolveSlotOrThrowAsync, DefaultAIDeploymentSettings site defaults, IAIClientFactory chat, embedding, image, speech and realtime clients, IAICompletionService and IAICompletionContextBuilder, custom IAICompletionClient providers, and upgrading 1.x code that used AIDeploymentPurpose. Use it when wiring AI services into an ASP.NET Core host, picking a deployment in code, or troubleshooting deployments that do not resolve.

Install

npx vskill@latest install crestapps/crestapps.agentskills/crestapps-core-ai-runtime

SKILL.md

The same SKILL.md was published earlier as crestapps/crestapps.agentskills/crestapps-core-ai-runtime.

CrestApps.Core AI Runtime

The runtime is the provider-agnostic layer every other AI feature builds on. A connection holds credentials and an endpoint, a deployment names a model on a connection and declares what that model can do, and a slot says what the installation uses a deployment for.

Guidelines

  • Prefer AddCrestAppsCore(...).AddAISuite(...) for application composition. Use AddCoreAIServices() only when the host composes raw service registrations itself.
  • Program against IAIClientFactory, IAICompletionService, IAICompletionContextBuilder and IAIDeploymentManager. Never create a provider SDK client in business code.
  • Every configured deployment declares its model capabilities through Features. A configured entry with no features and no legacy purpose is skipped at startup with the warning "declares no model capabilities".
  • Pick deployments through slots (AIDeploymentSlotNames) and ResolveSlotAsync(...). There is no deployment purpose or type in 2.0.
  • Use crestapps-core-ai-model-capabilities for registering features, parameters and slots, crestapps-core-ai-usage-metering for usage records, crestapps-core-observability for traces and metrics, and the provider skills (crestapps-core-openai, crestapps-core-azure-openai, crestapps-core-ollama, crestapps-core-azure-ai-inference) for provider-specific settings.

Registration

csharp
using CrestApps.Core.AI;
using CrestApps.Core.AI.OpenAI;
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddOpenAI()
)
);

AddAISuite(...) calls AddCoreServices(), AddCoreAIServices() and AddCoreAIOrchestration(). Without the builder:

csharp
builder.Services
.AddCoreAIServices()
.AddCoreAIOrchestration()
.AddCoreAIOpenAI();

AddCoreAIServices() also chains AddCoreAITemplating() and AddCoreAIDeploymentCapabilities() (features, parameters and slots). IAIDeploymentManager is registered by AddCoreAIOrchestration(), so register orchestration whenever code resolves deployments.

Connections and Deployments

json
{
"CrestApps": {
"AI": {
"Connections": [
{
"Name": "openai",
"ClientName": "OpenAI",
"ApiKey": "sk-..."
}
],
"Deployments": [
{
"ClientName": "OpenAI",
"Name": "gpt-5-chat",
"ModelName": "gpt-5",
"ConnectionName": "openai",
"Features": [ "textGeneration", "toolCalling", "streaming", "reasoning" ],
"Parameters": {
"reasoningEffort": { "AllowedValues": [ "Low", "Medium", "High" ], "DefaultValue": "Medium" }
}
},
{
"ClientName": "OpenAI",
"Name": "embeddings",
"ModelName": "text-embedding-3-large",
"ConnectionName": "openai",
"Features": [ "textEmbedding" ]
}
]
}
}
}
  • Features and Parameters on the entry are shorthand for Properties:AIDeploymentMetadata:Features and ...:Parameters. Both forms work and merge.
  • Configured deployments are read-only in admin UIs; stored deployments come from the YesSql or EntityCore stores and are merged with configuration through IAIDeploymentStore.
  • A connection name that differs from another only by case is a duplicate. The first definition wins and the second is logged as a warning.

Resolving a Deployment

Slot (AIDeploymentSlotNames)Required featureSite default (DefaultAIDeploymentSettings)
ChattextGeneration (excludes realtime)DefaultChatDeploymentName
UtilitytextGeneration (excludes realtime), falls back to ChatDefaultUtilityDeploymentName
EmbeddingtextEmbeddingDefaultEmbeddingDeploymentName
ImageimageOutputDefaultImageDeploymentName
VisionimageInputDefaultVisionDeploymentName
SpeechToTextspeechToTextDefaultSpeechToTextDeploymentName
TextToSpeechtextToSpeechDefaultTextToSpeechDeploymentName
RealtimerealtimeDefaultRealtimeDeploymentName

Resolution walks one chain: the explicit name, the slot's site default, the fallback slot's explicit name and default, then the first capable deployment.

csharp
using CrestApps.Core.AI.Deployments;
using CrestApps.Core.AI.Models;
// Named deployment if it qualifies, otherwise the site default, otherwise the first capable one.
var chat = await deploymentManager.ResolveSlotAsync(AIDeploymentSlotNames.Chat, deploymentName: "gpt-5-chat");
// Background work: explicit utility, site utility, explicit chat, site chat, then first text-capable.
var utility = await deploymentManager.ResolveUtilityOrDefaultAsync(
utilityDeploymentName: profile.UtilityDeploymentName,
chatDeploymentName: profile.ChatDeploymentName);
// Throws InvalidOperationException when nothing can fill the slot.
var embedding = await deploymentManager.ResolveSlotOrThrowAsync(AIDeploymentSlotNames.Embedding);
// Everything eligible for a picker.
var candidates = await deploymentManager.GetAllBySlotAsync(AIDeploymentSlotNames.Chat);

DefaultAIDeploymentSettings is a plain options class. The framework does not bind it from configuration; configure it from your own section or site settings:

csharp
builder.Services.Configure<DefaultAIDeploymentSettings>(settings =>
{
settings.DefaultChatDeploymentName = "gpt-5-chat";
settings.DefaultUtilityDeploymentName = "gpt-5-mini";
settings.DefaultEmbeddingDeploymentName = "embeddings";
});

Key Runtime Services

ServiceUse
IAIClientFactoryCreate IChatClient, IEmbeddingGenerator, IImageGenerator, ISpeechToTextClient, ITextToSpeechClient and IRealtimeClient for a deployment. Every overload except realtime accepts an Action<...Builder> pipeline callback, and the factory owns the final Build(serviceProvider)
IAICompletionServiceCompleteAsync / CompleteStreamingAsync(deployment, messages, context, cancellationToken) without the orchestration loop
IAICompletionContextBuilderBuildAsync(resource, configure, cancellationToken) runs the context handlers for a profile, interaction or other resource
IAIDeploymentManagerSlot resolution and deployment CRUD
IAIDeploymentCapabilityServiceWhat a deployment's model declares
IAIProviderConnectionStore / IAIDeploymentStoreMerged configuration and store views

Every client the factory creates is metered, and every chat client is wrapped in CapabilityEnforcingChatClient, which strips tools, JSON response formats and reasoning options the deployment does not declare. Chat clients stream tool calls and results (FunctionCallContent, FunctionResultContent) through FunctionInvokingChatClient, which the AG-UI chat shows as tool cards; NamedAICompletionClient passes stored tool result messages to the provider and drops results whose calls a past-messages limit cut off. CreateRealtimeClientAsync returns a metering wrapper; use GetService to reach the provider client.

Telemetry Options

The framework registers a scoped DefaultAIOptions that applies the site's GeneralAIOptions overrides. Two of its options control the Microsoft.Extensions.AI gen_ai.* telemetry; the framework's own CrestApps.Core spans and metrics do not depend on them.

  • EnableOpenTelemetry (off by default) adds gen_ai.* spans and metrics, under the AICompletionService source, to the OpenAI, Azure AI Inference and Ollama completion clients, the Azure OpenAI Responses path, the Claude orchestrator, and the embedding, image, speech and realtime clients from IAIClientFactory. The Azure OpenAI chat-completions path uses the OpenAI SDK's OpenAI.Experimental.EnableOpenTelemetry switch instead.
  • EnableSensitiveData (off by default) adds prompts, responses and tool arguments to those spans. It applies only while EnableOpenTelemetry is on.

A site value applies only with its flag: GeneralAIOptions.OverrideEnableOpenTelemetry or OverrideEnableSensitiveData. See crestapps-core-observability.

Example Completion Service

csharp
using CrestApps.Core.AI.Completions;
using CrestApps.Core.AI.Deployments;
using CrestApps.Core.AI.Models;
using Microsoft.Extensions.AI;
public sealed class QuestionService
{
private readonly IAICompletionService _completionService;
private readonly IAIDeploymentManager _deploymentManager;
public QuestionService(
IAICompletionService completionService,
IAIDeploymentManager deploymentManager)
{
_completionService = completionService;
_deploymentManager = deploymentManager;
}
public async Task<string> AskAsync(string question, CancellationToken cancellationToken = default)
{
var deployment = await _deploymentManager.ResolveSlotAsync(
AIDeploymentSlotNames.Chat,
cancellationToken: cancellationToken)
?? throw new InvalidOperationException("No chat deployment is configured.");
var context = new AICompletionContext
{
ChatDeploymentName = deployment.Name,
SystemMessage = "You are a helpful assistant.",
DisableTools = true,
};
var response = await _completionService.CompleteAsync(
deployment,
[new ChatMessage(ChatRole.User, question)],
context,
cancellationToken);
return response.Text;
}
}

To reuse a profile's prompts, tools, persona and model parameters, build the context from the profile instead: await completionContextBuilder.BuildAsync(profile, cancellationToken: cancellationToken).

Direct Clients

csharp
var chatClient = await clientFactory.CreateChatClientAsync(deployment, builder => builder
.UseDefaultResilience()
.UseUsageLabels(contextType: "Leads", purpose: "LeadScoring"));
var embeddingDeployment = await deploymentManager.ResolveSlotOrThrowAsync(AIDeploymentSlotNames.Embedding);
var generator = await clientFactory.CreateEmbeddingGeneratorAsync(embeddingDeployment);

When you finish a builder yourself, call Build(serviceProvider), never Build().

Custom Providers

A provider that creates Microsoft.Extensions.AI clients implements IAIClientProvider (CanHandle(clientName) plus GetChatClientAsync, GetEmbeddingGeneratorAsync, GetRealtimeClientAsync and the other client getters for a connection), so IAIClientFactory, capability enforcement and metering apply to it with no extra code. A provider that owns the whole completion loop implements IAICompletionClient (ClientName, CompleteAsync, CompleteStreamingAsync) and registers it with AddCoreAICompletionClient<TClient>(clientName, configure). Deriving from AICompletionServiceBase gives ResolveDeploymentAsync(slotName, providerName, deploymentName) and ResolveRequestDeploymentAsync(context, providerName), which honors AICompletionContext.IsUtilityCompletion.

Troubleshooting

  • `ResolveSlotAsync` returns `null`: no deployment declares the slot's required feature, or the only candidate declares the excluded realtime feature for Chat or Utility.
  • A configured deployment is missing: the entry declares no Features, its ClientName is unknown, or one of its values could not be read (each bad entry is now skipped on its own with an error naming it).
  • Tools are never called: the deployment declares metadata without toolCalling, so capability enforcement removes them and logs a warning.

Upgrading Within 2.0 Previews

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/crestapps/crestapps.agentskills/crestapps-core-ai-runtime/badge)](https://verified-skill.com/skills/crestapps/crestapps.agentskills/crestapps-core-ai-runtime)

Something wrong with this skill or its page? Tell us.