MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1
Demo280 — Validated Planning
JSON extraction, host schema and at most one retry precede deserialization. After two failures, the loop continues without simulated execution of that plan. No creation effect, even for a valid plan.
Objectives
- Reject invalid plans before executing host operations.
Prepare the program
Live chat through common configuration, granite4:3b by default; no embeddings required. An optional API is selected explicitly with no automatic fallback. Start at the root of the complete distribution. Preserve shared projects and configuration files. Some historical prompts and labels in Demo260–290 remain French in public code; commands and identifiers match this revision.
dotnet build BaseTechnique.slnx -m:1 -c Release| Project | Role |
|---|---|
| demos/Demo280_ValidatedPlanning/Demo280.App.csproj | App |
| shared/Maf.DemoConnection/Maf.DemoConnection.csproj | Shared implementation |
Commands from the root
dotnet run --project demos/Demo280_ValidatedPlanning/Demo280.App.csproj -c Release --no-buildProcedures and variants
Compare Demo270’s two requests, then follow the chapter’s invalid-plan injection in a separate copy.
// 3) Validation JSON Schema (+ retry unique si invalide)
if (!ValidatePlanJson(jsonText, out var err))
{
Console.WriteLine("⚠️ Plan JSON invalide. Retry unique...");
Console.WriteLine(err);
var repairPrompt = $"""
Tu as renvoyé un JSON invalide ou non conforme.
Corrige-le et renvoie UNIQUEMENT un JSON valide, sans texte autour, conforme à ce schéma :
{PlanJsonSchema}
Demande utilisateur :
{input}
""";
var rawResp2 = await planner.RunAsync(message: repairPrompt, session: session);
var rawText2 = GetResponseText(rawResp2);
jsonText = ExtractJsonObject(rawText2);
if (!ValidatePlanJson(jsonText, out err))
{
Console.WriteLine("⛔ JSON toujours invalide après retry. Arrêt.");
Console.WriteLine(err);
Console.WriteLine();
continue;
}
}
// 4) Désérialisation une fois validé
What must be observable
JSON extraction, host schema and at most one retry precede deserialization. After two failures, the loop continues without simulated execution of that plan. No creation effect, even for a valid plan.
These results are expected from the linked code. Checks actually rerun for this lot are distinguished in exercises and reception; no unmeasured live output is presented as observed.
Limits and retained state
Demo230–250 build a fresh graph per input and write no business effect. Demo260 retains its two sessions only in-process. Demo270–290 interpret a plan through simulated printing without a workflow engine. Live calls depend on the profile; scripted tests qualify no model.
