Skip to content
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 for Agents as Kernel Functions #11184

Merged
merged 7 commits into from
Mar 26, 2025

Conversation

moonbox3
Copy link
Contributor

Motivation and Context

We're moving towards a pattern where Agents can be called as tools. We currently don't have this in Semantic Kernel Python.

This work builds off of the previous PR (#10828) but extends it to work with any SK Agent now that we have a bit more of a common invocation pattern (all agents take in messages kwarg). This also works now because each agent creates its own thread internally, if one isn't provided - so we don't need to worry about handling chat history for an OpenAI Assistant or an Azure AI Agent.

Description

Allow agents to be configured as Kernel Functions, which can then be used during Function Calling. We will advertise the Agent's name and either its description or instructions (if description is blank).

  • Provide a sample where we show a triage agent (ChatCompletionAgent) calling either a billing agent (ChatCompletionAgent) or a refund agent (ChatCompletionAgent ) as part of a tool call to satisfy the user's query.
  • Provide a sample where we show a triage agent (ChatCompletionAgent) calling either a billing agent (AzureAIAgent) or a refund agent (ChatCompletionAgent) to satisfy the user's query.

Contribution Checklist

@moonbox3 moonbox3 requested a review from a team as a code owner March 25, 2025 12:05
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel documentation labels Mar 25, 2025
@moonbox3 moonbox3 self-assigned this Mar 25, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 25, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/agents
   agent.py1582982%47, 54, 58, 67–78, 125, 130, 135, 140, 145, 149, 153, 157, 192–194, 222–229, 331–333, 400
semantic_kernel/functions
   kernel_plugin.py181697%393, 396, 409, 434, 455, 480
TOTAL21233246888% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3336 5 💤 0 ❌ 0 🔥 1m 28s ⏱️

@moonbox3 moonbox3 added this pull request to the merge queue Mar 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Mar 26, 2025
Merged via the queue into microsoft:main with commit 858644a Mar 26, 2025
28 checks passed
@moonbox3 moonbox3 deleted the agent-as-func branch March 26, 2025 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents documentation python Pull requests for the Python Semantic Kernel
Projects
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

4 participants