-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Allow plugins via agent constructors. Update samples. #10707
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… the constructor to an agent. Update samples. Update/add tests.
Python Test Coverage Report •
Python Unit Test Overview
|
TaoChenOSU
reviewed
Feb 27, 2025
python/semantic_kernel/agents/chat_completion/chat_completion_agent.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
approved these changes
Feb 27, 2025
alliscode
approved these changes
Feb 28, 2025
…have the required methods. Update concept tests.
TaoChenOSU
approved these changes
Feb 28, 2025
TaoChenOSU
approved these changes
Feb 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
agents
documentation
PR: breaking change
Pull requests that introduce breaking changes
python
Pull requests for the Python Semantic Kernel
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
In Semantic Kernel, our goal is to simplify working with agents. When an agent is created without a specified kernel, one is automatically created on the user’s behalf. This enables developers to pass in a list of plugins that are then added to the underlying kernel. If both the agent constructor and the provided kernel include plugins, those specified via the agent constructor take precedence—since plugins are stored in a dictionary, any duplicate names result in the agent’s plugin overwriting the existing one.
For the
ChatCompletionAgent
, usage is further simplified by allowing aChatCompletionClientBase
service to be passed via the constructor. If a kernel is supplied and already contains a chat completion service, the new service is added to the kernel. Moreover, if no execution settings are provided via KernelArguments, the first service registered on the kernel is used.New usage to create a ChatCompletionAgent
New usage to create a ChatCompletionAgent with plugins:
Previously, the
service_id
constructor argument was retained after introducing KernelArguments. However, with our transition to using the kernel’s AI service selector, theservice_id
parameter has become redundant. As we move from the experimental phase toward a release candidate, removingservice_id
is a necessary, albeit breaking, change.The
getting_started_with_agents/chat_completion
samples now begin by demonstrating the simplest way to configure the agent. The subsequent step illustrates the original method for setting up the chat completion service on the kernel. Similarly, for plugins, the initial approach is the easiest to follow, while the following step shows the traditional method of managing the kernel.Updated documentation will follow, once these changes are released in a new package.
!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following information:
-->
Description
Simplifying interactions with agents.
ChatCompletionAgent
,AzureAssistantAgent
, andOpenAIAssistantAgent
classes with therelease_candidate
decorator in place of theexperimental
decorator.Contribution Checklist