Skip to content

Commit f940e51

Browse files
authored
Clarify usage of tools on chatclient stack providers (#9429)
1 parent cae4955 commit f940e51

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎dotnet/src/Microsoft.Agents.AI/AIContextProviderDecorators/AIContextProviderChatClientBuilderExtensions.cs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ public static class AIContextProviderChatClientBuilderExtensions
3333
/// are retrieved from <see cref="AIAgent.CurrentRunContext"/>. An <see cref="System.InvalidOperationException"/>
3434
/// is thrown at invocation time if no run context is available.
3535
/// </para>
36+
/// <para>
37+
/// Providers can also be registered in other places, such as on the agent itself. The limitations below only apply to
38+
/// providers registered on the chat client pipeline with this method.
39+
/// </para>
40+
/// <para>
41+
/// Tools added by a provider registered this way are not supported when function invocation middleware is
42+
/// registered on the agent (for example, with <c>AIAgentBuilder.Use</c>). Those tools are not guaranteed to go
43+
/// through that middleware, so it cannot be relied on for security or policy checks on them.
44+
/// </para>
45+
/// <para>
46+
/// Separately, tools added by a provider registered this way are only run when a
47+
/// <see cref="FunctionInvokingChatClient"/> sits below this decorator in the pipeline. If it sits above,
48+
/// it does not know about those tools and will not run them.
49+
/// </para>
3650
/// </remarks>
3751
public static ChatClientBuilder UseAIContextProviders(this ChatClientBuilder builder, params AIContextProvider[] providers)
3852
{

0 commit comments

Comments
 (0)