Skip to content
Discussion options

You must be logged in to vote

Hi @AdriAJ1, AIAgent objects are designed to be stateless objects, and can typically live for the length of the application lifetime. You can even add them to a DI container for the lifetime of the application if needed.

That said, re-creating an agent would work, and we don't typically do any expensive work on creation. That said, if you were building a high scale service where you serve many requests, it's good to avoid recreating objects on each request, due to the amount of new allocations.

So if you want to be super efficient, I'd got for option 2.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by AdriAJ1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants