e-naxosMAF COURSE / COURS
Français

MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1

Demo010 — Code or agent

Run the deterministic path, then understand the --agent option.

Objectives

Before running

From the BaseTechnique root, use the .NET 10.0.402 SDK pinned by global.json and restore NuGet dependencies. Basic C# is enough for the default path; async/await and a working connection profile are needed for --agent. No model service is required for the deterministic path.

Required projects and resources
ItemRoleDistribution
demos/Demo010_CodeOrAgent/Demo010.App.csprojnet10.0 console applicationProgram.cs entry point
shared/Maf.Backlog/Maf.Backlog.csprojDeclared project referenceKeep the shared dependency graph, including DemoConnection
shared/Configuration/ai-settings.jsonProfile copied to outputUsed only after --agent
global.json and Directory.Packages.propsSDK and centralized versionsKeep at the distribution root

The links below target the immutable public revision. Keep shared projects and configuration from the full distribution; the Demo010 folder alone is insufficient.

Model-free path

dotnet build BaseTechnique.slnx -m:1 -c Release
dotnet run --project demos/Demo010_CodeOrAgent/Demo010.App.csproj -c Release --no-build

Expected from reading the code: a discount calculation equal to 90, then a routing message containing Component: Auth and stating that it is not a MAF graph. The decimal separator depends on console culture. Execution ends before loading the profile. These expected observations are not a new runtime test.

Console.WriteLine("Deterministic C#: a fixed discount rule returns " + (100m * 0.9m));
var request = "Login fails for a known account";
var component = request.Contains("Login", StringComparison.OrdinalIgnoreCase) ? "Auth" : "Other";
Console.WriteLine($"Explicit C# orchestration: classify -> route -> display. Component: {component}. This is not a MAF workflow graph.");
if (!args.Contains("--agent")) return;

demos/Demo010_CodeOrAgent/Program.cs · L15–L19 · 9a895c94534c

Source code · Demo010 · Folder

Observed output · 2026-10-24 · lot005-demo010
Deterministic C#: a fixed discount rule returns 90,0
Explicit C# orchestration: classify -> route -> display. Component: Auth. This is not a MAF workflow graph.

Optional variant and limits

dotnet run --project demos/Demo010_CodeOrAgent/Demo010.App.csproj -c Release --no-build -- --agent

The shared profile supplies provider and model; no automatic cloud fallback is assumed. The branch displays the provider and requests two English questions about an ambiguous failure. Exact wording varies. The global deadline is two minutes and Ctrl+C requests cancellation. Configuration errors or an unavailable provider remain visible failures.

The --agent branch loads this shared component before creating the client. It combines the configuration file, environment variables and explicit options. The same code is distributed to every demo referencing it.

public static ConnectionOptions Load(string[] args) => ConnectionOptions.FromConfiguration(
    new ConfigurationBuilder().AddDemoConfiguration(args).Build());

shared/Maf.Backlog/DemoSettings.cs · L10–L11 · 9a895c94534c

Source code · Maf.Backlog · Folder

Understand and continue

Continue reading

Complete demo folder · README

lot007-foundations-1 · 2026-10-24 · 9a895c94534cd5fc6f3da883e37e5f7856e588c1