Description
I would like AIAgent to support attaching an AIContextProvider for a specific run, so that context enrichment can be applied dynamically at runtime.
Currently, AIContextProvider can enrich:
• Instructions
• Tools
• Messages
However, there does not appear to be a straightforward way to attach a provider to AIAgent for a single invocation in the same style as:
agent = agent
.AsBuilder()
.UseAIContextProviders(xxxProvider)
.Build();
Problem Statement
At the moment, AIAgentBuilder.UseAIContextProviders(...) appears to support only MessageAIContextProvider, while AIContextProvider itself is more general and can enrich more than just messages.
This makes it difficult to dynamically inject context enrichment logic at runtime for a single agent execution.
Expected Behavior
I would like to xxxProvider is an AIContextProvider, and it can be used during one agent run to enrich:
• Instructions
• Tools
• Messages
Use Cases
• Injecting runtime-specific system instructions
• Loading tools dynamically before invocation
• Adding contextual messages from session or memory
• Updating session state after the run
Current Limitation
• AIAgent does not seem to provide a direct way to attach a general AIContextProvider per run
• The existing builder API seems focused on MessageAIContextProvider
• This limits the ability to use the full AIContextProvider lifecycle in agent pipelines
Suggested Improvement
Consider adding support in AIAgentBuilder for AIContextProvider, similar to the existing support in ChatClientBuilder.
This would make runtime context enrichment more consistent and flexible across the framework.
Code Sample
Language/SDK
.NET
Description
I would like AIAgent to support attaching an AIContextProvider for a specific run, so that context enrichment can be applied dynamically at runtime.
Currently, AIContextProvider can enrich:
• Instructions
• Tools
• Messages
However, there does not appear to be a straightforward way to attach a provider to AIAgent for a single invocation in the same style as:
Problem Statement
At the moment, AIAgentBuilder.UseAIContextProviders(...) appears to support only MessageAIContextProvider, while AIContextProvider itself is more general and can enrich more than just messages.
This makes it difficult to dynamically inject context enrichment logic at runtime for a single agent execution.
Expected Behavior
I would like to xxxProvider is an AIContextProvider, and it can be used during one agent run to enrich:
• Instructions
• Tools
• Messages
Use Cases
• Injecting runtime-specific system instructions
• Loading tools dynamically before invocation
• Adding contextual messages from session or memory
• Updating session state after the run
Current Limitation
• AIAgent does not seem to provide a direct way to attach a general AIContextProvider per run
• The existing builder API seems focused on MessageAIContextProvider
• This limits the ability to use the full AIContextProvider lifecycle in agent pipelines
Suggested Improvement
Consider adding support in AIAgentBuilder for AIContextProvider, similar to the existing support in ChatClientBuilder.
This would make runtime context enrichment more consistent and flexible across the framework.
Code Sample
Language/SDK
.NET