From 32477748686fce9d16c452ce014734cddba7c97f Mon Sep 17 00:00:00 2001 From: Mahdi Azarboon <21277296+azarboon@users.noreply.github.com> Date: Fri, 21 Aug 2026 11:24:11 +0800 Subject: [PATCH 1/4] Update README.md --- .../foundry/Agent_Step11_AsFunctionTool/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md index d785fd6c7af..efbb61fa4a9 100644 --- a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md +++ b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md @@ -2,6 +2,8 @@ This sample demonstrates how to use one agent as a function tool for another agent. +Function tools are ideal for scenarios requiring deterministic and predictable behavior, such as API integrations with validation and transformations, database operations, or payment processing. Using .`AsAIFunction()` converts agents into function tools, enabling agent composition and the construction of advanced workflows with reliable execution. + ## What this sample demonstrates - Creating a specialized agent (weather) with function tools From 8dd1d04657a5110e879cb998a63424b8303fedc0 Mon Sep 17 00:00:00 2001 From: Mahdi Azarboon <21277296+azarboon@users.noreply.github.com> Date: Fri, 21 Aug 2026 20:59:13 +0800 Subject: [PATCH 2/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../foundry/Agent_Step11_AsFunctionTool/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md index efbb61fa4a9..07938e06ddb 100644 --- a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md +++ b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md @@ -2,7 +2,7 @@ This sample demonstrates how to use one agent as a function tool for another agent. -Function tools are ideal for scenarios requiring deterministic and predictable behavior, such as API integrations with validation and transformations, database operations, or payment processing. Using .`AsAIFunction()` converts agents into function tools, enabling agent composition and the construction of advanced workflows with reliable execution. +Function tools expose operations through structured inputs, making them useful for scenarios such as API integrations with validation and transformations, database operations, or payment processing. Using `.AsAIFunction()` exposes an agent as a function tool, enabling agent composition and advanced workflows; because the wrapped agent remains model-driven, this does not make its behavior deterministic. ## What this sample demonstrates From e3ff28a502cf73c19a3793cec1083d29d2280458 Mon Sep 17 00:00:00 2001 From: Mahdi Azarboon <21277296+azarboon@users.noreply.github.com> Date: Fri, 21 Aug 2026 21:16:28 +0800 Subject: [PATCH 3/4] Update README.md --- .../foundry/Agent_Step11_AsFunctionTool/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md index 07938e06ddb..ef46e06860c 100644 --- a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md +++ b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md @@ -2,7 +2,7 @@ This sample demonstrates how to use one agent as a function tool for another agent. -Function tools expose operations through structured inputs, making them useful for scenarios such as API integrations with validation and transformations, database operations, or payment processing. Using `.AsAIFunction()` exposes an agent as a function tool, enabling agent composition and advanced workflows; because the wrapped agent remains model-driven, this does not make its behavior deterministic. +Function tools expose operations through structured inputs, making them useful for scenarios such as API integrations with validation and transformations, database operations, or payment processing. Using `.AsAIFunction()` exposes an agent as a function tool, enabling agent composition and advanced workflows. Because the wrapped agent remains model-driven, this does not make its behavior deterministic. Agents exposed through `.AsAIFunction()` are intended for background and non-interactive workflows, and are not suited for workflows that require human-in-the-loop approval. ## What this sample demonstrates From e1a09da06954055641055c75203da2f67f46de7b Mon Sep 17 00:00:00 2001 From: Mahdi Azarboon <21277296+azarboon@users.noreply.github.com> Date: Sat, 22 Aug 2026 09:41:48 +0800 Subject: [PATCH 4/4] Update dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> --- .../foundry/Agent_Step11_AsFunctionTool/README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md index ef46e06860c..e630bad3e70 100644 --- a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md +++ b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md @@ -2,7 +2,16 @@ This sample demonstrates how to use one agent as a function tool for another agent. -Function tools expose operations through structured inputs, making them useful for scenarios such as API integrations with validation and transformations, database operations, or payment processing. Using `.AsAIFunction()` exposes an agent as a function tool, enabling agent composition and advanced workflows. Because the wrapped agent remains model-driven, this does not make its behavior deterministic. Agents exposed through `.AsAIFunction()` are intended for background and non-interactive workflows, and are not suited for workflows that require human-in-the-loop approval. +Function tools expose operations through structured inputs and outputs making them useful for many different integration scenarios. + +Using `yourAIAgent.AsAIFunction()` exposes an agent as a function, enabling them to be used by other agents as tools allowing interesting agent composition scenarios. + +> [!NOTE] +> Wrapping an AI Model driven agent exposed as an `AIFunction` doesn't make your agent deterministic, it will return the original agent output as the function result. The determinism of the result is completely dependent on how your agent is configured. + +> [!IMPORTANT] +> Agents exposed through `.AsAIFunction()` are intended for background and non-interactive workflows, and are not suited for workflows that require human-in-the-loop approval. +> For interactive, human-in-the-loop workflows, use the [Microsoft.Agent.AI.Workflow](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/03-workflows) guidance. ## What this sample demonstrates