mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
626b418622
* .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
What this sample demonstrates
This sample demonstrates how to use a ChatClientAgent with the Harness AIContextProviders (TodoProvider and AgentModeProvider) for interactive research tasks with web search capabilities powered by Azure AI Foundry.
Key features showcased:
- ChatClientAgent — configured directly with Harness providers for planning and task management
- Web Search — the agent can search the web for current information via
ResponseTool.CreateWebSearchTool() - TodoProvider — the agent creates and manages a todo list to track research questions
- AgentModeProvider — the agent switches between "plan" mode (breaking down the topic) and "execute" mode (answering each research question)
- Interactive conversation — you can review the agent's plan, provide feedback, and approve before execution begins
- Streaming output — responses are streamed token-by-token for a natural experience
/todoscommand — view the current todo list at any time without invoking the agent- Mode-based coloring — console output is colored based on the agent's current mode (cyan for plan, green for execute)
Prerequisites
Before running this sample, ensure you have:
- An Azure AI Foundry project with a deployed model (e.g.,
gpt-5.4) - Azure CLI installed and authenticated (
az login)
Environment Variables
Set the following environment variables:
# Required: Your Azure AI Foundry OpenAI endpoint
export AZURE_FOUNDRY_OPENAI_ENDPOINT="https://your-project.services.ai.azure.com/openai/v1/"
# Optional: Model deployment name (defaults to gpt-5.4)
export AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-5.4"
Running the Sample
cd dotnet
dotnet run --project samples/02-agents/Harness/Harness_Step01_Research
What to Expect
The sample starts an interactive conversation loop. You can:
- Enter a research topic — the agent will analyze it and create a plan with todos
- Review and adjust — provide feedback on the plan, ask for changes, or approve it
- Type
/todos— to see the current todo list at any time - Watch execution — once approved, tell the agent to proceed and it will work through each todo
- Type
exit— to end the session
The prompt and agent output are colored by the current mode: cyan during planning, green during execution.