Releases: microsoft/autogen
python-v0.4.8.1
Patch fixes to v0.4.8:
- Fixing SKChatCompletionAdapter bug that disabled tool use #5830
Full Changelog: python-v0.4.8...python-v0.4.8.1
python-v0.4.8
What's New
Ollama Chat Completion Client
To use the new Ollama Client:
pip install -U "autogen-ext[ollama]"
from autogen_ext.models.ollama import OllamaChatCompletionClient
from autogen_core.models import UserMessage
ollama_client = OllamaChatCompletionClient(
model="llama3",
)
result = await ollama_client.create([UserMessage(content="What is the capital of France?", source="user")]) # type: ignore
print(result)
To load a client from configuration:
from autogen_core.models import ChatCompletionClient
config = {
"provider": "OllamaChatCompletionClient",
"config": {"model": "llama3"},
}
client = ChatCompletionClient.load_component(config)
It also supports structured output:
from autogen_ext.models.ollama import OllamaChatCompletionClient
from autogen_core.models import UserMessage
from pydantic import BaseModel
class StructuredOutput(BaseModel):
first_name: str
last_name: str
ollama_client = OllamaChatCompletionClient(
model="llama3",
response_format=StructuredOutput,
)
result = await ollama_client.create([UserMessage(content="Who was the first man on the moon?", source="user")]) # type: ignore
print(result)
- Ollama client by @peterychang in #5553
- Fix ollama docstring by @peterychang in #5600
- Ollama client docs by @peterychang in #5605
New Required name
Field in FunctionExecutionResult
Now name
field is required in FunctionExecutionResult
:
exec_result = FunctionExecutionResult(call_id="...", content="...", name="...", is_error=False)
- fix: Update SKChatCompletionAdapter message conversion by @lspinheiro in #5749
Using thought
Field in CreateResult
and ThoughtEvent
Now CreateResult
uses the optional thought
field for the extra text content generated as part of a tool call from model. It is currently supported by OpenAIChatCompletionClient
.
When available, the thought
content will be emitted by AssistantAgent
as a ThoughtEvent
message.
- feat: Add thought process handling in tool calls and expose ThoughtEvent through stream in AgentChat by @ekzhu in #5500
New metadata
Field in AgentChat Message Types
Added a metadata
field for custom message content set by applications.
- Add metadata field to basemessage by @husseinmozannar in #5372
Exception in AgentChat Agents is now fatal
Now, if there is an exception raised within an AgentChat agent such as the AssistantAgent
, instead of silently stopping the team, it will raise the exception.
- fix: Allow background exceptions to be fatal by @jackgerrits in #5716
New Termination Conditions
New termination conditions for better control of agents.
See how you use TextMessageTerminationCondition
to control a single agent team running in a loop: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/teams.html#single-agent-team.
FunctionCallTermination
is also discussed as an example for custom termination condition: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/termination.html#custom-termination-condition
- TextMessageTerminationCondition for agentchat by @EItanya in #5742
- FunctionCallTermination condition by @ekzhu in #5808
Docs Update
The ChainLit sample contains UserProxyAgent
in a team, and shows you how to use it to get user input from UI. See: https://github.com/microsoft/autogen/tree/main/python/samples/agentchat_chainlit
- doc & sample: Update documentation for human-in-the-loop and UserProxyAgent; Add UserProxyAgent to ChainLit sample; by @ekzhu in #5656
- docs: Add logging instructions for AgentChat and enhance core logging guide by @ekzhu in #5655
- doc: Enrich AssistantAgent API documentation with usage examples. by @ekzhu in #5653
- doc: Update SelectorGroupChat doc on how to use O3-mini model. by @ekzhu in #5657
- update human in the loop docs for agentchat by @victordibia in #5720
- doc: update guide for termination condition and tool usage by @ekzhu in #5807
- Add examples for custom model context in AssistantAgent and ChatCompletionContext by @ekzhu in #5810
Bug Fixes
- Initialize BaseGroupChat before reset by @gagb in #5608
- fix: Remove R1 model family from is_openai function by @ekzhu in #5652
- fix: Crash in argument parsing when using Openrouter by @philippHorn in #5667
- Fix: Add support for custom headers in HTTP tool requests by @linznin in #5660
- fix: Structured output with tool calls for OpenAIChatCompletionClient by @ekzhu in #5671
- fix: Allow background exceptions to be fatal by @jackgerrits in #5716
- Fix: Auto-Convert Pydantic and Dataclass Arguments in AutoGen Tool Calls by @mjunaidca in #5737
Other Python Related Changes
- Update website version by @ekzhu in #5561
- doc: fix typo (recpients -> recipients) by @radamson in #5570
- feat: enhance issue templates with detailed guidance by @ekzhu in #5594
- Improve the model mismatch warning msg by @thinkall in #5586
- Fixing grammar issues by @OndeVai in #5537
- Fix typo in doc by @weijen in #5628
- Make ChatCompletionCache support component config by @victordibia in #5658
- DOCS: Minor updates to handoffs.ipynb by @xtophs in #5665
- DOCS: Fixed small errors in the text and made code format more consistent by @xtophs in #5664
- Replace the undefined tools variable with tool_schema parameter in ToolUseAgent class by @shuklaham in #5684
- Improve readme inconsistency by @gagb in #5691
- update versions to 0.4.8 by @ekzhu in #5689
- Update issue templates by @jackgerrits in #5686
- Change base image to one with arm64 support by @jackgerrits in #5681
- REF: replaced variable name in TextMentionTermination by @pengjunfeng11 in #5698
- Refactor AssistantAgent on_message_stream by @lspinheiro in #5642
- Fix accessibility issue 14 for visual accessibility by @peterychang in #5709
- Specify specific UV version should be used by @jackgerrits in #5711
- Update README.md for improved clarity and formatting by @gagb in #5714
- add anthropic native support by @victordibia in #5695
- 5663 ollama client host by @rylativity in #5674
- Fix visual accessibility issues 6 and 20 by @peterychang in #5725
- Add Serialization Instruction for MemoryContent by @victordibia in #5727
- Fix typo by @stuartleeks in #5754
- Add support for default model client, in AGS updates to settings UI by @victordibia in #5763
- fix incorrect field name from config to component by @peterj in #5761
- Make FileSurfer and CodeExecAgent Declarative by @victordibia in #5765
- docs: add note about markdown code block requirement in CodeExecutorA⦠by @jay-thakur in #5785
- add options to ollama client by @peterychang in #5805
- add stream_options to openai model by @peterj in #5788
- add api docstring to with_requirements by @victordibia in #5746
- Update with correct message types by @laurentran in #5789
- Update installation.md by @LuSrackhall in #5784
- Update magentic-one.md by @Paulhb7 in #5779
- Add ChromaDBVectorMemory in Extensions by @victordibia in #5308
N...
python-v0.4.7
Overview
This release contains various bug fixes and feature improvements for the Python API.
Related news: our .NET API website is up and running: https://microsoft.github.io/autogen/dotnet/dev/. Our .NET Core API now has dev releases. Check it out!
Important
Starting from v0.4.7, ModelInfo
's required fields will be enforced. So please include all required fields when you use model_info
when creating model clients. For example,
from autogen_core.models import UserMessage
from autogen_ext.models.openai import OpenAIChatCompletionClient
model_client = OpenAIChatCompletionClient(
model="llama3.2:latest",
base_url="http://localhost:11434/v1",
api_key="placeholder",
model_info={
"vision": False,
"function_calling": True,
"json_output": False,
"family": "unknown",
},
)
response = await model_client.create([UserMessage(content="What is the capital of France?", source="user")])
print(response)
See ModelInfo for more details.
New Features
- DockerCommandLineCodeExecutor support for additional volume mounts, exposed host ports by @andrejpk in #5383
- Remove and get subscription APIs for Python GrpcWorkerAgentRuntime by @jackgerrits in #5365
- Add
strict
mode support toBaseTool
,ToolSchema
andFunctionTool
to allow tool calls to be used together with structured output mode by @ekzhu in #5507 - Make CodeExecutor components serializable by @victordibia in #5527
Bug Fixes
- fix: Address tool call execution scenario when model produces empty tool call ids by @ekzhu in #5509
- doc & fix: Enhance AgentInstantiationContext with detailed documentation and examples for agent instantiation; Fix a but that caused value error when the expected class is not provided in register_factory by @ekzhu in #5555
- fix: Add model info validation and improve error messaging by @ekzhu in #5556
- fix: Add warning and doc for Windows event loop policy to avoid subprocess issues in web surfer and local executor by @ekzhu in #5557
Doc Updates
- doc: Update API doc for MCP tool to include installation instructions by @ekzhu in #5482
- doc: Update AgentChat quickstart guide to enhance clarity and installation instructions by @ekzhu in #5499
- doc: API doc example for langchain database tool kit by @ekzhu in #5498
- Update Model Client Docs to Mention API Key from Environment Variables by @victordibia in #5515
- doc: improve tool guide in Core API doc by @ekzhu in #5546
Other Python Related Changes
- Update website version v0.4.6 by @ekzhu in #5481
- Reduce number of doc jobs for old releases by @jackgerrits in #5375
- Fix class name style in document by @weijen in #5516
- Update custom-agents.ipynb by @yosuaw in #5531
- fix: update 0.2 deployment workflow to use tag input instead of branch by @ekzhu in #5536
- fix: update help text for model configuration argument by @gagb in #5533
- Update python version to v0.4.7 by @ekzhu in #5558
New Contributors
Full Changelog: python-v0.4.6...python-v0.4.7
python-v0.4.6
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 "TERMIN...
autogenstudio-v0.4.1
Whats New
AutoGen Studio Declarative Configuration
- in #5172, you can now build your agents in python and export to a json format that works in autogen studio
AutoGen studio now used the same declarative configuration interface as the rest of the AutoGen library. This means you can create your agent teams in python and then dump_component()
it into a JSON spec that can be directly used in AutoGen Studio! This eliminates compatibility (or feature inconsistency) errors between AGS/AgentChat Python as the exact same specs can be used across.
See a video tutorial on AutoGen Studio v0.4 (02/25) - https://youtu.be/oum6EI7wohM
Here's an example of an agent team and how it is converted to a JSON file:
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.conditions import TextMentionTermination
agent = AssistantAgent(
name="weather_agent",
model_client=OpenAIChatCompletionClient(
model="gpt-4o-mini",
),
)
agent_team = RoundRobinGroupChat([agent], termination_condition=TextMentionTermination("TERMINATE"))
config = agent_team.dump_component()
print(config.model_dump_json())
{
"provider": "autogen_agentchat.teams.RoundRobinGroupChat",
"component_type": "team",
"version": 1,
"component_version": 1,
"description": "A team that runs a group chat with participants taking turns in a round-robin fashion\n to publish a message to all.",
"label": "RoundRobinGroupChat",
"config": {
"participants": [
{
"provider": "autogen_agentchat.agents.AssistantAgent",
"component_type": "agent",
"version": 1,
"component_version": 1,
"description": "An agent that provides assistance with tool use.",
"label": "AssistantAgent",
"config": {
"name": "weather_agent",
"model_client": {
"provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
"component_type": "model",
"version": 1,
"component_version": 1,
"description": "Chat completion client for OpenAI hosted models.",
"label": "OpenAIChatCompletionClient",
"config": { "model": "gpt-4o-mini" }
},
"tools": [],
"handoffs": [],
"model_context": {
"provider": "autogen_core.model_context.UnboundedChatCompletionContext",
"component_type": "chat_completion_context",
"version": 1,
"component_version": 1,
"description": "An unbounded chat completion context that keeps a view of the all the messages.",
"label": "UnboundedChatCompletionContext",
"config": {}
},
"description": "An agent that provides assistance with ability to use tools.",
"system_message": "You are a helpful AI assistant. Solve tasks using your tools. Reply with TERMINATE when the task has been completed.",
"model_client_stream": false,
"reflect_on_tool_use": false,
"tool_call_summary_format": "{result}"
}
}
],
"termination_condition": {
"provider": "autogen_agentchat.conditions.TextMentionTermination",
"component_type": "termination",
"version": 1,
"component_version": 1,
"description": "Terminate the conversation if a specific text is mentioned.",
"label": "TextMentionTermination",
"config": { "text": "TERMINATE" }
}
}
}
Note: If you are building custom agents and want to use them in AGS, you will need to inherit from the AgentChat BaseChat agent and Component class.
Note: This is a breaking change in AutoGen Studio. You will need to update your AGS specs for any teams created with version autogenstudio <0.4.1
Ability to Test Teams in Team Builder
- in #5392, you can now test your teams as you build them. No need to switch between team builder and playground sessions to test.
You can now test teams directly as you build them in the team builder UI. As you edit your team (either via drag and drop or by editing the JSON spec)


