Files
westey 626b418622 .NET: Harness Feature branch (#5310)
* .NET: Add a TODO AIContextProvider (#5233)

* Add a TODO AIContextProvider

* Add unit tests

* Address PR comments

* Address PR comments

* Fix test after removing one tool

* .NET: Add a ModeProvider for managing agent modes (#5247)

* Add a ModeProvider for managing agent modes

* Fix typo

* Fix typo

* Fix typo

* Address PR comments

* .NET: Add sample to show how to build a harness (#5268)

* Add sample to show how to build a harness

* Improve sample

* Sample max output tokens and model

* Fix encoding

* Fix model name in readme

* Address PR comments

* .NET: Add context window size compaction strategy for harness (#5304)

* Add context window size compaction strategy for harness

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address PR comments

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* .NET: Add a file memory provider (#5315)

* Add a file memory provider

* Address PR comments

* Fix review comments.

* Add additional unit tests

* Addressing PR comments.

* .NET:  Harness: Improve prompts and add FileSystem store (#5365)

* Harness: Improve prompts and add FileSystem store

* Address PR comments

* .NET: Harness: Improve path validation (#5404)

* Harness: Improve path validation

* Address PR comments

* .NET: Add always approve helpers, improve sample and fix bug (#5451)

* Add always approve helpers, improve sample and fix bug

* Address PR comments

* .NET: Make Todo, Mode and FileMemory providers more configurable (#5477)

* Make Todo, Mode and FileMemory providers more configurable

* Address PR comments.

* .NET: Add subagents provider and sample (#5518)

* Add subagents provider and sample

* Addressing PR comments.

* .NET: Harness filememory index plus instructions consistency (#5540)

* Add FileMemoryProvider index and improve instruction consistency

* Address PR comments.

* Address PR comments

* Address PR comments.

* Apply suggestion from @rogerbarreto

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>

---------

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>

* .NET: Refactor harness console to be more extensible and easy to understand with better UX (#5573)

* Refactor harness console to be more extensible and easy to understand with better UX.

* Fix formatting issues.

* Allow multiple clarifications in one response

* Address PR comments

* .NET: Add FileAccessProvdider and concurrency fix for FileMemoryProvider (#5583)

* Add FileAccessProvdider and concurrency fix for FileMemoryProvider

* Address PR comments

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
626b418622 · 2026-05-01 10:52:38 +00:00
History
..
2026-05-01 10:52:38 +00:00

Harness Step 02 — SubAgents (Stock Price Research)

This sample demonstrates how to use the SubAgentsProvider to delegate work from a parent agent to sub-agents.

What It Does

A parent agent receives a list of stock tickers and uses a web-search sub-agent to find the closing price for each ticker on December 31, 2025. The sub-tasks run concurrently, and results are presented in a summary table.

Architecture

┌─────────────────────────────────┐
│     StockPriceResearcher        │
│         (Parent Agent)          │
│                                 │
│  SubAgentsProvider              │
│    ├─ SubAgents_StartTask       │
│    ├─ SubAgents_WaitFor...      │
│    ├─ SubAgents_GetTaskResults  │
│    └─ ...                       │
└────────────┬────────────────────┘
             │  delegates to
             ▼
┌─────────────────────────────────┐
│       WebSearchAgent            │
│        (Sub-Agent)              │
│                                 │
│  Tools:                         │
│    └─ web_search (Foundry)      │
└─────────────────────────────────┘

Prerequisites

  • An Azure AI Foundry endpoint with an OpenAI model deployment
  • Set the following environment variables:
    • AZURE_FOUNDRY_OPENAI_ENDPOINT — Your Foundry OpenAI endpoint URL
    • AZURE_AI_MODEL_DEPLOYMENT_NAME — Model deployment name (defaults to gpt-5.4)

Running the Sample

cd dotnet/samples/02-agents/Harness/Harness_Step02_Research_WithSubAgents
dotnet run

When prompted, enter a list of stock tickers such as:

BAC, MSFT, BA

The parent agent will delegate each ticker lookup to the web search sub-agent concurrently and present the results in a table.