e-naxosMAF COURSE / COURS
Français

MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1

Demo390 — Prompt Profiles

A valid profile changes instructions for the fixed request without changing the model client. An unknown name fails before generation with Unknown instruction profile. Profiles load from a local JSON array without menu, hot reload, persisted session or automatic style testing.

Objectives

Prepare the demo

Start at the root of the complete distribution built in Release; retain shared projects and files copied beside executables. Live chat required for a valid run, granite4:3b by default; optional API only by explicit selection. No embeddings or container. Instruction-profile rejection needs no model response.

dotnet build BaseTechnique.slnx -m:1 -c Release
Required projects
ProjectRole
demos/Demo390_PromptProfiles/Demo390.App.csprojApp
shared/Maf.Memory/Maf.Memory.csprojShared implementation

Run from the root

$env:MAF_INSTRUCTION_PROFILE = "support-cautious"
dotnet run --project demos/Demo390_PromptProfiles/Demo390.App.csproj -c Release --no-build
$env:MAF_INSTRUCTION_PROFILE = "support-brief"
dotnet run --project demos/Demo390_PromptProfiles/Demo390.App.csproj -c Release --no-build
Remove-Item Env:MAF_INSTRUCTION_PROFILE -ErrorAction SilentlyContinue

Procedures and variants

Compare MAF_INSTRUCTION_PROFILE=support-cautious then support-brief with the same connection. Record Id/Version and provider. Test unknown-profile then restore the variable.

var profiles = JsonSerializer.Deserialize<InstructionProfile[]>(
    await File.ReadAllTextAsync(Path.Combine(AppContext.BaseDirectory, "appsettings.json")),
    JsonSerializerOptions.Web) ?? throw new InvalidDataException("Missing instruction profiles.");
if (profiles.Length == 0 || profiles.Any(p => string.IsNullOrWhiteSpace(p.Id)
    || string.IsNullOrWhiteSpace(p.Version) || string.IsNullOrWhiteSpace(p.Instructions))
    || profiles.Select(p => p.Id).Distinct(StringComparer.Ordinal).Count() != profiles.Length)
    throw new InvalidDataException("Instruction profiles must have unique IDs, versions, and instructions.");
string selected = global::Maf.DemoConnection.DemoConfiguration.GetSetting("MAF_INSTRUCTION_PROFILE") ?? "support-cautious";
var profile = profiles.SingleOrDefault(p => p.Id == selected)
    ?? throw new InvalidDataException("Unknown instruction profile.");
Console.WriteLine($"Instructions: {profile.Id}/{profile.Version}. Effective connection provider: {settings.ChatProvider}.");
Console.WriteLine("The instruction profile does not select a model; AI settings select the connection.");

demos/Demo390_PromptProfiles/Program.cs · L8–L19 · 9a895c94534c

Source code · Demo390 · Folder

Results, refusal and evidence

A valid profile changes instructions for the fixed request without changing the model client. An unknown name fails before generation with Unknown instruction profile. Profiles load from a local JSON array without menu, hot reload, persisted session or automatic style testing.

Control limits

An instruction version guarantees neither style, quality nor permission. The program has no state migration and does not persist the session. Usage tokens depend on transport reporting; no financial budget.

Connect contracts and prerequisites

Prerequisites

Continue reading

Complete demo folder · README

lot010-controls-1 · 2026-10-24 · 9a895c94534cd5fc6f3da883e37e5f7856e588c1