Replies: 2 comments 1 reply
-
|
yes you need to construct them using DI. It's not needed to create the agents at runtime. Create them using DI. Then just use AIContextProvider to create the system prompt at runtime. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I understand why DevUI would want it during the DI - to set the endpoints and everything. I wonder design-wise it would really be preferred to register each agent in the DI. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
Context
I am building a .NET Aspire application using the Microsoft Agent Framework.
Instead of registering static Agents in the DI container at startup, I create the agents on runtime. This is necessary because the agents depend on system prompt that's constructed dynamically, and using async methods (you can think as if the prompts are loaded from some remote location).
The Problem
The current DevUI setup (e.g.,
app.MapDevUI/MapAGUI) seems to expect agent instances to be ready and registered during the application startup pipeline.Since my agents are created on-demand and asynchronously, I cannot easily map them during
Program.csstartup without blocking the main thread.The Question
Is there a supported interface (like an
IAgentProviderorIAsyncAgentLoader) that can be used to "feed" agents to the DevUI lazily?Beta Was this translation helpful? Give feedback.
All reactions