Files
Roger Barreto 628bb1af48 .NET: Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry and consolidate FoundryMemory (#5042)
* Update Foundry Responses as ChatClientAgent

* Migrate obsolete AzureAI integration tests to versioned agent pattern

Replace obsolete CreateAIAgentAsync/GetAIAgentAsync calls with
Agents.CreateAgentVersionAsync() + AsAIAgent(AgentVersion) in all
AzureAI integration tests.

- Rename AIProjectClient* test files to FoundryVersionedAgent*
- Register AIFunction tools in PromptAgentDefinition.Tools for
  server-side visibility via AsOpenAIResponseTool()
- Skip structured output tests (AzureAIProjectChatClient clears
  ResponseFormat for versioned agents)
- Remove all [Obsolete] attributes and #pragma warning disable CS0618

* Merge FoundryMemory package into AzureAI under Memory/ folder

Move all FoundryMemory source, unit tests, and integration tests into
the Microsoft.Agents.AI.AzureAI package. Change namespace from
Microsoft.Agents.AI.FoundryMemory to Microsoft.Agents.AI.AzureAI.

- Add [Experimental] to FoundryMemoryProviderOptions and Scope
- Rename internal AIProjectClientExtensions to MemoryStoreExtensions
- Update AzureAI .csproj with Compliance.Abstractions, Redaction
- Remove FoundryMemory from solution and release filter
- Update sample to reference AzureAI instead of FoundryMemory
- Delete old Microsoft.Agents.AI.FoundryMemory project and tests

* Add EnsureMemoryStoreCreatedAsync and memory existence checks to integration tests

- Ensure memory store is created before testing memory operations
- Add AZURE_AI_EMBEDDING_DEPLOYMENT_NAME config setting
- Assert memories exist in store via SearchMemoriesAsync before cleanup
- Verify scope isolation with direct memory store queries

* Fix and rename AzureAI unit tests for RAPI vs Versioned clarity

- Rename AsAIAgentAsync_* to AsAIAgent_* (drop Async from method group)
- Add _Rapi_ prefix to non-versioned (Responses API) tests
- Add _Versioned_ prefix to versioned agent tests where needed
- Fix RAPI tests: assert GetService<AIProjectClient>() is null
- Fix Versioned tests: assert IsType<FoundryAgent> and
  GetService<AIProjectClient>() returns the client instance
- Fix UserAgent header tests: proper HTTP handler routing
- Fix ChatClient_UsesDefaultConversationIdAsync test setup
- All 153 unit tests pass with 0 failures

* Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry

Rename the project, namespace, folder, and all references from
Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry.
Also rename Workflows.Declarative.AzureAI to .Foundry.

- Rename src, unit test, integration test, and workflow folders
- Update namespaces in all source and test .cs files
- Update ProjectReferences in ~47 sample and test .csproj files
- Update solution files (.slnx, .slnf)
- Update sample using statements
- Update READMEs, SKILL.md, ADRs in docs/
- Disable package validation baseline for renamed packages
- Fix UTF-8 BOM encoding on all affected .cs files
- AzureAI.Persistent left completely unchanged

* Fix format: remove ImplicitUsings, add explicit usings, fix BOM encoding

- Remove ImplicitUsings=enable from Foundry csproj to resolve IDE0005
  on shared ReplacingRedactor.cs
- Add explicit System usings to all source files that relied on them
- Sort usings alphabetically per editorconfig rules
- Fix UTF-8 BOM on 12 sample Program.cs files
- Rename Azure AI Foundry Agents to Microsoft Foundry Agents in docs
628bb1af48 · 2026-04-02 01:25:24 +00:00
History
..

Getting started with agents

The getting started with agents samples demonstrate the fundamental concepts and functionalities of single agents and can be used with any agent type.

While the functionality can be used with any agent type, these samples use Azure OpenAI as the AI provider and use ChatCompletion as the type of service.

For other samples that demonstrate how to create and configure each type of agent that come with the agent framework, see the How to create an agent for each provider samples.

Getting started with agents prerequisites

Before you begin, ensure you have the following prerequisites:

  • .NET 10 SDK or later
  • Azure OpenAI service endpoint and deployment configured
  • Azure CLI installed and authenticated (for Azure credential authentication)
  • User has the Cognitive Services OpenAI Contributor role for the Azure OpenAI resource.

Note: These samples use Azure OpenAI models. For more information, see how to deploy Azure OpenAI models with Microsoft Foundry.

Note: These samples use Azure CLI credentials for authentication. Make sure you're logged in with az login and have access to the Azure OpenAI resource and have the Cognitive Services OpenAI Contributor role. For more information, see the Azure CLI documentation.

Samples

Sample Description
Using OpenAPI function tools with a simple agent This sample demonstrates how to create function tools from an OpenAPI spec and use them with a simple agent (note that this sample is in the Semantic Kernel repository)
Using function tools with approvals This sample demonstrates how to use function tools where approvals require human in the loop approvals before execution
Structured output with a simple agent This sample demonstrates how to use structured output with a simple agent
Persisted conversations with a simple agent This sample demonstrates how to persist conversations and reload them later. This is useful for cases where an agent is hosted in a stateless service
3rd party chat history storage with a simple agent This sample demonstrates how to store chat history in a 3rd party storage solution
Observability with a simple agent This sample demonstrates how to add telemetry to a simple agent
Dependency injection with a simple agent This sample demonstrates how to add and resolve an agent with a dependency injection container
Exposing a simple agent as MCP tool This sample demonstrates how to expose an agent as an MCP tool
Using images with a simple agent This sample demonstrates how to use image multi-modality with an AI agent
Exposing a simple agent as a function tool This sample demonstrates how to expose an agent as a function tool
Background responses with tools and persistence This sample demonstrates advanced background response scenarios including function calling during background operations and state persistence
Using middleware with an agent This sample demonstrates how to use middleware with an agent
Using plugins with an agent This sample demonstrates how to use plugins with an agent
Reducing chat history size This sample demonstrates how to reduce the chat history to constrain its size, where chat history is maintained locally
Background responses This sample demonstrates how to use background responses for long-running operations with polling and resumption support
Deep research with an agent This sample demonstrates how to use the Deep Research Tool to perform comprehensive research on complex topics
Declarative agent This sample demonstrates how to declaratively define an agent.
Providing additional AI Context to an agent using multiple AIContextProviders This sample demonstrates how to inject additional AI context into a ChatClientAgent using multiple custom AIContextProvider components that are attached to the agent.
Using compaction pipeline with an agent This sample demonstrates how to use a compaction pipeline to efficiently limit the size of the conversation history for an agent.
In-function-loop checkpointing This sample demonstrates how to persist chat history after each service call during a tool-calling loop, enabling crash recovery and mid-run observability.

Running the samples from the console

To run the samples, navigate to the desired sample directory, e.g.

cd Agent_Step01_UsingFunctionToolsWithApprovals

Set the following environment variables:

$env:AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/" # Replace with your Azure OpenAI resource endpoint
$env:AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini"  # Optional, defaults to gpt-4o-mini

If the variables are not set, you will be prompted for the values when running the samples.

Execute the following command to build the sample:

dotnet build

Execute the following command to run the sample:

dotnet run --no-build

Or just build and run in one step:

dotnet run

Running the samples from Visual Studio

Open the solution in Visual Studio and set the desired sample project as the startup project. Then, run the project using the built-in debugger or by pressing F5.

You will be prompted for any required environment variables if they are not already set.