New Default Agents in Gallery (Web Agent Team, Deep Research Team)
- in #5416, adds an implementation of a Web Agent Team and Deep Research Team in the default gallery.
The default gallery now has two additional default agents that you can build on and test:
- Web Agent Team - A team with 3 agents - a Web Surfer agent that can browse the web, a Verification Assistant that verifies and summarizes information, and a User Proxy that provides human feedback when needed.
- Deep Research Team - A team with 3 agents - a Research Assistant that performs web searches and analyzes information, a Verifier that ensures research quality and completeness, and a Summary Agent that provides a detailed markdown summary of the research as a report to the user.
Other Improvements
Older features that are currently possible in v0.4.1
- Real-time agent updates streaming to the frontend
- Run control: You can now stop agents mid-execution if they're heading in the wrong direction, adjust the team, and continue
- Interactive feedback: Add a UserProxyAgent to get human input through the UI during team runs
- Message flow visualization: See how agents communicate with each other
- Ability to import specifications from external galleries
- Ability to wrap agent teams into an API using the AutoGen Studio CLI
To update to the latest version:
pip install -U autogenstudio
Overall roadmap for AutoGen Studion is here #4006 .
Contributions welcome!
python-v0.4.5
What's New
Streaming for AgentChat agents and teams
- Introduce ModelClientStreamingChunkEvent for streaming model output and update handling in agents and console by @ekzhu in #5208
To enable streaming from an AssistantAgent, set model_client_stream=True
when creating it. The token stream will be available when you run the agent directly, or as part of a team when you call run_stream
.
If you want to see tokens streaming in your console application, you can use Console
directly.
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
agent = AssistantAgent("assistant", OpenAIChatCompletionClient(model="gpt-4o"), model_client_stream=True)
await Console(agent.run_stream(task="Write a short story with a surprising ending."))
asyncio.run(main())
If you are handling the messages yourself and streaming to the frontend, you can handle
autogen_agentchat.messages.ModelClientStreamingChunkEvent
message.
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
agent = AssistantAgent("assistant", OpenAIChatCompletionClient(model="gpt-4o"), model_client_stream=True)
async for message in agent.run_stream(task="Write 3 line poem."):
print(message)
asyncio.run(main())
source='user' models_usage=None content='Write 3 line poem.' type='TextMessage'
source='assistant' models_usage=None content='Silent' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' whispers' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' glide' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=',' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' \n' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content='Moon' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content='lit' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' dreams' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' dance' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' through' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' the' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' night' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=',' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' \n' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content='Stars' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' watch' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' from' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' above' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content='.' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content='Silent whispers glide, \nMoonlit dreams dance through the night, \nStars watch from above.' type='TextMessage'
TaskResult(messages=[TextMessage(source='user', models_usage=None, content='Write 3 line poem.', type='TextMessage'), TextMessage(source='assistant', models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0), content='Silent whispers glide, \nMoonlit dreams dance through the night, \nStars watch from above.', type='TextMessage')], stop_reason=None)
Read more here: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html#streaming-tokens
Also, see the sample showing how to stream a team's messages to ChainLit frontend: https://github.com/microsoft/autogen/tree/python-v0.4.5/python/samples/agentchat_chainlit
R1-style reasoning output
import asyncio
from autogen_core.models import UserMessage, ModelFamily
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
model_client = OpenAIChatCompletionClient(
model="deepseek-r1:1.5b",
api_key="placeholder",
base_url="http://localhost:11434/v1",
model_info={
"function_calling": False,
"json_output": False,
"vision": False,
"family": ModelFamily.R1,
}
)
# Test basic completion with the Ollama deepseek-r1:1.5b model.
create_result = await model_client.create(
messages=[
UserMessage(
content="Taking two balls from a bag of 10 green balls and 20 red balls, "
"what is the probability of getting a green and a red balls?",
source="user",
),
]
)
# CreateResult.thought field contains the thinking content.
print(create_result.thought)
print(create_result.content)
asyncio.run(main())
Streaming is also supported with R1-style reasoning output.
See the sample showing R1 playing chess: https://github.com/microsoft/autogen/tree/python-v0.4.5/python/samples/agentchat_chess_game
FunctionTool for partial functions
- FunctionTool partial support by @nour-bouzid in #5183
Now you can define function tools from partial functions, where some parameters have been set before hand.
import json
from functools import partial
from autogen_core.tools import FunctionTool
def get_weather(country: str, city: str) -> str:
return f"The temperature in {city}, {country} is 75Β°"
partial_function = partial(get_weather, "Germany")
tool = FunctionTool(partial_function, description="Partial function tool.")
print(json.dumps(tool.schema, indent=2))
{
"name": "get_weather",
"description": "Partial function tool.",
"parameters": {
"type": "object",
"properties": {
"city": {
"description": "city",
"title": "City",
"type": "string"
}
},
"required": [
"city"
]
}
}
CodeExecutorAgent update
New Samples
- Streamlit + AgentChat sample by @husseinkorly in #5306
- ChainLit + AgentChat sample with streaming by @ekzhu in #5304
- Chess sample showing R1-Style reasoning for planning and strategizing by @ekzhu in #5285
Documentation update:
- Add Semantic Kernel Adapter documentation and usage examples in user guides by @ekzhu in #5256
- Update human-in-the-loop tutorial with better system message to signal termination condition by @ekzhu in #5253
Moves
Bug Fixes
- fix: handle non-string function arguments in tool calls and add corresponding warnings by @ekzhu in #5260
- Add default_header support by @nour-bouzid in #5249
- feat: update OpenAIAssistantAgent to support AsyncAzureOpenAI client by @ekzhu in #5312
All Other Python Related Changes
- Update website for v0.4.4 by @ekzhu in #5246
- update dependencies to work with protobuf 5 by @MohMaz in #5195
- Adjusted M1 agent system prompt to remove TERMINATE by @afourney in #5263
#5270 - chore: update package versions to 0.4.5 and remove deprecated requirements by @ekzhu in #5280
- Update Distributed Agent Runtime Cross-platform Sample by @linznin in #5164
- fix: windows check ci failure by @bassmang in #5287
- fix: type issues in streamlit sample and add streamlit to dev dependencies by @ekzhu in #5309
- chore: add asyncio_atexit dependency to docker requirements by @ekzhu in #5307
- feat: add o3 to model info; update chess example by @ekzhu in #5311
New Contributors
- @nour-bouzid made their first contribution in #5183
- @linznin made their first contribution in #5164
- @husseinkorly made their first contribution in #5306
Full Changelog: v0.4.4...python-v0.4.5
python-v0.4.4
What's New
Serializable Configuration for AgentChat
- Make FunctionTools Serializable (Declarative) by @victordibia in #5052
- Make AgentChat Team Config Serializable by @victordibia in #5071
- improve component config, add description support in dump_component by @victordibia in #5203
This new feature allows you to serialize an agent or a team to a JSON string, and deserialize them back into objects. Make sure to also read about save_state
and load_state
: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/state.html.
You now can serialize and deserialize both the configurations and the state of agents and teams.
For example, create a RoundRobinGroupChat
, and serialize its configuration and state.
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.base import Team
from autogen_agentchat.ui import Console
from autogen_agentchat.conditions import TextMentionTermination
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def dump_team_config() -> None:
model_client = OpenAIChatCompletionClient(model="gpt-4o")
assistant = AssistantAgent(
"assistant",
model_client=model_client,
system_message="You are a helpful assistant.",
)
critic = AssistantAgent(
"critic",
model_client=model_client,
system_message="Provide feedback. Reply with 'APPROVE' if the feedback has been addressed.",
)
termination = TextMentionTermination("APPROVE", sources=["critic"])
group_chat = RoundRobinGroupChat(
[assistant, critic], termination_condition=termination
)
# Run the group chat.
await Console(group_chat.run_stream(task="Write a short poem about winter."))
# Dump the team configuration to a JSON file.
config = group_chat.dump_component()
with open("team_config.json", "w") as f:
f.write(config.model_dump_json(indent=4))
# Dump the team state to a JSON file.
state = await group_chat.save_state()
with open("team_state.json", "w") as f:
f.write(json.dumps(state, indent=4))
asyncio.run(dump_team_config())
Produces serialized team configuration and state. Truncated for illustration purpose.
{
"provider": "autogen_agentchat.teams.RoundRobinGroupChat",
"component_type": "team",
"version": 1,
"component_version": 1,
"description": "A team that runs a group chat with participants taking turns in a round-robin fashion\n to publish a message to all.",
"label": "RoundRobinGroupChat",
"config": {
"participants": [
{
"provider": "autogen_agentchat.agents.AssistantAgent",
"component_type": "agent",
"version": 1,
"component_version": 1,
"description": "An agent that provides assistance with tool use.",
"label": "AssistantAgent",
"config": {
"name": "assistant",
"model_client": {
"provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
"component_type": "model",
"version": 1,
"component_version": 1,
"description": "Chat completion client for OpenAI hosted models.",
"label": "OpenAIChatCompletionClient",
"config": {
"model": "gpt-4o"
}
{
"type": "TeamState",
"version": "1.0.0",
"agent_states": {
"group_chat_manager/25763eb1-78b2-4509-8607-7224ae383575": {
"type": "RoundRobinManagerState",
"version": "1.0.0",
"message_thread": [
{
"source": "user",
"models_usage": null,
"content": "Write a short poem about winter.",
"type": "TextMessage"
},
{
"source": "assistant",
"models_usage": {
"prompt_tokens": 25,
"completion_tokens": 150
},
"content": "Amidst the still and silent air, \nWhere frost adorns the branches bare, \nThe world transforms in shades of white, \nA wondrous, shimmering, quiet sight.\n\nThe whisper of the wind is low, \nAs snowflakes drift and dance and glow. \nEach crystal, delicate and bright, \nFalls gently through the silver night.\n\nThe earth is hushed in pure embrace, \nA tranquil, glistening, untouched space. \nYet warmth resides in hearts that roam, \nFinding solace in the hearth of home.\n\nIn winter\u2019s breath, a promise lies, \nBeneath the veil of cold, clear skies: \nThat spring will wake the sleeping land, \nAnd life will bloom where now we stand.",
"type": "TextMessage"
Load the configuration and state back into objects.
import asyncio
import json
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.base import Team
async def load_team_config() -> None:
# Load the team configuration from a JSON file.
with open("team_config.json", "r") as f:
config = json.load(f)
group_chat = Team.load_component(config)
# Load the team state from a JSON file.
with open("team_state.json", "r") as f:
state = json.load(f)
await group_chat.load_state(state)
assert isinstance(group_chat, RoundRobinGroupChat)
asyncio.run(load_team_config())
This new feature allows you to manage persistent sessions across server-client based user interaction.
Azure AI Client for Azure-Hosted Models
- Feature/azure ai inference client by @lspinheiro and @rohanthacker in #5153
This allows you to use Azure and GitHub-hosted models, including Phi-4, Mistral models, and Cohere models.
import asyncio
import os
from autogen_core.models import UserMessage
from autogen_ext.models.azure import AzureAIChatCompletionClient
from azure.core.credentials import AzureKeyCredential
async def main() -> None:
client = AzureAIChatCompletionClient(
model="Phi-4",
endpoint="https://models.inference.ai.azure.com",
# To authenticate with the model you will need to generate a personal access token (PAT) in your GitHub settings.
# Create your PAT token by following instructions here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
credential=AzureKeyCredential(os.environ["GITHUB_TOKEN"]),
model_info={
"json_output": False,
"function_calling": False,
"vision": False,
"family": "unknown",
},
)
result = await client.create(
[UserMessage(content="What is the capital of France?", source="user")]
)
print(result)
asyncio.run(main())
Rich Console UI for Magentic One CLI
You can now enable pretty printed output for m1
command line tool by adding --rich
argument.
m1 --rich "Find information about AutoGen"

Default In-Memory Cache for ChatCompletionCache
- Implement default in-memory store for ChatCompletionCache by @srjoglekar246 in #5188
This allows you to cache model client calls without specifying an external cache service.
import asyncio
from autogen_core.models import UserMessage
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.models.cache import ChatCompletionCache
async def main() -> None:
# Create a model client.
client = OpenAIChatCompletionClient(model="gpt-4o")
# Create a cached wrapper around the model client.
cached_client = ChatCompletionCache(client)
# Call the cached client.
result = await cached_client.create(
[UserMessage(content="What is the capital of France?", source="user")]
)
print(result.content, result.cached)
# Call the cached client again.
result = await cached_client.create(
[UserMessage(content="What is the capital of France?", source="user")]
)
print(result.content, result.cached)
asyncio.run(main())
The capital of France is Paris. False
The capital of France is Paris. True
Docs Update
- Update model client documentation add Ollama, Gemini, Azure AI models by @ekzhu in #5196
- Add Model Client Cache section to migration guide by @ekzhu in #5197
- docs: Enhance documentation for SingleThreadedAgentRuntime with usage examples and clarifications; undeprecate process_next by @ekzhu in #5230
- docs: Update user guide notebooks to enhance clarity and add structured output by @ekzhu in #5224
- docs: Core API doc update: split out model context from model clients; separate framework and components by @ekzhu in #5171
- docs: Add a helpful comment to swarm.ipynb by @withsmilo in https://github.com/microsoft/autogen...
python-v0.4.3
What's new
This is the first release since 0.4.0 with significant new features! We look forward to hearing feedback and suggestions from the community.
Chat completion model cache
One of the big missing features from 0.2 was the ability to seamlessly cache model client completions. This release adds ChatCompletionCache
which can wrap any other ChatCompletionClient
and cache completions.
There is a CacheStore
interface to allow for easy implementation of new caching backends. The currently available implementations are:
import asyncio
import tempfile
from autogen_core.models import UserMessage
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.models.cache import ChatCompletionCache, CHAT_CACHE_VALUE_TYPE
from autogen_ext.cache_store.diskcache import DiskCacheStore
from diskcache import Cache
async def main():
with tempfile.TemporaryDirectory() as tmpdirname:
openai_model_client = OpenAIChatCompletionClient(model="gpt-4o")
cache_store = DiskCacheStore[CHAT_CACHE_VALUE_TYPE](Cache(tmpdirname))
cache_client = ChatCompletionCache(openai_model_client, cache_store)
response = await cache_client.create([UserMessage(content="Hello, how are you?", source="user")])
print(response) # Should print response from OpenAI
response = await cache_client.create([UserMessage(content="Hello, how are you?", source="user")])
print(response) # Should print cached response
asyncio.run(main())
ChatCompletionCache
is not yet supported by the declarative component config, see the issue to track progress.
GraphRAG
This releases adds support for GraphRAG as a tool agents can call. You can find a sample for how to use this integration here, and docs for LocalSearchTool
and GlobalSearchTool
.
import asyncio
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.ui import Console
from autogen_ext.tools.graphrag import GlobalSearchTool
from autogen_agentchat.agents import AssistantAgent
async def main():
# Initialize the OpenAI client
openai_client = OpenAIChatCompletionClient(
model="gpt-4o-mini",
)
# Set up global search tool
global_tool = GlobalSearchTool.from_settings(settings_path="./settings.yaml")
# Create assistant agent with the global search tool
assistant_agent = AssistantAgent(
name="search_assistant",
tools=[global_tool],
model_client=openai_client,
system_message=(
"You are a tool selector AI assistant using the GraphRAG framework. "
"Your primary task is to determine the appropriate search tool to call based on the user's query. "
"For broader, abstract questions requiring a comprehensive understanding of the dataset, call the 'global_search' function."
),
)
# Run a sample query
query = "What is the overall sentiment of the community reports?"
await Console(assistant_agent.run_stream(task=query))
if __name__ == "__main__":
asyncio.run(main())
#4612 by @lspinheiro
Semantic Kernel model adapter
Semantic Kernel has an extensive collection of AI connectors. In this release we added support to adapt a Semantic Kernel AI Connector to an AutoGen ChatCompletionClient using the SKChatCompletionAdapter
.
Currently this requires passing the kernel during create, and so cannot be used with AssistantAgent
directly yet. This will be fixed in a future release (#5144).
#4851 by @lspinheiro
AutoGen to Semantic Kernel tool adapter
We also added a tool adapter, but this time to allow AutoGen tools to be added to a Kernel, called KernelFunctionFromTool
.
#4851 by @lspinheiro
Jupyter Code Executor
This release also brings forward Jupyter code executor functionality that we had in 0.2, as the JupyterCodeExecutor
.
Please note that this currently on supports local execution and should be used with caution.
Memory
It's still early on but we merged the interface for agent memory in this release. This allows agents to enrich their context from a memory store and save information to it. The interface is defined in core and AssistantAgent in agentchat accepts memory as a parameter now. There is an initial example memory implementation which simply injects all memories as system messages for the agent. The intention is for the memory interface to be able to be used for both RAG and agent memory systems going forward.
- Tutorial
- Core
Memory
interface - Existing
AssistantAgent
with new memory parameter
#4438 by @victordibia, #5053 by @ekzhu
Declarative config
We're continuing to expand support for declarative configs throughout the framework. In this release, we've added support for termination conditions and base chat agents. Once we're done with this, you'll be able to configure and entire team of agents with a single config file and have it work seamlessly with AutoGen studio. Stay tuned!
#4984, #5055 by @victordibia
Other
- Add sources field to TextMentionTermination by @Leon0402 in #5106
- Update gpt-4o model version to 2024-08-06 by @ekzhu in #5117
Bug fixes
- Retry multiple times when M1 selects an invalid agent. Make agent sel⦠by @afourney in #5079
- fix: normalize finish reason in CreateResult response by @ekzhu in #5085
- Pass context between AssistantAgent for handoffs by @ekzhu in #5084
- fix: ensure proper handling of structured output in OpenAI client and improve test coverage for structured output by @ekzhu in #5116
- fix: use tool_calls field to detect tool calls in OpenAI client; add integration tests for OpenAI and Gemini by @ekzhu in #5122
Other changes
- Update website for 0.4.1 by @jackgerrits in #5031
- PoC AGS dev container by @JohanForngren in #5026
- Update studio dep by @ekzhu in #5062
- Update studio dep to use version bound by @ekzhu in #5063
- Update gpt-4o model version and add new model details by @keenranger in #5056
- Improve AGS Documentation by @victordibia in #5065
- Pin uv to 0.5.18 by @jackgerrits in #5067
- Update version to 0.4.3 pre-emptively by @jackgerrits in #5066
- fix: dotnet azure pipeline (uv sync installation) by @bassmang in #5042
- docs: .NET Documentation by @lokitoth in #5039
- [Documentation] Update tools.ipynb: use system messages in the tool_agent_caller_loop session by @zysoong in #5068
- docs: enhance agents.ipynb with parallel tool calls section by @ekzhu in #5088
- Use caching to run tests and report coverage by @lspinheiro in #5086
- fix: ESPR dotnet code signing by @bassmang in #5081
- Update AGS pyproject.toml by @victordibia in #5101
- docs: update AssistantAgent documentation with a new figure, attention and warning notes by @ekzhu in #5099
- Rysweet fix integration tests and xlang by...
python-v0.4.2
- Change async input strategy in order to remove unintentional and accidentally added GPL dependency (#5060)
Full Changelog: v0.4.1...v0.4.2
python-v0.4.1
What's Important
- Fixed console user input bug that affects
m1
and other apps that use console user input. #4995 - Improved component config by allowing subclassing the
BaseComponent
class. #5017 To read more about how to create your own component config to support serializable components: https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/framework/component-config.html - Fixed
stop_reason
related bug by making the stop reason setting more robust #5027 - Disable
Console
output statistics by default. - Minor doc fixes.
All Changes since v0.4.0
- Update magentic-one-cli version to 0.2.0 by @jackgerrits in #4973
- Update switcher versions and make 0.4.0 stable by @jackgerrits in #4940
- Fix version switcher rendering by @jackgerrits in #4974
- Don't show banner on stable by @jackgerrits in #4976
- Remove accidentally added character by @jackgerrits in #4980
- Update README.md to fix spelling error by @guinaut in #4982
- Minor API doc update for openai assistant agent by @ekzhu in #4986
- Add guidance for docstrings when adding an API by @jackgerrits in #4981
- Fix typo in
Multi-Agent Design Patterns -> Intro
docs by @timrogers in #4991 - Add missing py.typed in autogen_ext, fix type issue in core by @jackgerrits in #4993
- Minor Updates to AGS Docs by @victordibia in #5010
- Fix: Properly await
agent.run()
in READMEHello World
example by @Programmer-RD-AI in #5013 - Add python version requirement to frontpage and readme by @ekzhu in #5014
- Disable output usage stat summary in Console as the stats is often inaccurate. by @ekzhu in #5021
- Add AGS to README.md by @ekzhu in #5019
- fix: fix user input in m1 by @jackgerrits in #4995
- Typo in teams.ipynb by @SudhakarPunniyakotti in #5028
- fix: Normalize openai client stop reason to make more robust by @jackgerrits in #5027
- Add tiktoken as a dependency in pyproject.toml by @JohanForngren in #5008
- fix: Fix provider string for AzureTokenProvider by @jackgerrits in #4992
- Split apart component infra to allow for abstract class integration by @jackgerrits in #5017
- Update version to 0.4.1 by @jackgerrits in #5029
- Fixup autogen-ext version by @jackgerrits in #5030
New Contributors
- @guinaut made their first contribution in #4982
- @timrogers made their first contribution in #4991
- @Programmer-RD-AI made their first contribution in #5013
- @SudhakarPunniyakotti made their first contribution in #5028
- @JohanForngren made their first contribution in #5008
Full Changelog: v0.4.0...v0.4.1