Skip to content

Python - ChatCompletionAgent Lifetime #11917

Answered by moonbox3
vslepakov asked this question in Q&A
Discussion options

You must be logged in to vote

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:

  • Reusing a single instance: if your agent's configuration, including instructions, plugins, and kernel services, remains constant across requests, maintaining a single instance can be efficient. This approach minimizes the overhead associated with repeatedly parsing instructions and initializing plugins.
  • Creating new instances per request: given the agent's stateless nature, instantiating a new ChatCompletionAgent for each re…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vslepakov
Comment options

Answer selected by vslepakov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
python Pull requests for the Python Semantic Kernel agents
2 participants