-
Hey folks, In a web application / REST API is it fine to use a single instance of a
The assumption here is that the agent and the underlying Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, @vslepakov. You're correct in noting that the Some considerations:
Thoughts about thread safety and state management: As you know, the Thoughts on performance implications: While the overhead of creating a new agent instance is relatively low, it is not negligible. If your application is sensitive to latency or operates under high load, reusing agent instances where appropriate can contribute to performance optimization. Both strategies are valid and supported by the agent's design. The optimal choice depends on your specific application requirements, including performance targets, resource constraints, and the need for context isolation. |
Beta Was this translation helpful? Give feedback.
Hi, @vslepakov.
You're correct in noting that the
ChatCompletionAgent
is designed to be stateless and thread-safe. This design allows for flexibility in instantiation strategies based on your application's performance and resource considerations.Some considerations:
ChatCompletionAgent
for each re…