Crestapps core ai profiles

From CrestApps/CrestApps.AgentSkills · View interactive version

Crestapps core ai profiles is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for designing CrestApps.Core 2.0 AI Profiles, the reusable contract that controls prompts, deployments, tools, agents, retrieval, memory, persona, chat mode and session behavior. Covers AIProfile types, deployment selection through slots, AIProfileMetadata, FunctionInvocationMetadata, AgentInv

How to use this skill

Skill file

CrestApps.Core AI Profiles

A deployment answers "which model runs". An AI Profile answers "how should this experience behave": instructions, deployments, orchestrator, tools, agents, knowledge, memory, persona, chat mode and post-session rules. AI Chat sessions, agents and orchestrators all read the profile.

Guidelines

Building Blocks

| Concept | Question it answers |

|---|---|

| Connection | How do I talk to a provider |

| Deployment | Which model runs and what can it do |

| Chat Interaction | Let me test this setup quickly |

| AI Profile | How should this experience behave |

| Persona | Who is the assistant |

Profile Types

AIProfile.Type is AIProfileType.Chat, Utility, TemplatePrompt or Agent. The type changes how the framework uses the same record; agents are profiles of type Agent with a strong Description.

Creating a Profile in Code

using CrestApps.Core.AI.Models;
using CrestApps.Core.AI.Profiles;

var profile = await profileManager.NewAsync("support-assistant");

profile.Type = AIProfileType.Chat;
profile.DisplayText = "Support Assistant";
profile.ChatDeploymentName = "gpt-5-chat";
profile.UtilityDeploymentName = "gpt-5-mini";
profile.WelcomeMessage = "Hi! How can I help with your order today?";

profile.Put(new AIProfileMetadata
{
    SystemMessage = "You help customers with orders. Never promise refunds.",
    Temperature = 0.2f,
    PastMessagesCount = 10,
});

profile.Put(new FunctionInvocationMetadata { Names = ["lookup-order"] });
profile.Put(new AgentInvocationMetadata { Names = ["translator"] });
profile.Put(new AIPersonaMetadata { PersonaId = "friendly-assistant" });
profile.Put(new MemoryMetadata { EnableUserMemory = true });

profile.Put(new AIDeploymentParametersMetadata
{
    Values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
    {
        [AIDeploymentParameterNames.ReasoningEffort] = "Low",
    },
    UtilityValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
    {
        [AIDeploymentParameterNames.ReasoningEffort] = "None",
    },
});

var validation = await profileManager.ValidateAsync(profile);

if (validation.Succeeded)
{
    await profileManager.CreateAsync(profile);
}

IAIProfileManager is an INamedCatalogManager<AIProfile> plus GetAsync(AIProfileType type). Register a profile store (crestapps-core-yessql-stores or crestapps-core-entitycore-stores).

What Lives on a Profile

| Need | Where |

|---|---|

| Chat model and background model | ChatDeploymentName, UtilityDeploymentName (utility falls back to chat) |

| System prompt and sampling | AIProfileMetadata |

| Reusable prompt fragments | PromptTemplateMetadata.Templates (TemplateId plus Parameters) |

| Tools and agents | FunctionInvocationMetadata.Names, AgentInvocationMetadata.Names, AIToolInstanceMetadata.ToolInstanceNames |

| Model parameters | AIDeploymentParametersMetadata (Values for chat, UtilityValues for utility) |

| Persona | AIPersonaMetadata (or top-level PersonaId in profile JSON) |

| Voice and chat mode | ChatModeProfileSettings via WithSettings(...) |

| Anti-spam throttles | PromptSecurityProfileSettings via WithSettings(...) |

| First response handler | ResponseHandlerProfileSettings.InitialResponseHandlerName |

| Orchestrator | OrchestratorName (empty or unknown uses the default) |

| Speaking styles | AIProfileSpeakingStyleSettings.Styles (needs AddSpeakingStyles()) |

| Refused topics | AIProfileGuardrailSettings (needs AddGuardrails()) |

| Redaction and retention | AIProfileDataPrivacySettings (needs AddConversationPrivacy()) |

| Speaking rate, pronunciation, fallback TTS, recognition, barge-in | AIProfileSpeechSettings |

| Allowed and starting languages | AIProfileLanguageSettings |

| Extracted fields and their types | AIProfileDataExtractionSettings.DataExtractionEntries |

Settings objects use the profile settings helpers:

profile.WithSettings(new ChatModeProfileSettings
{
    ChatMode = ChatMode.Conversation,
    ConversationDeploymentName = "gpt-realtime",
    VoiceName = "marin",
});

