GovUK.Dfe.AI.Agents.AISearch 0.0.4

Prefix Reserved
dotnet add package GovUK.Dfe.AI.Agents.AISearch --version 0.0.4
                    
NuGet\Install-Package GovUK.Dfe.AI.Agents.AISearch -Version 0.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GovUK.Dfe.AI.Agents.AISearch" Version="0.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GovUK.Dfe.AI.Agents.AISearch" Version="0.0.4" />
                    
Directory.Packages.props
<PackageReference Include="GovUK.Dfe.AI.Agents.AISearch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GovUK.Dfe.AI.Agents.AISearch --version 0.0.4
                    
#r "nuget: GovUK.Dfe.AI.Agents.AISearch, 0.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GovUK.Dfe.AI.Agents.AISearch@0.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GovUK.Dfe.AI.Agents.AISearch&version=0.0.4
                    
Install as a Cake Addin
#tool nuget:?package=GovUK.Dfe.AI.Agents.AISearch&version=0.0.4
                    
Install as a Cake Tool

GovUK.Dfe.AI.Agents.AISearch

Gives your GovUK.Dfe.AI.Agents agents evidence from Azure AI Search. Results are numbered, and each citation in an answer becomes a link to its result, or the result's text.

Set up

dotnet add package GovUK.Dfe.AI.Agents.AISearch
"AiAgents": {
  "AISearch": {
    "Endpoint": "https://<search>.search.windows.net",
    "Indexes": [ { "Name": "ofsted_index", "ContentFields": [ "title", "content", "url" ] } ]
  }
}
builder.Services.AddAgents(builder.Configuration, agents => agents
    .AddAgents(BriefingAgents.All)
    .AddAISearch());

You need an Azure AI Search service, and Search Index Data Reader on it for the app's identity. For a separate identity, add AISearch:Authentication or call agents.UseAISearchCredential(credential).

Search without agents

An app that only needs search results, e.g. a search page, needs no Foundry settings and no agents:

builder.Services.AddAISearch(builder.Configuration, new ManagedIdentityCredential());

It reads the same section, with the credential you pass or AISearch:Authentication. Adding agents later with agents.AddAISearch() still registers search once.

Use

Inject IContextRetriever, search, and pass the result as evidence:

var evidence = await search.GetContextAsync("ofsted_index", $"Ofsted inspection {urn}", size: 10,
    filter: $"urn eq {urn}", cancellationToken: ct);

var result = await agents.RunAsync(BriefingAgents.Ofsted, "Summarise the latest inspection.", evidence, ct);

Pass the result itself, not evidence.Text, so its citation sources come with it.

  • Filter every search to the record you mean, e.g. one school; relevance alone also returns similar names.
  • Filters are escaped for you: each {value} in $"urn eq {urn}" is escaped, so it can't change the filter. A plain string won't compile; use ODataFilter.Raw(filter) for one that's already escaped.
  • Set ContentFields on each index, so only those fields (of any type) reach the model, each labelled one per line, e.g. number_on_roll: 398.
  • Weak matches are dropped: results below half the top score (MinimumRelevanceFilter).
  • Large results: whole results are kept, most relevant first, up to MaxEvidenceCharacters; the rest are left out with a note, so citations still match.

Citations

Agents cite results as [Evidence n]. Each one reaches your app as something a reader can use, with no settings:

The result has Rated Good [Evidence 1]. becomes
A field holding a full web address Rated Good [<a href="https://reports.ofsted.gov.uk/...">Copthorne School – Key Stage 2…</a>].
No web address Rated Good [Copthorne School – Key Stage 2…].
  • Text: the start of the result, on one line, about 80 characters, in square brackets.
  • Link: the first field whose whole value is an https or http address. It isn't sent to the model, so the model can't write links. With ContentFields set, include that field (e.g. url).
  • Render answers as HTML (or Markdown that allows it): citation links are the only real HTML.
  • RequiredCitations = false: citations aren't asked for, and any written are removed.
  • Works for RunAsync, RunStreamingAsync and RunParallelAsync (return the search result from resolveEvidence). Evidence joined from several searches keeps [Evidence n].

Keyword search misses different wording, e.g. "safeguarding concerns" and "child protection issues". Set either or both on an index:

"Indexes": [ {
  "Name": "ofsted_index",
  "ContentFields": [ "title", "content" ],
  "SemanticConfiguration": "default",
  "VectorFields": [ "contentVector" ]
} ]
Setting Search type The index needs
Neither Keyword Nothing extra
SemanticConfiguration Keyword, re-ranked by meaning A semantic configuration, and the semantic ranker enabled (Basic tier or higher)
VectorFields Hybrid: keyword plus vector A vectorizer, so the service embeds the query (your app needs no embedding model)
Both Hybrid, re-ranked by meaning (best results) Both of the above

Your filter is applied before the vector search, so hybrid results still match only that record.

Settings

All under AiAgents:AISearch.

Setting Default Purpose
Endpoint Required The search service, e.g. https://<search>.search.windows.net
Indexes Required Each index's Name (the scope you search), plus the settings below
Indexes:n:ContentFields Every string field The fields sent to the model, in order
Indexes:n:SemanticConfiguration None Re-rank by meaning (Basic tier or higher)
Indexes:n:VectorFields None Hybrid keyword and vector search
Indexes:n:LabelFields true Labels each value with its field, one per line; false sends the values alone
MinimumRelevanceFilter 0.5 Drops results below this share of the top score
MaxEvidenceCharacters 190,000 Evidence per search, whole results only; just under core's 200,000
MaxRetryAttempts 3 Retries of a failed search
Authentication The default identity A separate identity for search
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 231 11/4/2026
0.0.4-prerelease.2 59 11/4/2026
0.0.3 64 11/4/2026
0.0.3-prerelease.98 79 11/4/2026
0.0.3-prerelease.81 59 11/4/2026
0.0.3-prerelease.65 66 11/4/2026
0.0.3-prerelease.50 60 11/3/2026
0.0.3-prerelease.36 57 11/3/2026
0.0.3-prerelease.23 59 11/3/2026
0.0.3-prerelease.11 63 11/3/2026
0.0.2 115 10/30/2026
0.0.2-prerelease.2 65 10/30/2026
0.0.1 64 10/30/2026
0.0.1-prerelease.6037 67 10/30/2026
0.0.1-prerelease.5922 62 10/30/2026
0.0.1-prerelease.5808 63 10/30/2026
0.0.1-prerelease.5695 68 10/30/2026
0.0.1-prerelease.5583 72 10/30/2026
0.0.1-prerelease.5472 62 10/30/2026
0.0.1-prerelease.5362 61 10/30/2026
Loading failed