Features and Improvements
MCP Tool
In this release we added a new built-in tool by @richard-gyiko for using Model Context Protocol (MCP) servers. MCP is an open protocol that allows agents to tap into an ecosystem of tools, from browsing file system to Git repo management.
Here is an example of using the mcp-server-fetch
tool for fetching web content as Markdown.
# pip install mcp-server-fetch autogen-ext[mcp]
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import StdioServerParams, mcp_server_tools
async def main() -> None:
# Get the fetch tool from mcp-server-fetch.
fetch_mcp_server = StdioServerParams(command="uvx", args=["mcp-server-fetch"])
tools = await mcp_server_tools(fetch_mcp_server)
# Create an agent that can use the fetch tool.
model_client = OpenAIChatCompletionClient(model="gpt-4o")
agent = AssistantAgent(name="fetcher", model_client=model_client, tools=tools, reflect_on_tool_use=True) # type: ignore
# Let the agent fetch the content of a URL and summarize it.
result = await agent.run(task="Summarize the content of https://en.wikipedia.org/wiki/Seattle")
print(result.messages[-1].content)
asyncio.run(main())
- Add MCP adapters to autogen-ext by @richard-gyiko in #5251
HTTP Tool
In this release we introduce a new built-in tool built by @EItanya for querying HTTP-based API endpoints. This lets agent call remotely hosted tools through HTTP.
Here is an example of using the httpbin.org
API for base64 decoding.
# pip install autogen-ext[http-tool]
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.messages import TextMessage
from autogen_core import CancellationToken
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.http import HttpTool
# Define a JSON schema for a base64 decode tool
base64_schema = {
"type": "object",
"properties": {
"value": {"type": "string", "description": "The base64 value to decode"},
},
"required": ["value"],
}
# Create an HTTP tool for the httpbin API
base64_tool = HttpTool(
name="base64_decode",
description="base64 decode a value",
scheme="https",
host="httpbin.org",
port=443,
path="/base64/{value}",
method="GET",
json_schema=base64_schema,
)
async def main():
# Create an assistant with the base64 tool
model = OpenAIChatCompletionClient(model="gpt-4")
assistant = AssistantAgent("base64_assistant", model_client=model, tools=[base64_tool])
# The assistant can now use the base64 tool to decode the string
response = await assistant.on_messages(
[TextMessage(content="Can you base64 decode the value 'YWJjZGU=', please?", source="user")],
CancellationToken(),
)
print(response.chat_message.content)
asyncio.run(main())
MagenticOne Improvement
We introduced several improvements to MagenticOne (M1) and its agents. We made M1 work with text-only models that can't read screenshots, and prompt changes to make it work better with smaller models.
Do you know now you can configure m1
CLI tool with a YAML configuration file?
- WebSurfer: print viewport text by @afourney in #5329
- Allow m1 cli to read a configuration from a yaml file. by @afourney in #5341
- Add text-only model support to M1 by @afourney in #5344
- Ensure decriptions appear each on one line. Fix web_surfer's desc by @afourney in #5390
- Prompting changes to better support smaller models. by @afourney in #5386
- doc: improve m1 docs, remove duplicates by @ekzhu in #5460
- M1 docker by @afourney in #5437
SelectorGroupChat Improvement
In this release we made several improvements to make SelectorGroupChat
work well with smaller models such as LLama 13B, and hosted models that do not support the name
field in Chat Completion messages.
Do you know you can use models served through Ollama directly through the OpenAIChatCompletionClient
? See: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/models.html#ollama
- Get SelectorGroupChat working for Llama models. by @afourney in #5409
- Mitigates #5401 by optionally prepending names to messages. by @afourney in #5448
- fix: improve speaker selection in SelectorGroupChat for weaker models by @ekzhu in #5454
Gemini Model Client
We enhanced our support for Gemini models. Now you can use Gemini models without passing in model_info
and base_url
.
from autogen_core.models import UserMessage
from autogen_ext.models.openai import OpenAIChatCompletionClient
model_client = OpenAIChatCompletionClient(
model="gemini-1.5-flash-8b",
# api_key="GEMINI_API_KEY",
)
response = await model_client.create([UserMessage(content="What is the capital of France?", source="user")])
print(response)
- feat: add gemini model families, enhance group chat selection for Gemini model and add tests by @ekzhu in #5334
- feat: enhance Gemini model support in OpenAI client and tests by @ekzhu in #5461
AGBench Update
New Sample
Interested in integration with FastAPI? We have a new sample: https://github.com/microsoft/autogen/blob/main/python/samples/agentchat_fastapi
- Add sample chat application with FastAPI by @ekzhu in #5433
- docs: enhance human-in-the-loop tutorial with FastAPI websocket example by @ekzhu in #5455
Bug Fixes
- Fix reading string args from m1 cli by @afourney in #5343
- Fix summarize_page in a text-only context, and for unknown models. by @afourney in #5388
- fix: warn on empty chunks, don't error out by @MohMaz in #5332
- fix: add state management for oai assistant by @lspinheiro in #5352
- fix: streaming token mode cannot work in function calls and will infi… by @so2liu in #5396
- fix: do not count agent event in MaxMessageTermination condition by @ekzhu in #5436
- fix: remove sk tool adapter plugin name by @lspinheiro in #5444
- fix & doc: update selector prompt documentation and remove validation checks by @ekzhu in #5456
- fix: update SK adapter stream tool call processing. by @lspinheiro in #5449
- fix: Update SK kernel from tool to use method. by @lspinheiro in #5469
Other Python Changes
- Update Python website to v0.4.5 by @ekzhu in #5316
- Adding o3 family: o3-mini by @razvanvalca in #5325
- Ensure ModelInfo field is serialized for OpenAIChatCompletionClient by @victordibia in #5315
- docs(core_distributed-group-chat): fix the typos in the docs in the README.md by @jsburckhardt in #5347
- Assistant agent drop images when not provided with a vision-capable model. by @afourney in #5351
- docs(python): add instructions for syncing dependencies and checking samples by @ekzhu in #5362
- Fix typo by @weijen in #5361
- docs: add blog link to README for updates and resources by @gagb in #5368
- Memory component base by @EItanya in #5380
- Fixed example code in doc:Custom Agents by @weijen in #5381
- Various web surfer fixes. by @afourney in #5393
- Refactor grpc channel connection in servicer by @jackgerrits in #5402
- Updates to proto for state apis by @jackgerrits in #5407
- feat: add integration workflow for testing multiple packages by @ekzhu in #5412
- Flush console output after every message. by @afourney in #5415
- Use a root json element instead of dict by @jackgerrits in #5430
- Split out GRPC tests by @jackgerrits in #5431
- feat: enhance AzureAIChatCompletionClient validation and add unit tests by @ekzhu in #5417
- Fix typo in Swarm doc by @weijen in #5435
- Update teams.ipynb : In the sample code the termination condition is set to the text "APPROVE" but the documentation mentions "TERMINATE" by @abhijeethaval in #5426
- Added the Claude family of models to ModelFamily by @rohanthacker in #5443
- feat: add indictor for tool failure to FunctionExecutionResult by @wistuba in #5428
- Update version to 0.4.6 by @ekzhu in #5477
- doc: improve agent tutorial to include multi-modal input. by @ekzhu in #5471
- doc: enhance extensions user guide with component examples by @ekzhu in #5480
- Implement control channel in python host servicer by @jackgerrits in #5427
- Improve custom agentchat agent docs with model clients (gemini example) and serialization by @victordibia in #5468
New Contributors
- @razvanvalca made their first contribution in #5325
- @jsburckhardt made their first contribution in #5347
- @weijen made their first contribution in #5361
- @EItanya made their first contribution in #5380
- @so2liu made their first contribution in #5396
- @abhijeethaval made their first contribution in #5426
- @wistuba made their first contribution in #5428
Full Changelog: python-v0.4.5...python-v0.4.6