MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1
Demo190 — Retrieved Evidence
Tool mode first performs host retrieval then requires an actual retrieve_knowledge call.
Objectives
- Retrieve eligible vector matches and validate cited evidence.
Prepare the demo
Start at the root of the complete distribution built in Release. Shared projects Maf.Rag and Maf.DemoConnection are required. SQLite storage is local. rebuild/probe/compare need real embeddings; answer additionally needs chat if evidence remains eligible. audit alone requires no model. The delivered profile separates embeddinggemma:300m from granite4:3b.
| Project | Role |
|---|---|
| demos/Demo190_RetrievedEvidence/Demo190.App.csproj | App |
| shared/Maf.Rag/Maf.Rag.csproj | Shared implementation |
| shared/Maf.DemoConnection/Maf.DemoConnection.csproj | Connection |
Launch from the root
Create the root only once for the RAG series; if Demo180 already ingested the corpus, retain its existing value and do not repeat the assignment below. Without a compatible index, rebuild is explicitly required.
$env:MAF_STATE_ROOT = Join-Path $env:TEMP ('maf-rag-' + [guid]::NewGuid().ToString('N'))dotnet run --project demos/Demo190_RetrievedEvidence/Demo190.App.csproj -c Release --no-build -- --Rag:AsOf 2026-10-23Modes and procedure
After rebuild, ask Where can I export CSV in Reporting? then How do I bake an apple pie? Compare hits, hostCalls, accepted quotations and refusal.
public static ControlledAnswer Validate(AnswerProposal? proposal, Retrieval retrieval)
{
if (retrieval.Hits.Length == 0 || proposal is not { CanAnswer: true, Evidence.Length: > 0 and <= 3 })
return ControlledAnswer.Refuse("no supported answer.");
var sources = retrieval.Hits.ToDictionary(h => h.Chunk.Id, StringComparer.Ordinal);
foreach (var evidence in proposal.Evidence)
{
if (evidence is null || string.IsNullOrWhiteSpace(evidence.SourceId)
|| !sources.TryGetValue(evidence.SourceId, out var source)
|| !CorpusPolicy.Eligible(source.Chunk.Source, retrieval.AsOf, source.Chunk.Source.Scope)
|| string.IsNullOrWhiteSpace(evidence.Quote) || evidence.Quote.Trim().Length < 20
|| !source.Chunk.Text.Contains(evidence.Quote, StringComparison.Ordinal))
return ControlledAnswer.Refuse("invalid citation or quotation.");
}
return new(true, string.Join("\n", proposal.Evidence.Select(e => $"[{e.SourceId}] {e.Quote}")), proposal.Evidence);
Results and useful failures
Tool mode first performs host retrieval then requires an actual retrieve_knowledge call. A second agent proposes AnswerProposal. No observed tool call, a bad contract or a fabricated quotation prevents acceptance.
These observations are expected from inspecting the linked public code revision. The site lot separately reruns deterministic tests: it does not present an unmeasured generated answer or provider score as observed output.
Persistence and limits
The index is shared under the selected root; startup does not reset it. rebuild deliberately replaces RAG tables and an incompatible embedding model, dimension, corpus or chunker fails explicitly. Changing chat alone does not change vectors. No universal erasure, general model qualification or production guarantee.
dotnet test tests/Maf.Rag.Tests/Maf.Rag.Tests.csproj -m:1 -c Release --no-build --no-restore