Skip to content

FoundryHarnessFeature

NexusLabs.Foundry.MicrosoftAgentFramework.Harness.Bundle

FoundryHarnessFeature Enum

Identifies a distinct default-controlling dimension of the upstream Microsoft.Agents.AI.Harness complete-bundle pipeline (MAF 1.17).

public enum FoundryHarnessFeature

Fields

FunctionInvocation 0

The innermost Microsoft.Extensions.AI.FunctionInvokingChatClient tool-invocation loop. Always present; only its iteration limit is configurable.

MessageInjection 1

The Microsoft.Agents.AI.MessageInjectingChatClient decorator that allows external code to inject messages into the conversation mid-stream. Always present.

HistoryPersistence 2

The Microsoft.Agents.AI.PerServiceCallChatHistoryPersistingChatClient decorator that persists chat history after every individual service call. Always present; only the backing ChatHistoryProvider store is configurable.

HarnessInstructions 3

The harness-level instructions (HarnessAgentOptions.HarnessInstructions) that guide general tool usage and reasoning patterns, combined with (and preceding) agent-specific instructions. null uses the upstream built-in default instructions, System.String.Empty omits harness-level instructions entirely, and any other value is used verbatim.

WebSearch 4

The hosted Microsoft.Extensions.AI.HostedWebSearchTool added to chat options.

FileMemory 5

The Microsoft.Agents.AI.FileMemoryProvider context provider for persisted session notes and artifacts.

FileAccess 6

The Microsoft.Agents.AI.FileAccessProvider context provider for shared working-directory read/write tools. Opt-in: disabled unless a store is supplied.

AgentSkills 7

The Microsoft.Agents.AI.AgentSkillsProvider context provider for file-based skill discovery.

ToolAutoApproval 8

The Microsoft.Agents.AI.ToolApprovalAgent "don't ask again" auto-approval middleware.

ApprovalNotRequiredFunctionBypassing 9

The decorator that bypasses approval surfacing for tools that do not require approval.

ApprovalResponseBinding 10

The decorator that binds inbound tool-approval responses to model-originated approval requests.

OpenTelemetry 11

The Microsoft.Agents.AI.OpenTelemetryAgent wrapper providing OpenTelemetry instrumentation for Generative AI semantic conventions.

TodoProvider 12

The Microsoft.Agents.AI.TodoProvider context provider for multi-step plan tracking.

AgentModeProvider 13

The Microsoft.Agents.AI.AgentModeProvider context provider for plan/execute mode tracking.

Compaction 14

Upstream's context-window compaction, which bounds the conversation an agent carries \<em>between\</em> turns. Opt-in: disabled unless both a context-window token budget and an output token budget (or a custom strategy) are supplied.

Remarks

Mechanism. Upstream installs a CompactionProvider, which is an AIContextProvider. Context providers are invoked once per agent turn — once per RunAsync — above the tool-invocation loop, and they operate on the persisted chat-history index rather than on the messages of any individual provider request. A reduction they perform changes what the agent subsequently remembers. Budgets are denominated in provider tokens.

Consequence. A single turn that makes several model calls — one per tool round — is compacted only against the state that preceded the first round. Measured over a deterministic two-round tool loop with a strategy whose trigger always fires, the strategy is consulted once, against a two-message index; the round carrying the tool call and its result is never offered to it. Identical on Microsoft.Agents.AI.Harness 1.15.0, 1.16.0, and 1.17.0, because this follows from the AIContextProvider contract rather than from a defect. Tracked in ncosentino/foundry#73.

If context growth comes from tool results inside one turn, this dimension will not bound it; see HybridCompaction. The two are independent and may be combined.

HybridCompaction 15

Foundry's per-provider-call hybrid compaction, which bounds what is \<em>sent\</em> on each individual provider request rather than what the agent remembers. Opt-in: disabled unless FoundryHarnessAgentConfiguration.HybridCompactionOptions is supplied.

Remarks

Mechanism. Foundry wraps the caller's chat client at the innermost position, beneath every decorator the bundle installs above it. Both the function-invocation loop and message injection recurse by calling their inner client afresh, so every intermediate tool round and every injected extra call cascades down to this node. It therefore observes the exact message set dispatched for each provider request, including the round carrying a tool call and its result — precisely the round Compaction never sees. Budgets are denominated in UTF-8 bytes of rendered content, not provider tokens, because bytes are computable locally without a tokenizer matched to the provider.

Stored history is not shrunk. This node sits inner to the per-service-call history decorator, so history is persisted before a reduction is applied and every call re-assembles from the full record. A reduction bounds one dispatch; it never permanently discards conversation. The trade-off is that the work is not cumulative — reduction cost is paid on every call and the stored record still grows — which is a reason to enable Compaction alongside this rather than instead of it.

Failure mode. The supplied reducer's output is treated as a proposal and verified against the hard limit and Foundry's structural-preservation rules. A context that cannot be reduced below the hard limit fails the request rather than being forwarded over budget.

This is Foundry-owned rather than upstream, so it is not covered by upstream's compatibility guarantees and its position depends on the verified bundle middleware order.

AdditionalContextProviders 16

Additional Microsoft.Agents.AI.AIContextProvider instances (mapped to HarnessAgentOptions.AIContextProviders) included in the agent pipeline alongside the built-in providers. Opt-in: disabled unless at least one instance is supplied.

BackgroundAgents 17

The Microsoft.Agents.AI.BackgroundAgentsProvider context provider for delegating to caller-supplied, uniquely named agents through independent child sessions and concurrent background tasks.

LoopEvaluation 18

The outermost Microsoft.Agents.AI.LoopAgent decorator that re-invokes the complete Harness agent until caller-supplied evaluators are satisfied or the iteration limit is reached.

Remarks

Every value here corresponds to a specific pipeline decorator, context provider, or tool documented on Microsoft.Agents.AI.HarnessAgentOptions. See FoundryHarnessEffectiveDefaults for the requested-versus-effective disposition of each dimension for a given FoundryHarnessAgentConfiguration.