profile.WithSettings(new PromptSecurityProfileSettings
{
    MaxMessagesPerWindow = 10,
    RateLimitWindow = TimeSpan.FromMinutes(2),
});

if (profile.TryGetSettings<ChatModeProfileSettings>(out var chatMode)) { /* ... */ }

The chat deployment means only "the text model this profile talks to". ChatMode (TextInput, AudioInput, Conversation) decides whether the conversation is spoken. In Conversation mode the realtime slot is resolved first (ConversationDeploymentName, then DefaultRealtimeDeploymentName, then the first realtime-capable deployment); the speech-to-text plus text-to-speech cascade is used only when no realtime-capable deployment resolves.

Opt-In Profile Features

Four features moved from the Orchard Core modules into the framework. Each is added on the AI suite and configured per profile through settings:

builder.Services.AddCrestAppsCore(crestApps => crestApps
    .AddAISuite(ai => ai
        .AddSpeakingStyles()
        .AddGuardrails()
        .AddConversationPrivacy()
        .AddProfileVersions(versions => versions.AddYesSqlStores())));

| Feature | Settings | What it does |

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

| Speaking styles | AIProfileSpeakingStyleSettings | Appends System Prompt templates of the Speaking style category to the system message (AISpeakingStyleCompletionContextBuilderHandler) |

| Guardrails | AIProfileGuardrailSettings | AIGuardrailService asks the utility deployment whether a customer message or reply falls under a refused Guardrail topic template and answers with PlaceholderReply; IAIGuardrailHandler is told |

| Conversation privacy | AIProfileDataPrivacySettings | AIConversationPrivacyService.ProcessAsync, run by the host on a schedule, redacts (RedactPersonalData) or strips (MetadataOnly) ended conversations and deletes them after RetentionDays; NamesToKeep protects the assistant's and business's names |

| Profile versions | none | Every save becomes an AIProfileVersion in IAIProfileVersionStore; compare with AIProfileVersionComparer, restore with AIProfileVersionRestorer |

The eight default speaking styles and eight guardrail topics are seeded as editable System Prompt templates by IAISystemPromptTemplateSeeder.SeedAsync(); call it once from a migration or setup step (see crestapps-core-ai-templates). Guardrails sit behind prompt security and the output filter in the chat hub (see crestapps-core-prompt-security). Full examples are in profile-features-examples.md.

Speech, Language and Typed Extraction

These settings need no registration and are ignored until set:

profile.AlterSettings<AIProfileLanguageSettings>(settings =>
{
    settings.AllowedLanguages = ["en", "es"];
    settings.StartingLanguage = "en";
});

Code-Defined Profiles

Implement IAIProfileProvider to contribute profiles that are not stored. IAIProfileManager.GetAsync(type) merges them in and a stored profile with the same name wins. During a chat the provider can read AIInvocationScope.Current?.ChatInteraction or ChatSession, because the chat response handler sets them before the context is built.

using CrestApps.Core.AI.Models;
using CrestApps.Core.AI.Profiles;

public sealed class BuiltInProfileProvider : IAIProfileProvider
{
    public ValueTask<IReadOnlyList<AIProfile>> GetProfilesAsync(
        AIProfileType type,
        CancellationToken cancellationToken = default)
    {
        if (type != AIProfileType.Chat)
        {
            return ValueTask.FromResult<IReadOnlyList<AIProfile>>([]);
        }

        var profile = new AIProfile
        {
            Type = AIProfileType.Chat,
            Name = "faq-bot",
            DisplayText = "FAQ Bot",
        };

        profile.Put(new AIProfileMetadata { SystemMessage = "Answer only from the FAQ." });

        return ValueTask.FromResult<IReadOnlyList<AIProfile>>([profile]);
    }
}
builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IAIProfileProvider, BuiltInProfileProvider>());

Profile Templates

Markdown profile templates live in Templates/Profiles under the content root or are embedded under Templates/Profiles. Front matter can set ProfileType, ChatDeploymentName, UtilityDeploymentName, ConversationDeploymentName, ChatMode, VoiceName, OrchestratorName, WelcomeMessage, PromptTemplate, PromptSubject, TitleType, Temperature, TopP, MaxOutputTokens, PastMessagesCount, ToolNames, AgentNames, AgentAvailability, AllowToolInvocation, PersonaId, ModelParameters and UtilityModelParameters; the body is the system message.

---
Title: Deep research
ProfileType: Chat
ChatDeploymentName: gpt-5-chat
PersonaId: friendly-assistant
ModelParameters: reasoningEffort=High
UtilityModelParameters: reasoningEffort=Low
---

You are a meticulous research assistant.

Troubleshooting

Upgrading Within 2.0 Previews

Upgrading from 1.x

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.