github microsoft/semantic-kernel python-1.26.0

latest releases: dotnet-1.44.0, dotnet-1.43.0-nightly-250326.1, python-1.26.1...
4 days ago

Release Notes

New Features

Important

Please review the updated migration guide for details on updating your agent-related code

Common Agent Invocation API

We introduced a new common abstraction to manage threads for all agents. For each agent we now expose a thread class that implements the AgentThread base class, allowing context management via methods like create() and delete().

Agent responses get_response(...), invoke(...), invoke_stream(...) now return an AgentResponseItem[ChatMessageContent], which has two attributes:

message: TMessage  # Usually ChatMessageContent
thread: AgentThread  # Contains the concrete type for the given agent

It is still possible to get the content, role, or items properties on the response object:

for user_input in USER_INPUTS:
    print(f"# User: {user_input}")
    response = await agent.get_response(messages=user_input, thread=thread)
    print(f"# {response.name}: {response}"

Agent Invocation Updates

Further, we have updated the previous message keyword argument on all the agent get_response(...), invoke(...), and invoke_stream(...) methods. The new argument is messages which has the type str | ChatMessageContent | list[str | ChatMessageContent].

Agent Imports

All agent import paths have been consolidated under semantic_kernel.agents.

Updated import style

from semantic_kernel.agents import (
    AutoGenConversableAgent,
    AzureAIAgent,
    AzureAssistantAgent,
    BedrockAgent,
    ChatCompletionAgent,
    OpenAIAssistantAgent,
)

Previous import style (deprecated):

from semantic_kernel.agents import ChatCompletionAgent
from semantic_kernel.agents.autogen import AutoGenConversableAgent
from semantic_kernel.agents.azure_ai import AzureAIAgent
from semantic_kernel.agents.bedrock import BedrockAgent
from semantic_kernel.agents.open_ai import AzureAssistantAgent, OpenAIAssistantAgent

Enhancements and Improvements

Bug Fixes

  • Python: Fix agent_id kwarg in AzureAIAgent retrieval sample by @moonbox3 in #11057
  • Python: Pass api_key to azure config base init by @moonbox3 in #11056

Python Package Updates

  • Python: Unit tests for ollama services utils and dapr_actor_registration by @rracanicci in #10849

New Contributors

Full Changelog: python-1.25.0...python-1.26.0

Don't miss a new semantic-kernel release

NewReleases is sending notifications on new releases.