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
- Select explicit prompt profiles without bypassing business contracts.
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| Project | Role |
|---|---|
| demos/Demo390_PromptProfiles/Demo390.App.csproj | App |
| shared/Maf.Memory/Maf.Memory.csproj | Shared 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-buildRemove-Item Env:MAF_INSTRUCTION_PROFILE -ErrorAction SilentlyContinueProcedures 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.");
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.
