Agent Hosting Extensions and AIAgent DI alternatives #4819
Unanswered
danielgsmith
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Team,
I've spent some time looking through the hosting extensions (
Microsoft.Agents.AI.Hosting& partner projects - OpenAI, AGUI, A2A) and I'm looking for some guidance on the best way to make these work for my use case.My understanding is that currently all of these hosting extensions rely on the target
AIAgentbeing injected via DI at startup and avalible to fetch from theIServiceProviderat runtime. Almost all of the extensions also explicitly target a singleAIAgenton their respectiveIEndpointConventionBuilderextension methods. It looks like the only exception to this is a singleMapOpenAIResponsesextension that does not require an agent as a pram, but instead uses theAgentReferencein theCreateResponsemodel to fetch the correct agent from DI. Please correct me if this understanding it wrong...Now on to my problem - the way my system is setup requires that agents be created on the fly. Some come from configurations in remote storage not avalible immediately at startup, some are agent configurations passed in via seperate API's from clients, etc. So i can't really inject my agents in to the service collection at startup very easily. I basically need a way to use the extensions which does not require targeting a specific agent, but rather resolve the correct agent on a per request basis.
I'd really love to be able to use the hosting extensions... it would really help to make sure my system aligns with industry standards, consistent api patterns, etc. but I'm not really seeing a path where i can use them as is.
Is there a recommended pattern to handle this sort of dynamic agent creation behind the hosting extensions?
If not, would the team consider adding some sort of abstraction that allows for this sort of pattern? Maybe additional extensions that allow for something like a
IAIAgentResolverFactory(build and resolve by name or some other attribute) - a default factory could obviously just fetch from the service provider still, but then I could have my own factory instead. Or maybe an extension that uses a Delegate to resolve agents by name? Agent names could be pulled from HTTP request path parms or query params...Thanks for your help and guidance.
Beta Was this translation helpful? Give feedback.
All reactions