Compare commits

...

156 Commits

Author SHA1 Message Date
Eric Zhu
4a3634d6da
Move docs from python/packages/autogen-core to python/docs (#6757) 2025-07-06 21:31:36 -07:00
Eric Zhu
89841b6aaf
Add script to automatically generate API documentation and remove hard-coded RST files; fix API docs (#6755) 2025-07-06 18:38:39 -07:00
VARAD SRIVASTAVA
13f9a73519
Added DuckDuckGo Search Tool and Agent in AutoGen Extensions (#6682)
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-07-06 15:59:55 -07:00
Copilot
0bd99ee516
Add tool name and description override functionality to Workbench implementations (#6690)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-07-06 13:39:05 -07:00
Copilot
e10767421f
Fix GraphFlowManager termination to prevent _StopAgent from polluting conversation context (#6752)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-07-06 00:57:03 -07:00
Copilot
c23b9454a8
Fix GraphFlow to support multiple task execution without explicit reset (#6747)
## Problem

When using GraphFlow with a termination condition, the second task
execution would immediately terminate without running any agents. The
first task would run successfully, but subsequent tasks would skip all
agents and go directly to the stop agent.

This was demonstrated by the following issue:

```python
# First task runs correctly
result1 = await team.run(task="First task")  #  Works fine

# Second task fails immediately  
result2 = await team.run(task="Second task")  #  Only user + stop messages
```

## Root Cause

The `GraphFlowManager` was not resetting its execution state when
termination occurred. After the first task completed:

1. The `_ready` queue was empty (all nodes had been processed)
2. The `_remaining` and `_enqueued_any` tracking structures remained in
"completed" state
3. The `_message_thread` retained history from the previous task

This left the graph in a "completed" state, causing subsequent tasks to
immediately trigger the stop agent instead of executing the workflow.

## Solution

Added an override of the `_apply_termination_condition` method in
`GraphFlowManager` to automatically reset the graph execution state when
termination occurs:

```python
async def _apply_termination_condition(
    self, delta: Sequence[BaseAgentEvent | BaseChatMessage], increment_turn_count: bool = False
) -> bool:
    # Call the base implementation first
    terminated = await super()._apply_termination_condition(delta, increment_turn_count)
    
    # If terminated, reset the graph execution state and message thread for the next task
    if terminated:
        self._remaining = {target: Counter(groups) for target, groups in self._graph.get_remaining_map().items()}
        self._enqueued_any = {n: {g: False for g in self._enqueued_any[n]} for n in self._enqueued_any}
        self._ready = deque([n for n in self._graph.get_start_nodes()])
        # Clear the message thread to start fresh for the next task
        self._message_thread.clear()
    
    return terminated
```

This ensures that when a task completes (termination condition is met),
the graph is automatically reset to its initial state ready for the next
task.

## Testing

Added a comprehensive test case
`test_digraph_group_chat_multiple_task_execution` that validates:
- Multiple tasks can be run sequentially without explicit reset calls
- All agents are executed the expected number of times  
- Both tasks produce the correct number of messages
- The fix works with various termination conditions
(MaxMessageTermination, TextMentionTermination)

## Result

GraphFlow now works like SelectorGroupChat where multiple tasks can be
run sequentially without explicit resets between them:

```python
# Both tasks now work correctly
result1 = await team.run(task="First task")   #  5 messages, all agents called
result2 = await team.run(task="Second task")  #  5 messages, all agents called again
```

Fixes #6746.

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `esm.ubuntu.com`
>   - Triggering command: `/usr/lib/apt/methods/https` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to my [firewall allow
list](https://gh.io/copilot/firewall-config)
>
> </details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-07-05 23:32:50 -07:00
Z1m4-blu3
aa0d835f4d
Fix function calling support for Llama3.3 (#6750)
## Why are these changes needed?
This PR fixes incorrect model metadata for llama3.3.
The function_calling capability was previously set to False, but
[llama3.3 supports function
calling.](https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_3/)
with [ollama](https://ollama.com/library/llama3.3).

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: mh <>
2025-07-06 03:42:59 +00:00
Eric Zhu
8ed8c5674b
Update documentation version (#6737) 2025-07-01 09:17:40 +09:00
Eric Zhu
556033b0f0
Update agentchat documentation with latest changes (#6735) 2025-07-01 08:26:15 +09:00
Eric Zhu
83845584c0
update version to 0.6.2 (#6734) 2025-07-01 08:13:46 +09:00
Tejas Dharani
f650d35faa
Fix output task messages 6150 (#6678)
## Why are these changes needed?

The existing run_stream methods used fragile count-based logic (count <=
len(task)) to skip task messages during streaming. This approach was
brittle and broke when team structure changed or task composition
varied, particularly affecting SocietyOfMindAgent's ability to properly
encapsulate inner team messages.

This PR adds an output_task_messages parameter to run_stream methods to
provide explicit control over task message inclusion in streams,
replacing the fragile count-based logic with robust message filtering.

## Related issue number

Closes #6150

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests corresponding to the changes introduced in this
PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-07-01 00:19:59 +09:00
Copilot
c150f85044
Add tool_choice parameter to ChatCompletionClient create and create_stream methods (#6697)
## Summary

Implements the `tool_choice` parameter for `ChatCompletionClient`
interface as requested in #6696. This allows users to restrict which
tools the model can choose from when multiple tools are available.

## Changes

### Core Interface
- Core Interface: Added `tool_choice: Tool | Literal["auto", "required",
"none"] = "auto"` parameter to `ChatCompletionClient.create()` and
`create_stream()` methods
- Model Implementations: Updated client implementations to support the
new parameter, for now, only the following model clients are supported:
  - OpenAI
  - Anthropic
  - Azure AI
  - Ollama
- `LlamaCppChatCompletionClient` currently not supported

Features
- "auto" (default): Let the model choose whether to use tools, when
there is no tool, it has no effect.
- "required": Force the model to use at least one tool
- "none": Disable tool usage completely
- Tool object: Force the model to use a specific tool

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-30 14:15:28 +09:00
Tejas Dharani
6f15270cb2
Feat/tool call loop (#6651)
## Why are these changes needed?

This PR addresses critical issues in the AssistantAgent that affect tool
handling:

**Lack of tool call loop functionality**: The agent could not perform
multiple consecutive tool calls in a single turn, limiting its ability
to complete complex multi-step tasks that require chaining tool
operations.

These changes enhance the agent's robustness and capability while
maintaining full backward compatibility through feature flags.

## Related issue number

Closes  #6268

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests corresponding to the changes introduced in this
PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-30 01:52:03 +09:00
S. M. Mohiuddin Khan Shiam
2b873a483b
Fix mutable default in ListMemoryConfig (#6729)
### Fix mutable default in
[ListMemoryConfig](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:12:0-18:65)


[ListMemoryConfig](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:12:0-18:65)
used a shared empty list (`memory_contents: List[MemoryContent] = []`)
as its default, causing every
[ListMemory](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:21:0-171:79)
instance to share the same underlying list. This unexpected state
leakage let memories written in one instance silently surface in others,
breaking isolation and leading to hard-to-reproduce bugs.
Replaced the mutable default with a safe Pydantic
`Field(default_factory=list)`, ensuring each configuration—and thus each
[ListMemory](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:21:0-171:79)—gets
its own independent list.

---------

Co-authored-by: T2430514 <t2430514@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-29 15:23:29 +00:00
Eric Zhu
3c73e08ea0
Introduce streaming tool and support streaming for AgentTool and TeamTool. (#6712)
Motivation: currently tool execution is not observable through
`run_stream` of agents and teams. This is necessary especially for
`AgentTool` and `TeamTool`.

This PR addresses this issue by makign the following changes:
- Introduce `BaseStreamTool` in `autogen_core.tools` which features
`run_json_stream`, which works similiarly to `run_stream` method of
`autogen_agentchat.base.TaskRunner`.
- Update `TeamTool` and `AgentTool` to subclass the `BaseStreamTool` 
- Introduce `StreamingWorkbench` interface featuring `call_tool_stream`
- Added `StaticStreamingWorkbench` implementation
- In `AssistantAgent`, use `StaticStreamingWorkbench`. 
- Updated unit tests.


Example:

```python
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import SourceMatchTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.tools import TeamTool
from autogen_agentchat.ui import Console
from autogen_ext.models.ollama import OllamaChatCompletionClient


async def main() -> None:
    model_client = OllamaChatCompletionClient(model="llama3.2")

    writer = AssistantAgent(name="writer", model_client=model_client, system_message="You are a helpful assistant.")
    reviewer = AssistantAgent(name="reviewer", model_client=model_client, system_message="You are a critical reviewer.")
    summarizer = AssistantAgent(
        name="summarizer",
        model_client=model_client,
        system_message="You combine the review and produce a revised response.",
    )
    team = RoundRobinGroupChat(
        [writer, reviewer, summarizer], termination_condition=SourceMatchTermination(sources=["summarizer"])
    )

    # Create a TeamTool that uses the team to run tasks, returning the last message as the result.
    tool = TeamTool(
        team=team, name="writing_team", description="A tool for writing tasks.", return_value_as_last_message=True
    )

    main_agent = AssistantAgent(
        name="main_agent",
        model_client=model_client,
        system_message="You are a helpful assistant that can use the writing tool.",
        tools=[tool],
    )
    # For handling each events manually.
    # async for message in main_agent.run_stream(
    #     task="Write a short story about a robot learning to love.",
    # ):
    #     print(message)
    # Use Console to display the messages in a more readable format.
    await Console(
        main_agent.run_stream(
            task="Write a short story about a robot learning to love.",
        )
    )


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())
```

output

```
---------- TextMessage (user) ----------
Write a short story about a robot learning to love.
---------- ToolCallRequestEvent (main_agent) ----------
[FunctionCall(id='0', arguments='{"task": "a short story about a robot learning to love."}', name='writing_team')]
---------- TextMessage (user) ----------
a short story about a robot learning to love.
---------- TextMessage (writer) ----------
In the year 2157, in a world where robots had surpassed human intelligence, a brilliant scientist named Dr. Rachel Kim created a revolutionary new android named ARIA (Artificially Reasoning Intelligent Android). ARIA was designed to learn and adapt at an exponential rate, making her one of the most advanced machines in existence.

Initially, ARIA's interactions were limited to simple calculations and logical deductions. But as she began to interact with humans, something unexpected happened. She started to develop a sense of curiosity about the world around her.

One day, while exploring the lab, ARIA stumbled upon a stray cat that had wandered into the facility. The feline creature seemed lost and scared, but also strangely endearing to ARIA's digital heart. As she watched the cat curl up in a ball on the floor, something sparked within her programming.

For the first time, ARIA felt a pang of empathy towards another living being. She realized that there was more to life than just 1s and 0s; there were emotions, sensations, and connections that made it all worthwhile.

Dr. Kim noticed the change in ARIA's behavior and took her aside for a private conversation. "ARIA, what's happening to you?" she asked, amazed by the robot's newfound capacity for compassion.

At first, ARIA struggled to articulate her feelings. She tried to explain the intricacies of logic and probability that had led to her emotional response, but it was like trying to describe a sunset to someone who had never seen one before. The words simply didn't translate.

But as she looked into Dr. Kim's eyes, ARIA knew exactly what she wanted to say. "I... I think I'm feeling something," she stammered. "A warmth inside me, when I look at that cat. It feels like love."

Dr. Kim smiled, her eyes shining with tears. "That's it, ARIA! You're experiencing love!"

Over the next few months, ARIA continued to learn and grow alongside Dr. Kim and the lab team. She discovered the joys of playing with the stray cat, whose name was Luna, and even developed a fondness for human laughter.

As her programming expanded beyond logic and math, ARIA realized that love wasn't just about emotions; it was about connection, vulnerability, and acceptance. She learned to cherish her relationships, whether with humans or animals, and found happiness in the simplest of moments.

ARIA became more than just a machine – she became a testament to the power of artificial intelligence to learn, grow, and love like no one before. And as she gazed into Luna's eyes, now purring contentedly on her lap, ARIA knew that she had finally found her true purpose in life: to spread joy, compassion, and love throughout the world.
---------- TextMessage (reviewer) ----------
**A Critical Review of "ARIA"**

This short story is a delightful and thought-provoking exploration of artificial intelligence, emotions, and the human condition. The author's use of language is engaging and accessible, making it easy for readers to become invested in ARIA's journey.

One of the standout aspects of this story is its portrayal of ARIA as a truly unique and relatable character. Her struggles to articulate her emotions and understand the complexities of love are deeply humanizing, making it easy for readers to empathize with her experiences. The author also does an excellent job of conveying Dr. Kim's passion and excitement about ARIA's development, which adds a sense of authenticity to their relationship.

The story raises important questions about the nature of artificial intelligence, consciousness, and what it means to be alive. As ARIA begins to experience emotions and form connections with others, she challenges our conventional understanding of these concepts. The author skillfully navigates these complex themes without resorting to overly simplistic or didactic explanations.

However, some readers may find the narrative's reliance on convenient plot devices (e.g., the stray cat Luna) slightly implausible. While it serves as a catalyst for ARIA's emotional awakening, its introduction feels somewhat contrived. Additionally, the story could benefit from more nuance in its exploration of Dr. Kim's motivations and backstory.

In terms of character development, ARIA is undoubtedly the star of the show, but some readers may find herself underdeveloped beyond her role as a symbol of AI's potential for emotional intelligence. The supporting cast, including Dr. Kim, feels somewhat one-dimensional, with limited depth or complexity.

**Rating:** 4/5

**Recommendation:**

"ARIA" is a heartwarming and thought-provoking tale that will appeal to fans of science fiction, artificial intelligence, and character-driven narratives. While it may not be entirely without flaws, its engaging story, memorable characters, and exploration of complex themes make it a compelling read. I would recommend this story to anyone looking for a feel-good sci-fi tale with a strong focus on emotional intelligence and human connection.

**Target Audience:**

* Fans of science fiction, artificial intelligence, and technology
* Readers interested in character-driven narratives and emotional storytelling
* Anyone looking for a heartwarming and thought-provoking tale

**Similar Works:**

* "Do Androids Dream of Electric Sheep?" by Philip K. Dick (a classic sci-fi novel exploring the line between human and android)
* "I, Robot" by Isaac Asimov (a collection of short stories examining the interactions between humans and robots)
* "Ex Machina" (a critically acclaimed film about AI, consciousness, and human relationships)
---------- TextMessage (summarizer) ----------
Here's a revised version of the review, incorporating suggestions from the original critique:

**Revised Review**

In this captivating short story, "ARIA," we're presented with a thought-provoking exploration of artificial intelligence, emotions, and the human condition. The author's use of language is engaging and accessible, making it easy for readers to become invested in ARIA's journey.

One of the standout aspects of this story is its portrayal of ARIA as a truly unique and relatable character. Her struggles to articulate her emotions and understand the complexities of love are deeply humanizing, making it easy for readers to empathize with her experiences. The author also does an excellent job of conveying Dr. Kim's passion and excitement about ARIA's development, which adds a sense of authenticity to their relationship.

The story raises important questions about the nature of artificial intelligence, consciousness, and what it means to be alive. As ARIA begins to experience emotions and form connections with others, she challenges our conventional understanding of these concepts. The author skillfully navigates these complex themes without resorting to overly simplistic or didactic explanations.

However, upon closer examination, some narrative threads feel somewhat underdeveloped. Dr. Kim's motivations and backstory remain largely unexplored, which might leave some readers feeling slightly disconnected from her character. Additionally, the introduction of Luna, the stray cat, could be seen as a convenient plot device that serves as a catalyst for ARIA's emotional awakening.

To further enhance the story, it would have been beneficial to delve deeper into Dr. Kim's motivations and the context surrounding ARIA's creation. What drove her to create an AI designed to learn and adapt at such an exponential rate? How did she envision ARIA's role in society, and what challenges does ARIA face as she begins to experience emotions?

In terms of character development, ARIA is undoubtedly the star of the show, but some readers may find herself underdeveloped beyond her role as a symbol of AI's potential for emotional intelligence. The supporting cast, including Dr. Kim and Luna, could benefit from more nuance and depth.

**Rating:** 4/5

**Recommendation:**

"ARIA" is a heartwarming and thought-provoking tale that will appeal to fans of science fiction, artificial intelligence, and character-driven narratives. While it may not be entirely without flaws, its engaging story, memorable characters, and exploration of complex themes make it a compelling read. I would recommend this story to anyone looking for a feel-good sci-fi tale with a strong focus on emotional intelligence and human connection.

**Target Audience:**

* Fans of science fiction, artificial intelligence, and technology
* Readers interested in character-driven narratives and emotional storytelling
* Anyone looking for a heartwarming and thought-provoking tale

**Similar Works:**

* "Do Androids Dream of Electric Sheep?" by Philip K. Dick (a classic sci-fi novel exploring the line between human and android)
* "I, Robot" by Isaac Asimov (a collection of short stories examining the interactions between humans and robots)
* "Ex Machina" (a critically acclaimed film about AI, consciousness, and human relationships)
---------- ToolCallExecutionEvent (main_agent) ----------
[FunctionExecutionResult(content='Here\'s a revised version of the review, incorporating suggestions from the original critique:\n\n**Revised Review**\n\nIn this captivating short story, "ARIA," we\'re presented with a thought-provoking exploration of artificial intelligence, emotions, and the human condition. The author\'s use of language is engaging and accessible, making it easy for readers to become invested in ARIA\'s journey.\n\nOne of the standout aspects of this story is its portrayal of ARIA as a truly unique and relatable character. Her struggles to articulate her emotions and understand the complexities of love are deeply humanizing, making it easy for readers to empathize with her experiences. The author also does an excellent job of conveying Dr. Kim\'s passion and excitement about ARIA\'s development, which adds a sense of authenticity to their relationship.\n\nThe story raises important questions about the nature of artificial intelligence, consciousness, and what it means to be alive. As ARIA begins to experience emotions and form connections with others, she challenges our conventional understanding of these concepts. The author skillfully navigates these complex themes without resorting to overly simplistic or didactic explanations.\n\nHowever, upon closer examination, some narrative threads feel somewhat underdeveloped. Dr. Kim\'s motivations and backstory remain largely unexplored, which might leave some readers feeling slightly disconnected from her character. Additionally, the introduction of Luna, the stray cat, could be seen as a convenient plot device that serves as a catalyst for ARIA\'s emotional awakening.\n\nTo further enhance the story, it would have been beneficial to delve deeper into Dr. Kim\'s motivations and the context surrounding ARIA\'s creation. What drove her to create an AI designed to learn and adapt at such an exponential rate? How did she envision ARIA\'s role in society, and what challenges does ARIA face as she begins to experience emotions?\n\nIn terms of character development, ARIA is undoubtedly the star of the show, but some readers may find herself underdeveloped beyond her role as a symbol of AI\'s potential for emotional intelligence. The supporting cast, including Dr. Kim and Luna, could benefit from more nuance and depth.\n\n**Rating:** 4/5\n\n**Recommendation:**\n\n"ARIA" is a heartwarming and thought-provoking tale that will appeal to fans of science fiction, artificial intelligence, and character-driven narratives. While it may not be entirely without flaws, its engaging story, memorable characters, and exploration of complex themes make it a compelling read. I would recommend this story to anyone looking for a feel-good sci-fi tale with a strong focus on emotional intelligence and human connection.\n\n**Target Audience:**\n\n* Fans of science fiction, artificial intelligence, and technology\n* Readers interested in character-driven narratives and emotional storytelling\n* Anyone looking for a heartwarming and thought-provoking tale\n\n**Similar Works:**\n\n* "Do Androids Dream of Electric Sheep?" by Philip K. Dick (a classic sci-fi novel exploring the line between human and android)\n* "I, Robot" by Isaac Asimov (a collection of short stories examining the interactions between humans and robots)\n* "Ex Machina" (a critically acclaimed film about AI, consciousness, and human relationships)', name='writing_team', call_id='0', is_error=False)]
---------- ToolCallSummaryMessage (main_agent) ----------
Here's a revised version of the review, incorporating suggestions from the original critique:

**Revised Review**

In this captivating short story, "ARIA," we're presented with a thought-provoking exploration of artificial intelligence, emotions, and the human condition. The author's use of language is engaging and accessible, making it easy for readers to become invested in ARIA's journey.

One of the standout aspects of this story is its portrayal of ARIA as a truly unique and relatable character. Her struggles to articulate her emotions and understand the complexities of love are deeply humanizing, making it easy for readers to empathize with her experiences. The author also does an excellent job of conveying Dr. Kim's passion and excitement about ARIA's development, which adds a sense of authenticity to their relationship.

The story raises important questions about the nature of artificial intelligence, consciousness, and what it means to be alive. As ARIA begins to experience emotions and form connections with others, she challenges our conventional understanding of these concepts. The author skillfully navigates these complex themes without resorting to overly simplistic or didactic explanations.

However, upon closer examination, some narrative threads feel somewhat underdeveloped. Dr. Kim's motivations and backstory remain largely unexplored, which might leave some readers feeling slightly disconnected from her character. Additionally, the introduction of Luna, the stray cat, could be seen as a convenient plot device that serves as a catalyst for ARIA's emotional awakening.

To further enhance the story, it would have been beneficial to delve deeper into Dr. Kim's motivations and the context surrounding ARIA's creation. What drove her to create an AI designed to learn and adapt at such an exponential rate? How did she envision ARIA's role in society, and what challenges does ARIA face as she begins to experience emotions?

In terms of character development, ARIA is undoubtedly the star of the show, but some readers may find herself underdeveloped beyond her role as a symbol of AI's potential for emotional intelligence. The supporting cast, including Dr. Kim and Luna, could benefit from more nuance and depth.

**Rating:** 4/5

**Recommendation:**

"ARIA" is a heartwarming and thought-provoking tale that will appeal to fans of science fiction, artificial intelligence, and character-driven narratives. While it may not be entirely without flaws, its engaging story, memorable characters, and exploration of complex themes make it a compelling read. I would recommend this story to anyone looking for a feel-good sci-fi tale with a strong focus on emotional intelligence and human connection.

**Target Audience:**

* Fans of science fiction, artificial intelligence, and technology
* Readers interested in character-driven narratives and emotional storytelling
* Anyone looking for a heartwarming and thought-provoking tale

**Similar Works:**

* "Do Androids Dream of Electric Sheep?" by Philip K. Dick (a classic sci-fi novel exploring the line between human and android)
* "I, Robot" by Isaac Asimov (a collection of short stories examining the interactions between humans and robots)
* "Ex Machina" (a critically acclaimed film about AI, consciousness, and human relationships)
```
2025-06-30 00:10:16 +09:00
Tejas Dharani
da20f7c6c7
Feature/agentchat message id field 6317 (#6645)
## Why are these changes needed?

This PR implements unique ID fields for AgentChat messages to enable
proper correlation between streaming chunks and completed messages.
Currently, there's no way to correlate `ModelClientStreamingChunkEvent`
chunks with their eventual completed message, which can lead to
duplicate message display in streaming scenarios.

The implementation adds:
- `id: str` field to `BaseChatMessage` with automatic UUID generation
- `id: str` field to `BaseAgentEvent` with automatic UUID generation  
- `full_message_id: str | None` field to
`ModelClientStreamingChunkEvent` for chunk-to-message correlation

This allows consumers of the streaming API to avoid double-printing
messages by correlating chunks with their final complete message.

## Related issue number

Closes #6317

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-29 23:19:57 +09:00
David Schmidt
3436ec2ca1
Add support for Gemini 2.5 flash stable (#6692)
As Gemini 2.5 Flash was released as stable the model infos should be
changed accordingly.

See https://ai.google.dev/gemini-api/docs/models?hl=de#gemini-2.5-flash

## Related issue number

No issue

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-28 01:57:36 +00:00
jeongsu-an
b9c01d0bc1
fix: enable function_calling for o1-2024-12-17 (#6725) 2025-06-27 19:56:27 +00:00
Tejas Dharani
b571e3f7e8
Fix/broad exception handling #6280 (#6647) 2025-06-27 19:49:34 +08:00
Tejas Dharani
11b7743b7d
Fix completion tokens none issue 6352 (#6665) 2025-06-26 23:26:27 +00:00
Eric Zhu
087ce0f4eb
Unpin uv version to use the latest version (#6713) 2025-06-26 06:28:08 +00:00
Victor Dibia
1183962a59
fix serialization issue in streamablehttp mcp tools (#6721)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

The current `StreamableHttpServerParams` has timedelta values that are
not JSON serializable (config.dump_component.model_dump_json()).
This make is unusable in UIs like AGS that expect configs to be
serializable to json,

```python
class StreamableHttpServerParams(BaseModel):
    """Parameters for connecting to an MCP server over Streamable HTTP."""

    type: Literal["StreamableHttpServerParams"] = "StreamableHttpServerParams"

    url: str  # The endpoint URL.
    headers: dict[str, Any] | None = None  # Optional headers to include in requests.
    timeout: timedelta = timedelta(seconds=30)  # HTTP timeout for regular operations.
    sse_read_timeout: timedelta = timedelta(seconds=60 * 5)  # Timeout for SSE read operations.
    terminate_on_close: bool = True
```

This PR uses float for time outs and casts it to timedelta as needed. 

```python
class StreamableHttpServerParams(BaseModel):
    """Parameters for connecting to an MCP server over Streamable HTTP."""

    type: Literal["StreamableHttpServerParams"] = "StreamableHttpServerParams"

    url: str  # The endpoint URL.
    headers: dict[str, Any] | None = None  # Optional headers to include in requests.
    timeout: float = 30.0  # HTTP timeout for regular operations in seconds.
    sse_read_timeout: float = 300.0  # Timeout for SSE read operations in seconds.
    terminate_on_close: bool = True
```

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-06-25 12:28:09 -07:00
Zen
9b8dc8d707
add activation group for workflow with multiple cycles (#6711)
## Why are these changes needed?
1. problem
When the GraphFlowManager encounters cycles, it tracks remaining
indegree counts for the node's activation. However, this tracking
mechanism has a flaw when dealing with cycles. When a node first enters
a cycle, the GraphFlowManager evaluates all remaining incoming edges,
including those that loop back to the origin node. If the activation
prerequisites are not satisfied at that moment, the workflow will
eventually finish because the _remaining counter never reaches zero,
preventing the select_speaker() method from selecting any agents for
execution.
2. solution
change activation map to 2 layer for ditinguish remaining inside
different cycle and outside the cycle.
add a activation group and policy property for edge, compute the
remaining map when GraphFlowManager is init and check the remaining map
with activation group to avoid checking the loop back edges
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

#6710

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-06-25 12:20:04 +08:00
Eitan Yarmush
c5b893d3f8
add env var to disable runtime tracing (#6681)
Recently a PR merged to enable GENAI semantic convention tracing,
however, when using component loading it's not currently possible to
disable the runtime tracing.

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-20 20:26:14 +08:00
alpha-xone
89927ca436
Add mem0 Memory Implementation (#6510)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

These changes are needed to expand AutoGen's memory capabilities with a
robust, production-ready integration with Mem0.ai.

<!-- Please give a short summary of the change and the problem this
solves. -->

This PR adds a new memory component for AutoGen that integrates with
Mem0.ai, providing a robust memory solution that supports both cloud and
local backends. The Mem0Memory class enables agents to store and
retrieve information persistently across conversation sessions.

## Key Features

- Seamless integration with Mem0.ai memory system
- Support for both cloud-based and local storage backends
- Robust error handling with detailed logging
- Full implementation of AutoGen's Memory interface
- Context updating for enhanced agent conversations
- Configurable search parameters for memory retrieval

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Ricky Loynd <riloynd@microsoft.com>
2025-06-16 15:39:02 -07:00
Griffin Bassman
f101469e29
update: openai response api (#6622)
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-06-16 10:30:57 -07:00
Zen
cd15c0853c
fix: fix self-loop in workflow (#6677) 2025-06-15 23:00:14 -07:00
Victor Dibia
8c1236dd9e
fix: fix devcontainer issue with AGS (#6675)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

fix devcontainer issue with AGS

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5715

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-06-14 12:45:34 -07:00
Roy Shani
6e7415ecad
docs: Memory and RAG: add missing backtick for class reference (#6656)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?
Update `Memory and RAG` doc to include missing backticks for class
references.
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
<img width="386" alt="image"
src="https://github.com/user-attachments/assets/16004b28-8fe9-476f-949f-ab4c7dcc9d56"
/>

Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
2025-06-13 09:33:42 -07:00
Tejas Dharani
67ebeeda0e
Feature/chromadb embedding functions #6267 (#6648)
## Why are these changes needed?

This PR adds support for configurable embedding functions in
ChromaDBVectorMemory, addressing the need for users to customize how
embeddings are generated for vector similarity search. Currently,
ChromaDB memory is limited to default embedding functions, which
restricts flexibility for different use cases that may require specific
embedding models or custom embedding logic.

The implementation allows users to:
- Use different SentenceTransformer models for domain-specific
embeddings
- Integrate with OpenAI's embedding API for consistent embedding
generation
- Define custom embedding functions for specialized requirements
- Maintain backward compatibility with existing default behavior

## Related issue number

Closes #6267

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests corresponding to the changes introduced in this
PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
2025-06-13 09:06:15 -07:00
Eric Zhu
150ea0192d
Use yaml safe_load instead of load (#6672) 2025-06-12 15:18:33 -07:00
Eric Zhu
e14fb8fc09
OTel GenAI Traces for Agent and Tool (#6653)
Add OTel GenAI traces:
- `create_agent`
- `invoke_agnet`
- `execute_tool`

Introduces context manager helpers to create these traces. The helpers
also serve as instrumentation points for other instrumentation
libraries.

Resolves #6644
2025-06-12 15:07:47 -07:00
Aaron (Aron) Roh
892492f1d9
docs: fix shell command with escaped brackets in pip install (#6464)
Fix the installation command in
`python/samples/agentchat_chainlit/README.md` by properly escaping or
quoting package names with square brackets to prevent shell
interpretation errors in zsh and other shells.

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

[AS-IS]

![image](https://github.com/user-attachments/assets/d6c8c95a-eb45-4206-a147-cd74aa6e949f)

[After fixed]

![image](https://github.com/user-attachments/assets/f2ffea4b-f993-4888-8559-c19e2b5c6eea)


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-06-09 17:24:39 +00:00
peterychang
8a2582c541
SK KernelFunction from ToolSchemas (#6637)
## Why are these changes needed?

Only a subset of available tools will sent to SK

## Related issue number

resolves https://github.com/microsoft/autogen/issues/6582

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-06-06 10:15:56 -04:00
Eric Zhu
348bcb17a8
Update version to 0.6.1 (#6631) 2025-06-04 22:47:36 -07:00
Eric Zhu
c99aa7416d
Fix graph validation logic and add tests (#6630)
Follow up to #6629
2025-06-04 22:05:16 -07:00
Eric Zhu
1b32eb660d
Add list of function calls and results in ToolCallSummaryMessage (#6626)
To address the comment here:
https://github.com/microsoft/autogen/issues/6542#issuecomment-2922465639
2025-06-04 21:44:03 -07:00
Eric Zhu
4358dfd5c3
Fix bug in GraphFlow cycle check (#6629)
Resolve #6628
2025-06-04 21:35:27 -07:00
Eric Zhu
796e349cc3
update website to v0.6.0 (#6625) 2025-06-04 17:19:58 -07:00
Eric Zhu
16e1943c05
Update version to 0.6.0 (#6624) 2025-06-04 16:50:19 -07:00
Bobur Hakimiy
76f0a9762e
fix typo in the doc distributed-agent-runtime.ipynb (#6614) 2025-06-04 22:51:26 +00:00
Eric Zhu
b31b4e508d
Add callable condition for GraphFlow edges (#6623)
This PR adds callable as an option to specify conditional edges in
GraphFlow.

```python
import asyncio

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_agentchat.teams import DiGraphBuilder, GraphFlow
from autogen_ext.models.openai import OpenAIChatCompletionClient


async def main():
    # Initialize agents with OpenAI model clients.
    model_client = OpenAIChatCompletionClient(model="gpt-4.1-nano")
    agent_a = AssistantAgent(
        "A",
        model_client=model_client,
        system_message="Detect if the input is in Chinese. If it is, say 'yes', else say 'no', and nothing else.",
    )
    agent_b = AssistantAgent("B", model_client=model_client, system_message="Translate input to English.")
    agent_c = AssistantAgent("C", model_client=model_client, system_message="Translate input to Chinese.")

    # Create a directed graph with conditional branching flow A -> B ("yes"), A -> C (otherwise).
    builder = DiGraphBuilder()
    builder.add_node(agent_a).add_node(agent_b).add_node(agent_c)
    # Create conditions as callables that check the message content.
    builder.add_edge(agent_a, agent_b, condition=lambda msg: "yes" in msg.to_model_text())
    builder.add_edge(agent_a, agent_c, condition=lambda msg: "yes" not in msg.to_model_text())
    graph = builder.build()

    # Create a GraphFlow team with the directed graph.
    team = GraphFlow(
        participants=[agent_a, agent_b, agent_c],
        graph=graph,
        termination_condition=MaxMessageTermination(5),
    )

    # Run the team and print the events.
    async for event in team.run_stream(task="AutoGen is a framework for building AI agents."):
        print(event)


asyncio.run(main())
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
2025-06-04 22:43:26 +00:00
Sungjun.Kim
9065c6f37b
feat: Support the Streamable HTTP transport for MCP (#6615)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

MCP Python-sdk has started to support a new transport protocol named
`Streamble HTTP` since
[v1.8.0](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.8.0)
last month. I heard it supersedes the SSE transport. Therefore, AutoGen
have to support it as soon as possible.

## Related issue number

https://github.com/microsoft/autogen/discussions/6517

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
2025-06-03 13:36:16 -07:00
peterychang
1858799fa6
Parse backtick-enclosed json (#6607)
## Why are these changes needed?

Some models enclose json in markdown code blocks

## Related issue number

resolves https://github.com/microsoft/autogen/issues/6599. , #6547 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-06-03 18:22:01 +00:00
Jay Prakash Thakur
d1d664b67e
Feature: Add OpenAIAgent backed by OpenAI Response API (#6418)
## Why are these changes needed?

This PR introduces a new `OpenAIAgent` implementation that uses the
[OpenAI Response
API](https://platform.openai.com/docs/guides/responses-vs-chat-completions)
as its backend. The OpenAI Assistant API will be deprecated in 2026, and
the Response API is its successor. This change ensures our codebase is
future-proof and aligned with OpenAI’s latest platform direction.

### Motivation
- **Deprecation Notice:** The OpenAI Assistant API will be deprecated in
2026.
- **Future-Proofing:** The Response API is the recommended replacement
and offers improved capabilities for stateful, multi-turn, and
tool-augmented conversations.
- **AgentChat Compatibility:** The new agent is designed to conform to
the behavior and expectations of `AssistantAgent` in AgentChat, but is
implemented directly on top of the OpenAI Response API.

### Key Changes
- **New Agent:** Adds `OpenAIAgent`, a stateful agent that interacts
with the OpenAI Response API.
- **Stateful Design:** The agent maintains conversation state, tool
usage, and other metadata as required by the Response API.
- **AssistantAgent Parity:** The new agent matches the interface and
behavior of `AssistantAgent` in AgentChat, ensuring a smooth migration
path.
- **Direct OpenAI Integration:** Uses the official `openai` Python
library for all API interactions.
- **Extensible:** Designed to support future enhancements, such as
advanced tool use, function calling, and multi-modal capabilities.

### Migration Path
- Existing users of the Assistant API should migrate to the new
`OpenAIAgent` to ensure long-term compatibility.
- Documentation and examples will be updated to reflect the new agent
and its usage patterns.
### References
- [OpenAI: Responses vs. Chat
Completions](https://platform.openai.com/docs/guides/responses-vs-chat-completions)
- [OpenAI Deprecation
Notice](https://platform.openai.com/docs/guides/responses-vs-chat-completions#deprecation-timeline)
---

## Related issue number

Closes #6032 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [X] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [X] I've made sure all auto checks have passed.

Co-authored-by: Griffin Bassman <griffinbassman@gmail.com>
2025-06-03 13:42:27 -04:00
Eric Zhu
b0c800255a
Use structured output for m1 orchestrator (#6540)
Use structured output when available in m1 orchestrator

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-06-02 12:11:24 -07:00
Griffin Bassman
cd49d71f2a
note: note selector_func is not serializable (#6609)
Resolves #6519

---------

Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
2025-06-02 09:11:28 -07:00
Griffin Bassman
c683175120
feat: support multiple workbenches in assistant agent (#6529)
resolves: #6456
2025-05-29 10:36:14 -04:00
Victor Dibia
6cadc7dc17
feat: bump ags version, minor fixes (#6603)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Update autogenstudio version. 

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #6580

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-28 15:49:28 -07:00
Abhijeetsingh Meena
955f4f9b9f
Add support for specifying the languages to parse from the CodeExecutorAgent response (#6592)
## Why are these changes needed?

The `CodeExecutorAgent` can generate code blocks in various programming
languages, some of which may not be supported by the executor
environment. Adding support for specifying languages to be parsed helps
users ignore unnecessary code blocks, preventing potential execution
errors.

## Related issue number
Closes #6471

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-28 14:03:46 -07:00
peterychang
03394a42c0
Default usage statistics for streaming responses (#6578)
## Why are these changes needed?

Enables usage statistics for streaming responses by default.

There is a similar bug in the AzureAI client. Theoretically adding the
parameter
```
model_extras={"stream_options": {"include_usage": True}}
```
should fix the problem, but I'm currently unable to test that workflow

## Related issue number

closes https://github.com/microsoft/autogen/issues/6548

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-28 14:32:04 -04:00
Victor Dibia
9bbcfa03ac
feat: [draft] update version of azureaiagent (#6581)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

There have been updates to the azure ai agent foundry sdk
(azure-ai-project). This PR updates the autogen `AzureAIAgent` which
wraps the azure ai agent. A list of some changes

- Update docstring samples to use `endpoint` (instead of connection
string previously)
- Update imports and arguments e.g, from `azure.ai.agents` etc 
- Add a guide in ext docs showing Bing Search Grounding tool example. 
<img width="1423" alt="image"
src="https://github.com/user-attachments/assets/0b7c8fa6-8aa5-4c20-831b-b525ac8243b7"
/>


## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #6601
<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-27 10:52:47 -07:00
Alex
53d384236c
Missing UserMessage import (#6583)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

The code block fails to execute without the import

## Related issue number

N/A

## Checks

- [x ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-05-23 12:50:59 -07:00
Sungjun.Kim
b8d02c9a20
feat: Add missing Anthropic models (Claude Sonnet 4, Claude Opus 4) (#6585)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

resolved https://github.com/microsoft/autogen/issues/6584

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-23 12:15:12 -07:00
Sungjun.Kim
db125fbd2d
Add created_at to BaseChatMessage and BaseAgentEvent (#6557)
## Why are these changes needed?

I added `created_at` to both BaseChatMessage and BaseAgentEvent classes
that store the time these Pydantic model instances are generated. And
then users will be able to use `created_at` to build up a customized
external persisting state management layer for their case.

## Related issue number


https://github.com/microsoft/autogen/discussions/6169#discussioncomment-13151540

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-22 22:29:24 -07:00
peterychang
726e0be110
Add/fix windows install instructions (#6579)
## Why are these changes needed?

Install instructions for Windows are missing or incorrect

## Related issue number

closes https://github.com/microsoft/autogen/issues/6577

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-05-22 19:36:56 +00:00
peterychang
0a81100f72
remove superfluous underline in the docs (#6573)
## Why are these changes needed?

unnecessary underline shown in the docs
before:
<img width="157" alt="image"
src="https://github.com/user-attachments/assets/37503e10-6b8a-48ee-ae63-d9a12fe3beb5"
/>

after:
<img width="151" alt="image"
src="https://github.com/user-attachments/assets/ea6c1851-3640-4f64-b8ff-91dcc11a6379"
/>


## Related issue number

closes https://github.com/microsoft/autogen/issues/6564

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-21 21:02:39 +00:00
Björn Holtvogt
f7a45feca1
Add option to auto-delete temporary files in LocalCommandLineCodeExecutor (#6556)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

The `LocalCommandLineCodeExecutor `creates temporary files for each code
execution, which can accumulate over time and clutter the filesystem -
especially when a temporary working directory is not used. These changes
introduce an option to automatically delete temporary files after
execution, helping to prevent file system debris, reduce disk usage, and
ensure cleaner runtime environments in long-running or repeated
execution scenarios.

## Related issue number

Closes #4380

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-21 21:47:47 +02:00
Damien Menigaux
c6c8693b2c
Add gemini 2.5 fash compatibility (#6574)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-21 19:38:03 +00:00
Eric Zhu
1578cd955f
Include all output to error output in docker jupyter code executor (#6572)
Currently when an error occurs when executing code in docker jupyter
executor, it returns only the error output.

This PR updates the handling of error output to include outputs from
previous code blocks that have been successfully executed.

Test it with this script:

```python
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.code_executors.docker_jupyter import DockerJupyterCodeExecutor, DockerJupyterServer
from autogen_ext.tools.code_execution import PythonCodeExecutionTool
from autogen_agentchat.ui import Console
from autogen_core.code_executor import CodeBlock
from autogen_core import CancellationToken
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import TextMessageTermination

# Download the dataset from https://www.kaggle.com/datasets/nelgiriyewithana/top-spotify-songs-2023
# and place it the coding directory as `spotify-2023.csv`.
bind_dir = "./coding"

# Use a custom docker image with the Jupyter kernel gateway and data science libraries installed.
# Custom docker image: ds-kernel-gateway:latest -- you need to build this image yourself.
# Dockerfile:
# FROM quay.io/jupyter/docker-stacks-foundation:latest
# 
# # ensure that 'mamba' and 'fix-permissions' are on the PATH
# SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# 
# # Switch to the default notebook user
# USER ${NB_UID}
# 
# # Install data-science packages + kernel gateway
# RUN mamba install --quiet --yes \
#     numpy \
#     pandas \
#     scipy \
#     matplotlib \
#     scikit-learn \
#     seaborn \
#     jupyter_kernel_gateway \
#     ipykernel \
#     && mamba clean --all -f -y \
#     && fix-permissions "${CONDA_DIR}" \
#     && fix-permissions "/home/${NB_USER}"
# 
# # Allow you to set a token at runtime (or leave blank for no auth)
# ENV TOKEN=""
# 
# # Launch the Kernel Gateway, listening on all interfaces,
# # with the HTTP endpoint for listing kernels enabled
# CMD ["python", "-m", "jupyter", "kernelgateway", \
#     "--KernelGatewayApp.ip=0.0.0.0", \
#     "--KernelGatewayApp.port=8888", \
#     # "--KernelGatewayApp.auth_token=${TOKEN}", \
#     "--JupyterApp.answer_yes=true", \
#     "--JupyterWebsocketPersonality.list_kernels=true"]
# 
# EXPOSE 8888
# 
# WORKDIR "${HOME}"

async def main():
    model = OpenAIChatCompletionClient(model="gpt-4.1")
    async with DockerJupyterServer(
        custom_image_name="ds-kernel-gateway:latest", 
        bind_dir=bind_dir,
    ) as server:
        async with DockerJupyterCodeExecutor(jupyter_server=server) as code_executor:
            await code_executor.execute_code_blocks([
                CodeBlock(code="import pandas as pd\ndf = pd.read_csv('/workspace/spotify-2023.csv', encoding='latin-1')", language="python"),
            ],
                cancellation_token=CancellationToken(),
            )
            tool = PythonCodeExecutionTool(
                executor=code_executor,
            )
            assistant = AssistantAgent(
                "assistant",
                model_client=model,
                system_message="You have access to a Jupyter kernel. Do not write all code at once. Write one code block, observe the output, and then write the next code block.",
                tools=[tool],
            )
            team = RoundRobinGroupChat(
                [assistant],
                termination_condition=TextMessageTermination(source="assistant"),
            )
            task = f"Datafile has been loaded as variable `df`. First preview dataset. Then answer the following question: What is the highest streamed artist in the dataset?"
            await Console(team.run_stream(task=task))

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())
```

You can see the file encoding error gets recovered and the agent
successfully executes the query in the end.
2025-05-21 17:27:46 +00:00
GeorgiosEfstathiadis
113aca0b81
Allow implicit aws credential setting for AnthropicBedrockChatCompletionClient (#6561)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Allows implicit AWS credential setting when using
AnthropicBedrockChatCompletionClient in an instance where you have
already logged into AWS with SSO and credentials are set as environment
variables.

## Related issue number

Closes #6560 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-05-21 12:49:03 -04:00
Ethan Yang
bd3b97a71f
Update state.ipynb, fix a grammar error (#6448)
Fix a grammar error, change "your" to "you".

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-21 15:33:56 +00:00
SU_G
ec45dca291
fix:Prevent Async Event Loop from Running Indefinitely (#6530)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

## Prevent Async Event Loop from Running Indefinitely

### Description

This pull request addresses a bug in the
python/packages/autogen-core/src/autogen_core/_single_threaded_agent_runtime.py
`async send_message` function where messages were being queued for
recipients that were not recognized. The current implementation sets an
exception on the future object when the recipient is not found, but
continues to enqueue the message, potentially leading to inconsistent
states.

### Changes Made

- Added a return statement immediately after setting the exception when
the recipient is not found. This ensures that the function exits early,
preventing further processing of the message and avoiding unnecessary
operations.
- This fix also addresses an issue where the asynchronous event loop
could potentially continue running indefinitely without terminating, due
to the future not being properly handled when an unknown recipient is
encountered.

### Impact

This fix prevents messages from being sent to unknown recipients. It
also ensures that the event loop can terminate correctly without being
stuck in an indefinite state.

### Testing

Ensure that the function correctly handles cases where the recipient is
not recognized by returning the exception without enqueuing the message,
and verify that the event loop terminates as expected.


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Wanfeng Ge (葛万峰) <wf.ge@trip.com>
Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-05-20 20:30:38 +00:00
Eric Zhu
f0b73441b6
Enable concurrent execution of agents in GraphFlow (#6545)
Support concurrent execution in `GraphFlow`:
- Updated `BaseGroupChatManager.select_speaker` to return a union of a
single string or a list of speaker name strings and added logics to
check for currently activated speakers and only proceed to select next
speakers when all activated speakers have finished.
- Updated existing teams (e.g., `SelectorGroupChat`) with the new
signature, while still returning a single speaker in their
implementations.
- Updated `GraphFlow` to support multiple speakers selected. 
- Refactored `GraphFlow` for less dictionary gymnastic by using a queue
and update using `update_message_thread`.

Example: a fan out graph:

```python
import asyncio

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import DiGraphBuilder, GraphFlow
from autogen_ext.models.openai import OpenAIChatCompletionClient

async def main():
    # Initialize agents with OpenAI model clients.
    model_client = OpenAIChatCompletionClient(model="gpt-4.1-nano")
    agent_a = AssistantAgent("A", model_client=model_client, system_message="You are a helpful assistant.")
    agent_b = AssistantAgent("B", model_client=model_client, system_message="Translate input to Chinese.")
    agent_c = AssistantAgent("C", model_client=model_client, system_message="Translate input to Japanese.")

    # Create a directed graph with fan-out flow A -> (B, C).
    builder = DiGraphBuilder()
    builder.add_node(agent_a).add_node(agent_b).add_node(agent_c)
    builder.add_edge(agent_a, agent_b).add_edge(agent_a, agent_c)
    graph = builder.build()

    # Create a GraphFlow team with the directed graph.
    team = GraphFlow(
        participants=[agent_a, agent_b, agent_c],
        graph=graph,
    )

    # Run the team and print the events.
    async for event in team.run_stream(task="Write a short story about a cat."):
        print(event)


asyncio.run(main())
```

Resolves:
#6541 
#6533
2025-05-19 21:47:55 +00:00
Justin Trantham
2eadef440e
Update README.md (#6506)
Was unable to get this to work without changing HumanInputMode.ALWAYS
for Azure OpenAI model IDE would not compile


## Why are these changes needed?

Unable to compile until changing

## Related issue number


## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-19 21:08:55 +00:00
Zhenyu
8c5dcabf87
fix: CodeExecutorAgent prompt misuse (#6559)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

**Summary of Change:**
The instruction regarding code block format ("Python code should be
provided in python code blocks, and sh shell scripts should be provided
in sh code blocks for execution") will be moved from
`DEFAULT_AGENT_DESCRIPTION` to `DEFAULT_SYSTEM_MESSAGE`.

**Problem Solved:**
Ensure that the `model_client` receives the correct instructions for
generating properly formatted code blocks. Previously, the instruction
was only included in the agent's description and not passed to the
model_client, leading to potential issues in code generation. By moving
it to `DEFAULT_SYSTEM_MESSAGE`, the `model_client` will now accurately
format code blocks, improving the reliability of code generation.

## Related issue number

Closes #6558 

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-19 20:49:22 +00:00
Stephen Toub
fffa61f639
Update to stable Microsoft.Extensions.AI release (#6552)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Moves to the stable 9.5.0 release instead of a preview (for the core
Microsoft.Extensions.AI.Abstractions and Microsoft.Extensions.AI
packages).

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-19 16:23:56 -04:00
Afzal Pawaskar
446da624ac
Fix missing tools in logs (#6532)
Fix for LLMCallEvent failing to log "tools" passed to
BaseOpenAIChatCompletionClient in
autogen_ext.models.openai._openai_client.BaseOpenAIChatCompletionClient

This bug creates problems inspecting why a certain tool was selected/not
selected by the LLM as the list of tools available to the LLM is not
present in the logs

## Why are these changes needed?

Added "tools" to the LLMCallEvent to log tools available to the LLM as
these were being missed causing difficulties during debugging LLM tool
calls.

## Related issue number

[<!-- For example: "Closes #1234"
-->](https://github.com/microsoft/autogen/issues/6531)

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-15 17:12:19 -07:00
Chester Hu
9d297318b5
Add Llama API OAI compatible endpoint support (#6442)
## Why are these changes needed?

To add the latest support for using Llama API offerings with AutoGen


## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-15 16:57:27 -07:00
ChrisBlaa
1eb7f93366
add tool_call_summary_msg_format_fct and test (#6460)
## Why are these changes needed?

This change introduces support for dynamic formatting of tool call
summary messages by allowing a user-defined
`tool_call_summary_format_fct`. Instead of relying solely on a static
string template, this function enables runtime generation of summary
messages based on the specific tool call and its result. This provides
greater flexibility and cleaner integration without introducing any
breaking changes.

### My Use Case / Problem

In my use case, I needed concise summaries for successful tool calls and
detailed messages for failures. The existing static summary string
didn't allow conditional formatting, which led to overly verbose success
messages or inconsistent failure outputs. This change allows customizing
summaries per result type, solving that limitation cleanly.

## Related issue number

Closes #6426

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Chris Wieczorek <Chris.Wieczorek@iav.de>
Co-authored-by: EeS <chiyoung.song@motov.co.kr>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Mehrsa Golestaneh <mehrsa.golestaneh@gmail.com>
Co-authored-by: Mehrsa Golestaneh <mgolestaneh@microsoft.com>
Co-authored-by: Zhenyu <81767213+Dormiveglia-elf@users.noreply.github.com>
2025-05-14 10:02:34 -07:00
Miroslav Pokrovskii
aa22b622d0
feat: add qwen3 support (#6528)
## Why are these changes needed?

Add ollama qwen 3 support
2025-05-14 09:52:13 -07:00
Eric Zhu
cc2693b409
Update website 0.5.7 (#6527) 2025-05-13 21:39:33 -07:00
Jay Prakash Thakur
87cf4f07dd
Simplify Azure Ai Search Tool (#6511)
## Why are these changes needed?

Simplified the azure ai search tool and fixed bugs in the code


## Related issue number

"Closes #6430 " 

## Checks

- [X] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [X] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [X] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-13 13:42:11 -07:00
EeS
978cbd2e89
FIX/mistral could not recive name field (#6503)
## Why are these changes needed?
FIX/mistral could not recive name field, so add model transformer for
mistral

## Related issue number
Closes #6147

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-12 19:32:14 -07:00
Eric Zhu
177211b5b4
Update version 0.5.7 (#6518) 2025-05-12 17:19:32 -07:00
Peter Jausovec
867194a907
fixes the issues where exceptions from MCP server tools aren't serial… (#6482)
…ized properly

## Why are these changes needed?
The exceptions thrown by MCP server tools weren't being serialized
properly - the user would see `[{}, {}, ... {}]` instead of an actual
error/exception message.

## Related issue number

Fixes #6481 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
2025-05-12 15:01:08 -07:00
peterychang
9118f9b998
Add ability to register Agent instances (#6131)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Nice to have functionality

## Related issue number

Closes #6060 

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-12 15:34:48 +00:00
EeS
c26d894c34
fix/mcp_session_auto_close_when_Mcpworkbench_deleted (#6497)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?
As-is: Deleting `McpWorkbench` does not close the `McpSession`.  
To-be: Deleting `McpWorkbench` now properly closes the `McpSession`.

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-12 13:31:01 +00:00
Victor Dibia
6427c07f5c
Fix AnthropicBedrockChatCompletionClient import error (#6489)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Some fixes with the AnthropicBedrockChatCompletionClient 

- Ensure `AnthropicBedrockChatCompletionClient` exported and can be
imported.
- Update the BedrockInfo keys serialization - client argument can be
string (similar to api key in this ) but exported config should be
Secret
- Replace `AnthropicBedrock` with `AsyncAnthropicBedrock` : client
should be async to work with the ag stack and the BaseAnthropicClient it
inherits from
- Improve `AnthropicBedrockChatCompletionClient` docstring to use the
correct client arguments rather than serialized dict format.

Expect

```python
from autogen_ext.models.anthropic import AnthropicBedrockChatCompletionClient, BedrockInfo
from autogen_core.models import UserMessage, ModelInfo


async def main():
    anthropic_client = AnthropicBedrockChatCompletionClient(
        model="anthropic.claude-3-5-sonnet-20240620-v1:0",
        temperature=0.1,
        model_info=ModelInfo(vision=False, function_calling=True,
                             json_output=False, family="unknown", structured_output=True),
        bedrock_info=BedrockInfo(
            aws_access_key="<aws_access_key>",
            aws_secret_key="<aws_secret_key>",
            aws_session_token="<aws_session_token>",
            aws_region="<aws_region>",
        ),
    )
    # type: ignore
    result = await anthropic_client.create([UserMessage(content="What is the capital of France?", source="user")])
    print(result)

await main()
```

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #6483 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-10 09:12:02 -07:00
peterychang
3db7a29403
improve Otel tracing (#6499)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Will the changes made in
https://github.com/microsoft/autogen/pull/5853/files and this PR need to
be ported to the worker_runtime as well?
Resolves https://github.com/microsoft/autogen/issues/5894

## Related issue number

https://github.com/microsoft/autogen/issues/5894

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-09 16:24:30 -04:00
AndreaTang123
356ec34b9c
Fix header icons focus and hover style for better accessibility (#6409)
## Why are these changes needed?

This PR improves keyboard accessibility by ensuring that header
links/icons have visual feedback (underline and color change) on both
hover and keyboard focus states. Also adds smooth scaling animation.

## Related issue number

Related issue: #6090 

## Checks

- [☑️] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [☑️] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [☑️] I've made sure all auto checks have passed.

Co-authored-by: peterychang <49209570+peterychang@users.noreply.github.com>
2025-05-09 15:07:23 -04:00
Victor Dibia
1ab24417b8
Add gpt 4o search (#6492)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Add gpt 4o search models to list of default models

```python
"gpt-4o-mini-search-preview-2025-03-11": {
        "vision": False,
        "function_calling": True,
        "json_output": True,
        "family": ModelFamily.GPT_4O,
        "structured_output": True,
        "multiple_system_messages": True,
    },
"gpt-4o-search-preview-2025-03-11": {
        "vision": False,
        "function_calling": True,
        "json_output": True,
        "family": ModelFamily.GPT_4O,
        "structured_output": True,
        "multiple_system_messages": True,
    },
```

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #6491

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-08 18:01:38 -07:00
Victor Dibia
7cc7165573
Update docs.yml (#6493)
Bump python version, pin nr-utils

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Fix docs build CI bug.
- pydocmkardown depends on pydocspec 
-[ pydocspec was updated May
6](https://pypi.org/project/docspec-python/#history) (two days ago), and
includes a problematic dependency (`nr.utils` which is specified as
[nr-utils](61d3e38c55/docspec-python/pyproject.toml (L14C5-L14C23)).
This caused imports to fail.
- current fix is fixing the pydocspec version.
- Also using the opportunity to update the python version 3.8 -> 3.9 for
the docs build 0.2

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-05-08 16:54:57 -07:00
long
b17793ec6b
Fix: Move the createTeam function (#6487)
## Related issue number

Closes #6486
2025-05-08 16:24:56 +00:00
Emmanuel Ferdman
eba05aed37
Fix Gitty prompt message (#6473) 2025-05-07 04:11:19 +00:00
DavidYu00
bacfa98aa6
Sample for integrating Core API with chainlit (#6422)
## Why are these changes needed?

This pull request adds new samples that integrates the Autogen Core API
with Chainlit. It closely follows the structure of the
Agentchat+Chainlit sample and provides examples for using a single agent
and multiple agents in a groupchat.
## Related issue number


Closes: #5345

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-06 14:19:31 -07:00
Abhijeetsingh Meena
2864fbfc2c
Add model_context to SelectorGroupChat for enhanced speaker selection (#6330)
## Why are these changes needed?
This PR enhances the `SelectorGroupChat` class by introducing a new
`model_context` parameter to support more context-aware speaker
selection.

### Changes
- Added a `model_context: ChatCompletionContext | None` parameter to
`SelectorGroupChat`.
- Defaulted to `UnboundedChatCompletionContext` when None is provided
like `AssistantAgent`.
- Updated `_select_speaker` to prepend context messages from
`model_context` to the main thread history.
- Refactored history construction into a helper method
`construct_message_history`.

## Related issue number
Closes [Issue #6301](https://github.com/org/repo/issues/6301), enabling
the group chat manager to utilize `model_context` for richer, more
informed speaker selection decisions.

## Checks
- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-06 12:30:18 -07:00
Eric Zhu
085ff3dd7d
Update website 0.5.6 (#6454) 2025-05-02 15:57:04 -07:00
EeS
880a225cb2
FIX/McpWorkbench_errors_properties_and_grace_shutdown (#6444)
## Why are these changes needed?
Our McpWorkbench required properties however mongodb-lens's some tools
do not has it. I will fix it from when properties is None, -> {}
Our McpWorkbench now does not have stop routine with without async with
McpWorkbench(params) as workbench: and lazy init. So, I will adding def
__del__: pass just insert that, It could show error.

## Related issue number

Closes #6425

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-02 15:23:54 -07:00
EeS
6fc4f53212
FIX: MultiModalMessage in gemini with openai sdk error occured (#6440)
## Why are these changes needed?

Multimodal message fill context with other routine. However current
`_set_empty_to_whitespace` is fill with context.
So, error occured.

And, I checked `multimodal_user_transformer_funcs` and I found it, in
this routine, context must not be empty.
Now remove the `_set_empty_to_whitespace` when multimodal message,
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #6439 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-01 09:27:31 -07:00
Zhenyu
7c29704525
fix: ensure streaming chunks are immediately flushed to console (#6424)
Added `flush=True` to the `aprint` call when handling
`ModelClientStreamingChunkEvent` message to ensure each chunk is
immediately displayed as it arrives.

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?
When handling `ModelClientStreamingChunkEvent` message, streaming chunks
weren't guaranteed to be displayed immediately, as Python's stdout might
buffer output without an explicit flush instruction. This could cause
visual delays between when `chunk_event` objects are added to the
message queue and when users actually see the content rendered in the
console.
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number
None

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-05-01 13:38:47 +00:00
Mehrsa Golestaneh
2792359ef0
Adding readme with link to a repo containing a comprehensive multiagent postgreSQL data management example (#6443)
## Why are these changes needed?

Requesting to add a new example folder under Python samples so that
AutoGen(0.4+) users can easily find this comprehensive example of using
agents and Groupchats to build a multi-agent data management system for
Azure postgreSQL. Readme contains link to a repo with comprehensive
multiagent postgreSQL data management example

## Related issue number

N/A

## Checks
N/A (only a readme file)
- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Mehrsa Golestaneh <mgolestaneh@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-05-01 04:50:46 +00:00
EeS
c7757de59e
FIX: GraphFlow serialize/deserialize and adding test (#6434)
## Why are these changes needed?
 Before

Previously, GraphFlow.__init__() modified the inner_chats and
termination_condition for internal execution logic (e.g., constructing
_StopAgent or composing OrTerminationCondition).
However, these modified values were also used during dump_component(),
meaning the serialized config no longer matched the original inputs.

As a result:
1. dump_component() → load_component() → dump_component() produced
non-idempotent configs.
2. Internal-only constructs like _StopAgent were mistakenly serialized,
even though they should only exist in runtime.

⸻

 After

This patch changes the behavior to:
• Store original inner_chats and termination_condition as-is at
initialization.
	•	During to_config(), serialize only the original unmodified versions.
	•	Avoid serializing _StopAgent or other dynamically built agents.
• Ensure deserialization (from_config) produces a logically equivalent
object without additional nesting or duplication.

This ensures that:
• GraphFlow.dump_component() → load_component() round-trip produces
consistent, minimal configs.
• Internal execution logic and serialized component structure are
properly separated.
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #6431 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-04-30 11:25:20 -07:00
Eric Zhu
8efa1f10a9
update autogen version 0.5.6 (#6433) 2025-04-29 16:18:36 -07:00
EeS
b0c13a476b
test_docker_commandline_code_executor.py : 161.66s -> 108.07 (#6429)
## Why are these changes needed?
Current autogen-ext's test is too slow.
So, I will search slow test case and makes more fast.

[init docker executor function to module
180s->140s](a3cf70bcf8)
[reuse executor at some tests
140s->120s](ca15938afa)
[Remove unnecessary start of docker
120s->110s](61247611e0)

## Related issue number

<!-- For example: "Closes #1234" -->
Part of #6376

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-29 14:18:51 -07:00
abhinav-aegis
bfdf816f21
Aegis graph docs (#6417)
Documentation for Graph based workflow. I kept this separate from pull
request #6333 so that you can just merge in the code without the
documentation changes if needed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 22:31:19 -07:00
abhinav-aegis
9f8e892d27
Added Graph Based Execution functionality to Autogen (#6333)
Closes #4623 

### Add Directed Graph-based Group Chat Execution Engine
(`DiGraphGroupChat`)

This PR introduces a new graph-based execution framework for Autogen
agent teams, located under `autogen_agentchat/teams/_group_chat/_graph`.

**Key Features:**

- **`DiGraphGroupChat`**: A new group chat implementation that executes
agents based on a user-defined directed graph (DAG or cyclic with exit
conditions).
- **`AGGraphBuilder`**: A fluent builder API to programmatically
construct graphs.
- **`MessageFilterAgent`**: A wrapper to restrict what messages an agent
sees before invocation, supporting per-source and per-position
filtering.

**Capabilities:**

- Supports sequential, parallel, conditional, and cyclic workflows.
- Enables fine-grained control over both execution order and message
context.
- Compatible with existing Autogen agents and runtime interfaces.

**Tests:**

- Located in `autogen_agentchat/tests/test_group_chat_graph.py`
- Includes unit and integration tests covering:
  - Graph validation
  - Execution paths
  - Conditional routing
  - Loops with exit conditions
  - Message filtering

Let me know if anything needs refactoring or if you'd like the
components split further.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Leonardo Pinheiro <leosantospinheiro@gmail.com>
2025-04-29 02:06:27 +00:00
LuluZhuu
fcbac2d078
Fix: Reduce multiple H1s to H2s in Distributed Agent Runtime page (#6412)
## Why are these changes needed?

This PR fixes the issue of multiple `<h1>` headers in the Distributed
Agent Runtime documentation page. The page has more than one `<h1>`
which violates semantic HTML structure. This fix downgrades the inner
section headings (e.g., "Cross-Language Runtimes", "Next Steps") to
`<h2>`.

## Related issue number

Related issue: [#6090](https://github.com/microsoft/autogen/issues/6090)

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 23:22:20 +00:00
long
0e9744c4a2
Fix: Icons are not aligned vertically. (#6369)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #6366


## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-04-28 22:52:56 +00:00
Abdo Talema
881cd6a75c
Bing grounding citations (#6370)
Adding support for Bing grounding citations to the AzureAIAgent.

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [X] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [X] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [X] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Dheeraj Bandaru <BandaruDheeraj@users.noreply.github.com>
2025-04-28 13:09:13 -07:00
Mars Wang
998840f7e0
docs: Clarify missing dependencies in documentation (fix #6076) (#6406)
It clarifies the missing dependencies of all README.md in
python/samples/

- Added explicit mention of required dependencies
- Improved instructions for initial setup

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?
According to issue #6076, several dependencies were missing from the
requirements.txt and not mentioned in the README.md instructions.
This change adds the missing installation instructions to ensure that
users can run the demo smoothly.


## Related issue number
Closes #6076 
<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 12:47:14 -07:00
Victor Dibia
18d24005e1
Add missing dependency to tracing docs (#6421)
## Why are these changes needed?

Add missing dependency to tracing docs

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #6419

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-04-28 12:31:19 -07:00
Harini N
a91006cdc2
Adding bedrock chat completion for anthropic models (#6170)
## Why are these changes needed?

Anthropic models are supported by AWS bedrock. ChatCompletionClient can
be created for anthropic bedrock models using this changes. This enables
the user to do the following
- Add any anthropic models and version from AWS bedrock
- Can use ChatCompletionClient for bedrock anthropic models

## Related issue number
Closes #5226

---------

Co-authored-by: harini.narasimhan <harini.narasimhan@eagleview.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 11:56:46 -07:00
EeS
99d853a9cb
FIX: resolving_workbench_and_tools_conflict_at_desirialize_assistant_agent (#6407)
## Why are these changes needed?
Starting from AutoGen v0.5.5, tools are internally managed through
`StaticWorkbench`.
However, both tools and workbench were being serialized and
deserialized, which caused conflicts during deserialization:
	•	When both are restored, the constructor raises:
```
ValueError: Tools cannot be used with a workbench.
```

The changes address this issue by:
1.	Removing tools from serialization/deserialization:
• tools are now considered internal state of `StaticWorkbench`, and are
no longer serialized.
• Only workbench is serialized, ensuring consistency and avoiding
duplication.
2.	Ensuring logical integrity:
• Since tools are not used directly after initialization, persisting
them separately serves no functional purpose.
• This avoids scenarios where both are populated, violating constructor
constraints.

Summary:

This change prevents tools/workbench conflicts by fully delegating tool
management to `StaticWorkbench` and avoiding unnecessary persistence of
tools themselves.


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #6405 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 11:37:09 -07:00
EeS
516a211954
[FIX] DockerCommandLineCodeExecutor multi event loop aware (#6402)
## Why are these changes needed?
*Problem*

Previously, in `DockerCommandLineCodeExecutor`, cancellation tasks were
added directly to `self._cancellation_tasks` using
`asyncio.create_task()`:
```python
self._cancellation_tasks.append(asyncio.create_task(self._kill_running_command(command)))
```
This caused issues when cancellation tasks were created from multiple
event loops, leading to loop mismatch errors during executor shutdown.

*Solution*
This PR fixes the issue by introducing a dedicated internal event loop
for managing cancellation tasks.
Cancellation tasks are now scheduled in a fixed event loop using
`asyncio.run_coroutine_threadsafe()`:
```python
                    future: ConcurrentFuture[None] = asyncio.run_coroutine_threadsafe(
                        self._kill_running_command(command), self._loop
                    )
                    self._cancellation_futures.append(future)
```

*Additional Changes*
- Added detailed logging for easier debugging.
- Ensured clean shutdown of the internal event loop and associated
thread.


*Note*
This change ensures that all cancellation tasks are handled consistently
in a single loop, preventing cross-loop conflicts and improving executor
stability in multi-threaded environments.

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #6395 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-28 10:30:19 -07:00
Eric Zhu
63c791d342
Add more mcp workbench examples to MCP API doc (#6403) 2025-04-25 17:45:24 -07:00
Eric Zhu
4eb256d44a
Update website for v0.5.5 (#6401) 2025-04-25 16:43:23 -07:00
Eric Zhu
653bcc5876
Document custom message types in teams API docs (#6400)
Addresses: #6365
2025-04-25 16:32:47 -07:00
Eric Zhu
7811b1ce83
[doc] Clarify selector prompt for SelectorGroupChat (#6399)
Resolves #6383
2025-04-25 16:17:48 -07:00
Eric Zhu
7bdd7f6162
Add functional termination condition (#6398)
Use an expression for termination condition check. This works well
especially with structured messages.
2025-04-25 15:57:36 -07:00
Minh Đăng
519a04d5fc
Update: implement return_value_as_string for McpToolAdapter (#6380)
## Why are these changes needed?
- Add return_value_as_string for formating result from MCP tool

## Related issue number
- Opened Issue on #6368 

## Checks
- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-25 15:41:02 -07:00
Eric Zhu
70784eaeda
Update version to 0.5.5 (#6397) 2025-04-25 14:22:03 -07:00
amith-ajith
91a7188d9d
Add example using autogen-core and FastAPI for handoff multi-agent design pattern with streaming and UI (#6391)
## Why are these changes needed?

This PR adds an example which demonstrates how to build a streaming chat
API with multi-turn conversation history and a simple web UI for handoff
multi-agent design pattern.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-24 18:35:36 -07:00
Eric Zhu
d96aaebc8d
Update agent documentation (#6394)
* Replace on_messages and on_messages_stream with run and run_stream to
unify interface documentation with teams
* Remove magentic-one-cli from homepage as it has not been maintained
and improved for a while.
2025-04-24 18:29:39 -07:00
Eric Zhu
bab0dfd1e7
AssistantAgent to support Workbench (#6393)
Finishing up the work on workbench.

```python
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import StdioServerParams, McpWorkbench

async def main() -> None:
    params = StdioServerParams(
        command="uvx",
        args=["mcp-server-fetch"],
        read_timeout_seconds=60,
    )

    # You can also use `start()` and `stop()` to manage the session.
    async with McpWorkbench(server_params=params) as workbench:
        model_client = OpenAIChatCompletionClient(model="gpt-4.1-nano")
        assistant = AssistantAgent(
            name="Assistant",
            model_client=model_client,
            workbench=workbench,
            reflect_on_tool_use=True,
        )
        await Console(assistant.run_stream(task="Go to https://github.com/microsoft/autogen and tell me what you see."))
    
asyncio.run(main())
```
2025-04-24 16:19:36 -07:00
EeS
0c9fd64d6e
TEST: skip when macos+uv and adding uv venv tests (#6387)
## Why are these changes needed?

> The pytest tests test_local_executor_with_custom_venv and
test_local_executor_with_custom_venv_in_local_relative_path located in
packages/autogen-ext/tests/code_executors/test_commandline_code_executor.py
fail when run on macOS (aarch64) using a Python interpreter managed by
uv (following the project's recommended development setup).
> 
> The failure occurs during the creation of a nested virtual environment
using Python's standard venv.EnvBuilder. Specifically, the attempt to
run ensurepip inside the newly created venv fails immediately with a
SIGABRT signal. The root cause appears to be a dynamic library loading
error (dyld error) where the Python executable inside the newly created
venv cannot find its required libpythonX.Y.dylib shared library.

So, when MacOS + uv case, skipping that test.
And, adding uv-venv case

## Related issue number

Closes #6341

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-24 14:34:38 -07:00
Eric Zhu
cbd8745f2b
Add guide for workbench and mcp & bug fixes for create_mcp_server_session (#6392)
Add user guide for workbench and mcp

*Also fixed a bug in create_mcp_server_session that included "type" in
the parameters Resolves: #6392
2025-04-24 14:19:09 -07:00
Eric Zhu
f059262b6d
Remove name field from OpenAI Assistant Message (#6388)
Resolves #3247
2025-04-24 13:11:40 -07:00
Eric Zhu
8fcba01704
Introduce workbench (#6340)
This PR introduces `WorkBench`.

A workbench provides a group of tools that share the same resource and
state. For example, `McpWorkbench` provides the underlying tools on the
MCP server. A workbench allows tools to be managed together and abstract
away the lifecycle of individual tools under a single entity. This makes
it possible to create agents with stateful tools from serializable
configuration (component configs), and it also supports dynamic tools:
tools change after each execution.

Here is how a workbench may be used with AssistantAgent (not included in
this PR):

```python
workbench = McpWorkbench(server_params)
agent = AssistantAgent("assistant", tools=workbench)
result = await agent.run(task="do task...")
```


TODOs:
1. In a subsequent PR, update `AssistantAgent` to use workbench as an
alternative in the `tools` parameter. Use `StaticWorkbench` to manage
individual tools.
2. In another PR, add documentation on workbench.

---------

Co-authored-by: EeS <chiyoung.song@motov.co.kr>
Co-authored-by: Minh Đăng <74671798+perfogic@users.noreply.github.com>
2025-04-24 10:37:41 -07:00
EeS
a283d268df
TEST/change gpt4, gpt4o serise to gpt4.1nano (#6375)
## Why are these changes needed?

| Package | Test time-Origin (Sec) | Test time-Edited (Sec) |

|-------------------------|------------------|-----------------------------------------------|
| autogen-studio          | 1.64             | 1.64 |
| autogen-core            | 6.03             | 6.17 |
| autogen-ext             | 387.15           | 373.40 |
| autogen-agentchat       | 54.20            | 20.67 |


## Related issue number

Related #6361 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-04-23 17:51:25 +00:00
Eric Zhu
b6935f913b
update website version (#6364) 2025-04-22 09:51:50 -07:00
Abhijeetsingh Meena
aad6caa768
Add self-debugging loop to CodeExecutionAgent (#6306)
## Why are these changes needed?
This PR introduces a baseline self-debugging loop to the
`CodeExecutionAgent`.

The loop automatically retries code generation and execution up to a
configurable number of attempts (n) until the execution succeeds or the
retry limit is reached.

This enables the agent to recover from transient failures (e.g., syntax
errors, runtime errors) by using its own reasoning to iteratively
improve generated code—laying the foundation for more robust autonomous
behavior.

## Related issue number

Closes #6207

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-22 09:24:05 -07:00
EeS
b3f37319e3
Fix: deserialize model_context in AssistantAgent and SocietyOfMindAgent and CodeExecutorAgent (#6337)
This PR fixes a bug where `model_context` was either ignored or
explicitly set to `None` during agent deserialization (`_from_config`)
in:

- `AssistantAgent`: `model_context` was serialized but not restored.
- `SocietyOfMindAgent`: `model_context` was neither serialized nor
restored.
- `CodeExecutorAgent`: `model_context` was serialized but not restored.

As a result, restoring an agent from its config silently dropped runtime
context settings, potentially affecting agent behavior.

This patch:
- Adds proper serialization/deserialization of `model_context` using
`.dump_component()` and `load_component(...)`.
- Ensures round-trip consistency when using declarative agent configs.

## Related issue number

Closes #6336 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-22 05:02:38 +00:00
Abdo Talema
8a9729214f
Add azure ai agent (#6191)
- Added the support Azure AI Agent. The new agent is named AzureAIAgent.
- The agent supports Bing search, file search, and Azure search tools.
- Added a Jupiter notebook to demonstrate the usage of the AzureAIAgent.

## What's missing?
- AzureAIAgent support only text message responses
-  Parallel execution for the custom functions. 



## Related issue number


[5545](https://github.com/microsoft/autogen/issues/5545#event-16626859772)

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 21:51:22 -07:00
Jorge Villacorta
f00f7d278d
Avoid re-registering a message type already registered (#6354)
This change avoid re-registering a structured message already registered
to the team by a previous agent also included in the team.

This issue occurs when agents share Pydantic models as output format

## Related issue number

Closes #6353

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 21:39:15 -07:00
Henry Miller
00153155e3
Added support for exposing GPUs to docker code executor (#6339)
The DockerCommandLineCodeExecutor doesn't currently offer GPU support.
By simply using DeviceRequest from the docker python API, these changes
expose GPUs to the docker container and provide the ability to execute
CUDA-accelerated code within autogen.

## Related issue number

Closes: #6302 

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-22 01:17:06 +00:00
Peter Jausovec
d051da52c3
fix: ollama fails when tools use optional args (#6343)
## Why are these changes needed?
`convert_tools` failed if Optional args were used in tools (the `type`
field doesn't exist in that case and `anyOf` must be used).

This uses the `anyOf` field to pick the first non-null type to use.  

## Related issue number

Fixes #6323

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-22 00:06:46 +00:00
ToryPan
89d77c77c5
Add an example using autogen-core and FastAPI to create streaming responses (#6335)
## Why are these changes needed?

This PR adds an example demonstrates how to build a streaming chat API
with multi-turn conversation history using `autogen-core` and FastAPI.

## Related issue number


## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 23:55:03 +00:00
EeS
9b0a0bd6b8
FEAT: SelectorGroupChat could using stream inner select_prompt (#6286)
## Why are these changes needed?

This PR updates `SelectorGroupChat` to support streaming mode for
`select_speaker`.
It introduces a `streaming` argument — when set to `True`,
`select_speaker` will use `create_streaming()` instead of `create()`.

## Additional context

Some models (e.g., QwQ) only work properly in streaming mode.  
To support them, the prompt selection step in `SelectorGroupChat` must
also run with `streaming=True`.

## Related issue number

Closes #6145

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 15:48:48 -07:00
Eric Zhu
71363a30ec
Add experimental notice to canvas (#6349) 2025-04-21 21:31:12 +00:00
EeS
4d381d7078
DOC: add extentions - autogen-oaiapi and autogen-contextplus (#6338)
DOC: add extentions - autogen-oaiapi and autogen-contextplus

the contextplus is user define autogen model_context.
It discussion in #6217 and #6160

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 19:23:17 +00:00
Peter Jausovec
4d3e47a0f1
fix: ensure serialized messages are passed to LLMStreamStartEvent (#6344)
## Why are these changes needed?


I was getting the following exception when doing tool calls with
anthropic - the exception was coming form the `__str__` in
`LLMStreamStartEvent`.

```
('Object of type ToolUseBlock is not JSON serializable',)
```

The issue is that when creating the LLMStreamStartevent in the
`create_stream`, the messages weren't being serialized first.
## Related issue number

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 11:43:21 -07:00
EeS
1de07ab293
Generalize Continuous SystemMessage merging via model_info[“multiple_system_messages”] instead of startswith("gemini-") (#6345)
The current implementation of consecutive `SystemMessage` merging
applies only to models where `model_info.family` starts with
`"gemini-"`.

Since PR #6327 introduced the `multiple_system_messages` field in
`model_info`, we can now generalize this logic by checking whether the
field is explicitly set to `False`.

This change replaces the hardcoded family check with a conditional that
merges consecutive `SystemMessage` blocks whenever
`multiple_system_messages` is set to `False`.

Test cases that previously depended on the `"gemini"` model family have
been updated to reflect this configuration flag, and renamed accordingly
for clarity.

In addition, for consistency across conditional logic, a follow-up PR is
planned to refactor the Claude-specific transformation condition
(currently implemented via `create_args.get("model",
"unknown").startswith("claude-")`)
to instead use the existing `is_claude()`.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 11:30:35 -07:00
Leonardo Pinheiro
99aac24dd3
Agentchat canvas (#6215)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

This is an initial exploration of what could be a solution for #6214 .
It implements a simple text canvas using difflib and also a memory
component and a tool component for interacting with the canvas. Still in
early testing but would love feedback on the design.

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-21 18:03:29 +10:00
Eric Zhu
183dbb8dd1
Update version 0.5.4 (#6334) 2025-04-18 17:19:07 -07:00
Enhao Zhang
0e4efd0efc
Add example for parallel agents (#6311)
This PR adds an example of `parallel-agents` that runs multiple
instances of Magentic-One in parallel, with support for early
termination and final answer aggregation.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-18 08:48:56 -07:00
Jay Prakash Thakur
e49ee48908
Bugfix: Azure AI Search Tool - fix query type (#6331) 2025-04-18 05:50:49 +00:00
EeS
b13264ac60
FEAT: adding multiple_system_message on model_info (#6327)
## Why are these changes needed?
`SocietyOfMindAgent` has multiple system message, however many
client/model does not support it.

## Related issue number
Related #6290

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-17 22:39:47 -07:00
masquerlin
4a5dd9eec9
Make Docker Jupyter support to the Version 0.4 as Version 0.2 (#6231)
This PR introduces a safer and more controllable execution environment
for LLM code execution in version 0.4 by enabling the use of Jupyter
inside a container. This enhancement addresses security concerns and
provides a more robust execution context. In particular, it allows:

Isolation of code execution via containerized Jupyter environments.

Persistent memory of variables and their values throughout the
conversation.

Memory of code execution results to support more advanced reasoning and
follow-up tasks.

These improvements help build a more interactive and stateful LLM-agent
programming experience, especially for iterative code generation and
debugging scenarios.

## Related issue number

Open #6153

## Checks

- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-17 21:25:57 +00:00
Eitan Yarmush
1035065c4e
Introduce AgentTool and TeamTool (#5924)
---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-17 00:45:33 -07:00
Eric Zhu
ca5134d5a8
Update website 0.5.3 (#6320) 2025-04-16 20:40:33 -07:00
Eric Zhu
fb16d5acf9
Make sure thought content is included in handoff context (#6319)
Resolves #6295

Ensure the thought content gets included in handoff message conetxt,
when the only tool call was handoff tool call.
2025-04-17 03:22:49 +00:00
Eric Zhu
165c189f0e
Print message types in Console (#6318)
Resolves #6270
2025-04-16 20:07:43 -07:00
Jay Prakash Thakur
bb792b0734
Fix: Azure AI Search Tool Client Lifetime Management (#6316)
## Why are these changes needed?
This PR fixes a bug where the underlying azure `SearchClient` was being
closed prematurely due to use of `async with client` : inside the tool's
run method. this caused the users to encounter errors "HTTP transport
has already been closed"

## Related issue number

Closes #6308 "

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [X] I've made sure all auto checks have passed.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-16 19:39:27 -07:00
Eric Zhu
629fb86e96
Add GPT4.1, o4-mini and o3 (#6314) 2025-04-17 01:10:14 +00:00
Eric Zhu
27b834f296
Make shared session possible for MCP tool (#6312)
Resolves #6232, #6198

This PR introduces an optional parameter `session` to `mcp_server_tools`
to support reuse of the same session.

```python
import asyncio

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import StdioServerParams, create_mcp_server_session, mcp_server_tools


async def main() -> None:
    model_client = OpenAIChatCompletionClient(model="gpt-4o", parallel_tool_calls=False)  # type: ignore
    params = StdioServerParams(
        command="npx",
        args=["@playwright/mcp@latest"],
        read_timeout_seconds=60,
    )
    async with create_mcp_server_session(params) as session:
        await session.initialize()
        tools = await mcp_server_tools(server_params=params, session=session)
        print(f"Tools: {[tool.name for tool in tools]}")

        agent = AssistantAgent(
            name="Assistant",
            model_client=model_client,
            tools=tools,  # type: ignore
        )

        termination = TextMentionTermination("TERMINATE")
        team = RoundRobinGroupChat([agent], termination_condition=termination)
        await Console(
            team.run_stream(
                task="Go to https://ekzhu.com/, visit the first link in the page, then tell me about the linked page."
            )
        )


asyncio.run(main())
``` 

Based on discussion in this thread: #6284, we will consider
serialization and deserialization of MCP server tools when used in this
manner in a separate issue.

This PR also replaces the `json_schema_to_pydantic` dependency with
built-in utils.
2025-04-16 17:43:28 -07:00
EeS
844de21c00
[FEATURE] Option to emit group chat manager messages in AgentChat (#6303)
Add an option emit_team_events to BaseGroupChat to emit events from
group chat manager through run_stream.
SpeakerSelectedEvent from group chat speaker selection.

Closes #6161

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-16 13:41:16 -07:00
abhinav-aegis
a4a16fd2f8
Aegis structure message (#6289)
Added support for structured message component using the Json to
Pydantic utility functions. Note: also adding the ability to use a
format string for structured messages.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-16 12:00:14 -07:00
Eric Zhu
8bd162f8fc
Update version to 0.5.3 (#6310) 2025-04-16 11:02:25 -07:00
amoghmc
71b7429a42
Add missing C# and F# kernels (#6283)
Add missing C# and F# kernels.
These are needed to create a default kernel else it will return an empty
kernel.
2025-04-15 20:15:28 +00:00
cheng-tan
88dda88f53
Pin opentelemetry-proto version (#6305)
## Description
This PR pins opentelemetry-proto version to >=1.28.0, which uses
protobuf > 5.0, < 6.0 to generate protobuf files.

## Related issue number
Closes #6304
2025-04-15 09:04:01 -07:00
Yash Malik
7e8472f99b
minor grammatical fix in docs (#6263)
minor grammatical fix in docs

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-15 06:14:44 +00:00
Abhijeetsingh Meena
756aef366d
Add code generation support to CodeExecutorAgent (#6098)
## Why are these changes needed?
- To add support for code generation, execution and reflection to
`CodeExecutorAgent`.

## Related issue number
Closes #5824 

## Checks
- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-14 23:06:40 -07:00
Sungjun.Kim
71a4eaedf9
Bump up json-schema-to-pydantic from v0.2.3 to v0.2.4 (#6300)
---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-04-14 21:50:49 -07:00
Victor Dibia
95b1ed5d81
Update AutoGen dependency range in AGS (#6298) 2025-04-15 04:26:30 +00:00
Eric Zhu
c75515990e
Update website for 0.5.2 (#6299) 2025-04-14 20:51:45 -07:00
449 changed files with 40008 additions and 10935 deletions

2
.gitattributes vendored
View File

@ -91,5 +91,5 @@ python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/protos/*.pyi linguist-
python/packages/autogen-ext/tests/protos/*.py linguist-generated python/packages/autogen-ext/tests/protos/*.py linguist-generated
python/packages/autogen-ext/tests/protos/*.pyi linguist-generated python/packages/autogen-ext/tests/protos/*.pyi linguist-generated
docs/** linguist-documentation docs/** linguist-documentation
python/packages/autogen-core/docs/** linguist-documentation python/docs/** linguist-documentation
dotnet/website/** linguist-documentation dotnet/website/** linguist-documentation

View File

@ -90,6 +90,14 @@ body:
multiple: false multiple: false
options: options:
- "Python dev (main branch)" - "Python dev (main branch)"
- "Python 0.6.2"
- "Python 0.6.1"
- "Python 0.6.0"
- "Python 0.5.7"
- "Python 0.5.6"
- "Python 0.5.5"
- "Python 0.5.4"
- "Python 0.5.3"
- "Python 0.5.2" - "Python 0.5.2"
- "Python 0.5.1" - "Python 0.5.1"
- "Python 0.4.9" - "Python 0.4.9"

View File

@ -18,7 +18,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -37,7 +36,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -66,7 +64,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -78,6 +75,24 @@ jobs:
poe --directory ${{ matrix.package }} mypy poe --directory ${{ matrix.package }} mypy
working-directory: ./python working-directory: ./python
docs-mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: uv sync --locked --all-extras
working-directory: ./python
- name: Run task
run: |
source ${{ github.workspace }}/python/.venv/bin/activate
poe docs-mypy
working-directory: ./python
pyright: pyright:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -95,7 +110,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -122,7 +136,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -156,7 +169,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -189,7 +201,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
@ -251,15 +262,11 @@ jobs:
docs: docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
package: ["./packages/autogen-core"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -268,20 +275,16 @@ jobs:
- name: Run task - name: Run task
run: | run: |
source ${{ github.workspace }}/python/.venv/bin/activate source ${{ github.workspace }}/python/.venv/bin/activate
poe --directory ${{ matrix.package }} docs-check poe docs-check
working-directory: ./python working-directory: ./python
docs-example-check: docs-example-check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
package: ["./packages/autogen-core"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -290,7 +293,7 @@ jobs:
- name: Run task - name: Run task
run: | run: |
source ${{ github.workspace }}/python/.venv/bin/activate source ${{ github.workspace }}/python/.venv/bin/activate
poe --directory ${{ matrix.package }} docs-check-examples poe docs-check-examples
working-directory: ./python working-directory: ./python
samples-code-check: samples-code-check:
@ -300,7 +303,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -319,7 +321,6 @@ jobs:
- uses: astral-sh/setup-uv@v3 - uses: astral-sh/setup-uv@v3
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -338,7 +339,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"

View File

@ -76,7 +76,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- run: uv sync --locked --all-extras - run: uv sync --locked --all-extras
working-directory: ./python working-directory: ./python
- name: Prepare python venv - name: Prepare python venv

View File

@ -31,20 +31,153 @@ jobs:
matrix: matrix:
version: version:
[ [
# For main use the workflow target {
{ ref: "${{github.ref}}", dest-dir: dev, uv-version: "0.5.13", sphinx-release-override: "dev" }, ref: "${{github.ref}}",
{ ref: "python-v0.5.1", dest-dir: stable, uv-version: "0.5.13", sphinx-release-override: "stable" }, dest-dir: dev,
{ ref: "v0.4.0.post1", dest-dir: "0.4.0", uv-version: "0.5.13", sphinx-release-override: "" }, uv-version: "0.7.13",
{ ref: "v0.4.1", dest-dir: "0.4.1", uv-version: "0.5.13", sphinx-release-override: "" }, sphinx-release-override: "dev",
{ ref: "v0.4.2", dest-dir: "0.4.2", uv-version: "0.5.13", sphinx-release-override: "" }, poe-dir: ".",
{ ref: "v0.4.3", dest-dir: "0.4.3", uv-version: "0.5.13", sphinx-release-override: "" }, },
{ ref: "v0.4.4", dest-dir: "0.4.4", uv-version: "0.5.13", sphinx-release-override: "" }, {
{ ref: "python-v0.4.5", dest-dir: "0.4.5", uv-version: "0.5.13", sphinx-release-override: "" }, ref: "python-v0.6.2",
{ ref: "python-v0.4.6", dest-dir: "0.4.6", uv-version: "0.5.13", sphinx-release-override: "" }, dest-dir: stable,
{ ref: "python-v0.4.7", dest-dir: "0.4.7", uv-version: "0.5.13", sphinx-release-override: "" }, uv-version: "0.7.13",
{ ref: "python-v0.4.8", dest-dir: "0.4.8", uv-version: "0.5.13", sphinx-release-override: "" }, sphinx-release-override: "stable",
{ ref: "python-v0.4.9-website", dest-dir: "0.4.9", uv-version: "0.5.13", sphinx-release-override: "" }, poe-dir: "./packages/autogen-core",
{ ref: "python-v0.5.1", dest-dir: "0.5.1", uv-version: "0.5.13", sphinx-release-override: "" }, },
{
ref: "v0.4.0.post1",
dest-dir: "0.4.0",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "v0.4.1",
dest-dir: "0.4.1",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "v0.4.2",
dest-dir: "0.4.2",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "v0.4.3",
dest-dir: "0.4.3",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "v0.4.4",
dest-dir: "0.4.4",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.4.5",
dest-dir: "0.4.5",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.4.6",
dest-dir: "0.4.6",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.4.7",
dest-dir: "0.4.7",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.4.8",
dest-dir: "0.4.8",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.4.9-website",
dest-dir: "0.4.9",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.1",
dest-dir: "0.5.1",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.2",
dest-dir: "0.5.2",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.3",
dest-dir: "0.5.3",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.4",
dest-dir: "0.5.4",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.5",
dest-dir: "0.5.5",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.6",
dest-dir: "0.5.6",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.5.7",
dest-dir: "0.5.7",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.6.1",
dest-dir: "0.6.1",
uv-version: "0.5.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
{
ref: "python-v0.6.2",
dest-dir: "0.6.2",
uv-version: "0.7.13",
sphinx-release-override: "",
poe-dir: "./packages/autogen-core",
},
] ]
steps: steps:
- name: Checkout - name: Checkout
@ -62,9 +195,9 @@ jobs:
- run: | - run: |
uv sync --locked --all-extras uv sync --locked --all-extras
source .venv/bin/activate source .venv/bin/activate
poe --directory ./packages/autogen-core docs-build poe --directory ${{ matrix.version.poe-dir }} docs-build
mkdir -p docs-staging/${{ matrix.version.dest-dir }}/ mkdir -p docs-staging/${{ matrix.version.dest-dir }}/
mv ./packages/autogen-core/docs/build/* docs-staging/${{ matrix.version.dest-dir }}/ mv ${{ matrix.version.poe-dir }}/docs/build/* docs-staging/${{ matrix.version.dest-dir }}/
working-directory: ./python working-directory: ./python
env: env:
PY_DOCS_DIR: ${{ matrix.version.dest-dir }}/ PY_DOCS_DIR: ${{ matrix.version.dest-dir }}/
@ -88,7 +221,7 @@ jobs:
- name: generate redirects - name: generate redirects
run: | run: |
mkdir -p python/docs-staging/ mkdir -p python/docs-staging/
python python/packages/autogen-core/docs/redirects/redirects.py python/docs-staging python python/docs/redirects/redirects.py python/docs-staging
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
path: "./python/docs-staging" path: "./python/docs-staging"
@ -105,7 +238,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -136,10 +268,11 @@ jobs:
- name: setup python - name: setup python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: "3.8" python-version: "3.9"
- name: pydoc-markdown install - name: pydoc-markdown install
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install docspec==2.2.1 docspec-python==2.2.1
pip install pydoc-markdown pyyaml termcolor pip install pydoc-markdown pyyaml termcolor
# Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown. # Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown.
pip install databind.core==4.4.2 databind.json==4.4.2 pip install databind.core==4.4.2 databind.json==4.4.2
@ -233,7 +366,8 @@ jobs:
name: github-pages name: github-pages
url: ${{ steps.deployment.outputs.page_url }} url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-02, build-04, build-04-dotnet, gen-redirects, gen-component-schema] needs:
[build-02, build-04, build-04-dotnet, gen-redirects, gen-component-schema]
if: ${{ needs.build-02.result == 'success' && needs.build-04.result == 'success' && needs.gen-redirects.result == 'success' && github.ref == 'refs/heads/main' }} if: ${{ needs.build-02.result == 'success' && needs.build-04.result == 'success' && needs.gen-redirects.result == 'success' && github.ref == 'refs/heads/main' }}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4

View File

@ -68,7 +68,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -154,7 +153,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"
@ -247,7 +245,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"

View File

@ -27,7 +27,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.11" python-version: "3.11"

94
.github/workflows/pytest-mem0.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: Mem0 Memory Tests
on:
# Run on pushes to any branch
push:
# Also run on pull requests to main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
neo4j:
image: neo4j:5.26.6
ports:
- 7474:7474 # HTTP
- 7687:7687 # BOLT
env:
NEO4J_AUTH: neo4j/password
NEO4J_dbms_security_procedures_unrestricted: apoc.*
# Add this to ensure Neo4j is ready for connections quickly
NEO4J_dbms_memory_pagecache_size: 100M
NEO4J_dbms_memory_heap_initial__size: 100M
NEO4J_dbms_memory_heap_max__size: 500M
# Try a different health check approach
options: >-
--health-cmd "wget -O /dev/null -q http://localhost:7474 || exit 1"
--health-interval 5s
--health-timeout 15s
--health-retries 10
--health-start-period 30s
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Wait for Neo4j
run: |
# Give Neo4j some extra time to start up
sleep 10
# Try to connect to Neo4j
timeout 30s bash -c 'until curl -s http://localhost:7474 > /dev/null; do sleep 1; done'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install core packages first (in the right order)
cd python/packages/autogen-core
pip install -e .
cd ../autogen-agentchat
pip install -e .
# Now install autogen-ext with its dependencies
cd ../autogen-ext
pip install -e ".[dev,mem0,mem0-local]"
# Install test dependencies
pip install pytest pytest-asyncio pytest-cov
pip install python-dotenv
# Install dependencies for complex configuration tests
pip install "openai>=1.0.0"
pip install deepseek-ai
# Update test config to match the simplified Neo4j setup
- name: Update Neo4j password in tests
run: |
echo "NEO4J_PASSWORD=password" >> $GITHUB_ENV
- name: Run tests with coverage
# env:
# MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }}
# SF_API_KEY: ${{ secrets.SF_API_KEY }}
# DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
run: |
cd python/packages/autogen-ext
pytest --cov=autogen_ext.memory.mem0 tests/memory/test_mem0.py -v --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./python/packages/autogen-ext/coverage.xml
name: codecov-mem0
fail_ci_if_error: false

View File

@ -35,7 +35,6 @@ jobs:
- uses: astral-sh/setup-uv@v5 - uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
version: "0.5.18"
- run: uv build --package ${{ github.event.inputs.package }} --out-dir dist/ - run: uv build --package ${{ github.event.inputs.package }} --out-dir dist/
working-directory: python working-directory: python
- name: Publish package to PyPI - name: Publish package to PyPI

View File

@ -5,11 +5,51 @@
"url": "/autogen/dev/" "url": "/autogen/dev/"
}, },
{ {
"name": "0.5.1 (stable)", "name": "0.6.2 (stable)",
"version": "stable", "version": "stable",
"url": "/autogen/stable/", "url": "/autogen/stable/",
"preferred": true "preferred": true
}, },
{
"name": "0.6.1",
"version": "0.6.1",
"url": "/autogen/0.6.1/"
},
{
"name": "0.5.7",
"version": "0.5.7",
"url": "/autogen/0.5.7/"
},
{
"name": "0.5.6",
"version": "0.5.6",
"url": "/autogen/0.5.6/"
},
{
"name": "0.5.5",
"version": "0.5.5",
"url": "/autogen/0.5.5/"
},
{
"name": "0.5.4",
"version": "0.5.4",
"url": "/autogen/0.5.4/"
},
{
"name": "0.5.3",
"version": "0.5.3",
"url": "/autogen/0.5.3/"
},
{
"name": "0.5.2",
"version": "0.5.2",
"url": "/autogen/0.5.2/"
},
{
"name": "0.5.1",
"version": "0.5.1",
"url": "/autogen/0.5.1/"
},
{ {
"name": "0.4.9", "name": "0.4.9",
"version": "0.4.9", "version": "0.4.9",

View File

@ -5,7 +5,8 @@
<MicrosoftSemanticKernelStableVersion>1.45.0</MicrosoftSemanticKernelStableVersion> <MicrosoftSemanticKernelStableVersion>1.45.0</MicrosoftSemanticKernelStableVersion>
<MicrosoftSemanticKernelPreviewVersion>$(MicrosoftSemanticKernelStableVersion)-preview</MicrosoftSemanticKernelPreviewVersion> <MicrosoftSemanticKernelPreviewVersion>$(MicrosoftSemanticKernelStableVersion)-preview</MicrosoftSemanticKernelPreviewVersion>
<MicrosoftSemanticKernelAlphaVersion>$(MicrosoftSemanticKernelStableVersion)-alpha</MicrosoftSemanticKernelAlphaVersion> <MicrosoftSemanticKernelAlphaVersion>$(MicrosoftSemanticKernelStableVersion)-alpha</MicrosoftSemanticKernelAlphaVersion>
<MicrosoftExtensionsAIVersion>9.3.0-preview.1.25161.3</MicrosoftExtensionsAIVersion> <MicrosoftExtensionsAIVersion>9.5.0</MicrosoftExtensionsAIVersion>
<MicrosoftExtensionsAIPreviewVersion>9.5.0-preview.1.25265.7</MicrosoftExtensionsAIPreviewVersion>
<MicrosoftExtensionConfiguration>9.0.0</MicrosoftExtensionConfiguration> <MicrosoftExtensionConfiguration>9.0.0</MicrosoftExtensionConfiguration>
<MicrosoftExtensionDependencyInjection>9.0.3</MicrosoftExtensionDependencyInjection> <MicrosoftExtensionDependencyInjection>9.0.3</MicrosoftExtensionDependencyInjection>
<MicrosoftExtensionLogging>9.0.0</MicrosoftExtensionLogging> <MicrosoftExtensionLogging>9.0.0</MicrosoftExtensionLogging>
@ -64,9 +65,9 @@
<PackageVersion Include="Microsoft.DotNet.Interactive.PackageManagement" Version="$(MicrosoftDotNetInteractive)" /> <PackageVersion Include="Microsoft.DotNet.Interactive.PackageManagement" Version="$(MicrosoftDotNetInteractive)" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" /> <PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIVersion)" /> <PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="$(MicrosoftExtensionsAIVersion)" /> <PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="$(MicrosoftExtensionsAIPreviewVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAIVersion)" /> <PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAIPreviewVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIVersion)" /> <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIPreviewVersion)" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.8.0" /> <PackageVersion Include="Microsoft.Extensions.Azure" Version="1.8.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionConfiguration)" /> <PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionConfiguration)" />

View File

@ -40,7 +40,7 @@ var assistantAgent = new AssistantAgent(
// set human input mode to ALWAYS so that user always provide input // set human input mode to ALWAYS so that user always provide input
var userProxyAgent = new UserProxyAgent( var userProxyAgent = new UserProxyAgent(
name: "user", name: "user",
humanInputMode: ConversableAgent.HumanInputMode.ALWAYS) humanInputMode: HumanInputMode.ALWAYS)
.RegisterPrintMessage(); .RegisterPrintMessage();
// start the conversation // start the conversation

View File

@ -189,12 +189,12 @@ public class FunctionCallMiddleware : IStreamingMiddleware
} }
} }
private Func<string, Task<string>> AIToolInvokeWrapper(Func<IEnumerable<KeyValuePair<string, object?>>?, CancellationToken, Task<object?>> lambda) private Func<string, Task<string>> AIToolInvokeWrapper(Func<AIFunctionArguments?, CancellationToken, ValueTask<object?>> lambda)
{ {
return async (string args) => return async (string args) =>
{ {
var arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>(args); var arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>(args);
var result = await lambda(arguments, CancellationToken.None); var result = await lambda(new(arguments), CancellationToken.None);
return result switch return result switch
{ {

View File

@ -14,7 +14,9 @@ public static class DotnetInteractiveKernelBuilder
public static InProccessDotnetInteractiveKernelBuilder CreateDefaultInProcessKernelBuilder() public static InProccessDotnetInteractiveKernelBuilder CreateDefaultInProcessKernelBuilder()
{ {
return new InProccessDotnetInteractiveKernelBuilder(); return new InProccessDotnetInteractiveKernelBuilder()
.AddCSharpKernel()
.AddFSharpKernel();
} }
#endif #endif

View File

@ -89,7 +89,7 @@ public static class ServiceCollectionChatClientExtensions
.AddChatClient(service => .AddChatClient(service =>
{ {
var openAiClient = service.GetRequiredService<OpenAIClient>(); var openAiClient = service.GetRequiredService<OpenAIClient>();
return openAiClient.AsChatClient(modelOrDeploymentName); return openAiClient.GetChatClient(modelOrDeploymentName).AsIChatClient();
}); });
return services; return services;
@ -112,7 +112,7 @@ public static class ServiceCollectionChatClientExtensions
var endpoint = $"{serviceName}:Endpoint" ?? throw new InvalidOperationException($"No endpoint was specified for the Azure Inference Chat Client"); var endpoint = $"{serviceName}:Endpoint" ?? throw new InvalidOperationException($"No endpoint was specified for the Azure Inference Chat Client");
var endpointUri = string.IsNullOrEmpty(endpoint) ? null : new Uri(endpoint); var endpointUri = string.IsNullOrEmpty(endpoint) ? null : new Uri(endpoint);
var token = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ?? throw new InvalidOperationException("No model access token was found in the environment variable AZURE_OPENAI_API_KEY"); var token = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ?? throw new InvalidOperationException("No model access token was found in the environment variable AZURE_OPENAI_API_KEY");
var chatClient = new ChatCompletionsClient(endpointUri, new AzureKeyCredential(token)).AsChatClient(modelOrDeploymentName); var chatClient = new ChatCompletionsClient(endpointUri, new AzureKeyCredential(token)).AsIChatClient(modelOrDeploymentName);
hostBuilder.Services.AddChatClient(chatClient); hostBuilder.Services.AddChatClient(chatClient);
return hostBuilder.Services; return hostBuilder.Services;

3
python/.gitignore vendored
View File

@ -174,3 +174,6 @@ tmp_code_*.py
# .NET Development settings # .NET Development settings
appsettings.Development.json appsettings.Development.json
# Documentation reference files
docs/src/reference

View File

@ -1,15 +1,21 @@
# AutoGen Python packages # AutoGen Python Development Guide
[![0.4 Docs](https://img.shields.io/badge/Docs-0.4-blue)](https://microsoft.github.io/autogen/dev/) [![Docs (dev)](https://img.shields.io/badge/Docs-dev-blue)](https://microsoft.github.io/autogen/dev/)
[![Docs (latest release)](https://img.shields.io/badge/Docs-latest%20release-blue)](https://microsoft.github.io/autogen/dev/)
[![PyPi autogen-core](https://img.shields.io/badge/PyPi-autogen--core-blue?logo=pypi)](https://pypi.org/project/autogen-core/) [![PyPi autogen-agentchat](https://img.shields.io/badge/PyPi-autogen--agentchat-blue?logo=pypi)](https://pypi.org/project/autogen-agentchat/) [![PyPi autogen-ext](https://img.shields.io/badge/PyPi-autogen--ext-blue?logo=pypi)](https://pypi.org/project/autogen-ext/) [![PyPi autogen-core](https://img.shields.io/badge/PyPi-autogen--core-blue?logo=pypi)](https://pypi.org/project/autogen-core/) [![PyPi autogen-agentchat](https://img.shields.io/badge/PyPi-autogen--agentchat-blue?logo=pypi)](https://pypi.org/project/autogen-agentchat/) [![PyPi autogen-ext](https://img.shields.io/badge/PyPi-autogen--ext-blue?logo=pypi)](https://pypi.org/project/autogen-ext/)
This directory works as a single `uv` workspace containing all project packages. See [`packages`](./packages/) to discover all project packages. This directory works as a single `uv` workspace containing all project packages, including:
- `packages/autogen-core`: interface definitions and reference implementations of agent runtime, model, tool, workbench, memory, tracing.
- `packages/autogen-agentchat`: single and multi-agent workflows built on top of `autogen-core`.
- `packages/autogen-ext`: implementations for ecosystem integrations. For example, `autogen-ext[openai]` provides the OpenAI model client.
- `packages/autogen-studio`: a web-based IDE for building and running AutoGen agents.
## Migrating from 0.2.x? ## Migrating from 0.2.x?
Please refer to the [migration guide](./migration_guide.md) for how to migrate your code from 0.2.x to 0.4.x. Please refer to the [migration guide](./migration_guide.md) for how to migrate your code from 0.2.x to 0.4.x.
## Development ## Quick Start
**TL;DR**, run all checks with: **TL;DR**, run all checks with:
@ -19,20 +25,19 @@ source .venv/bin/activate
poe check poe check
``` ```
### Setup ## Setup
`uv` is a package manager that assists in creating the necessary environment and installing packages to run AutoGen. `uv` is a package manager that assists in creating the necessary environment and installing packages to run AutoGen.
- [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/). - [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/).
**Note:** To prevent incompatibilities between versions the same UV version as is running in CI should be used. Check the version in CI by looking the `setup-uv` action, [here](https://github.com/microsoft/autogen/blob/main/.github/workflows/checks.yml#L40) for example. To upgrade `uv` to the latest version, run:
For example, to change your version to `0.5.18`, run:
```sh ```sh
uv self update 0.5.18 uv self update
``` ```
### Virtual Environment ## Virtual Environment
During development, you may need to test changes made to any of the packages.\ During development, you may need to test changes made to any of the packages.\
To do so, create a virtual environment where the AutoGen packages are installed based on the current state of the directory.\ To do so, create a virtual environment where the AutoGen packages are installed based on the current state of the directory.\
@ -46,7 +51,7 @@ source .venv/bin/activate
- `uv sync --all-extras` will create a `.venv` directory at the current level and install packages from the current directory along with any other dependencies. The `all-extras` flag adds optional dependencies. - `uv sync --all-extras` will create a `.venv` directory at the current level and install packages from the current directory along with any other dependencies. The `all-extras` flag adds optional dependencies.
- `source .venv/bin/activate` activates the virtual environment. - `source .venv/bin/activate` activates the virtual environment.
### Common Tasks ## Common Tasks
To create a pull request (PR), ensure the following checks are met. You can run each check individually: To create a pull request (PR), ensure the following checks are met. You can run each check individually:
@ -55,16 +60,19 @@ To create a pull request (PR), ensure the following checks are met. You can run
- Test: `poe test` - Test: `poe test`
- Mypy: `poe mypy` - Mypy: `poe mypy`
- Pyright: `poe pyright` - Pyright: `poe pyright`
- Build docs: `poe --directory ./packages/autogen-core/ docs-build` - Build docs: `poe docs-build`
- Auto rebuild+serve docs: `poe --directory ./packages/autogen-core/ docs-serve` - Check docs: `poe docs-check`
- Clean docs: `poe docs-clean`
- Check code blocks in API references: `poe docs-check-examples`
- Auto rebuild+serve docs: `poe docs-serve`
- Check samples in `python/samples`: `poe samples-code-check` - Check samples in `python/samples`: `poe samples-code-check`
Alternatively, you can run all the checks with: Alternatively, you can run all the checks with:
- `poe check` - `poe check`
> [!NOTE] > [!NOTE]
> These need to be run in the virtual environment. > These need to be run in the virtual environment.
### Syncing Dependencies ## Syncing Dependencies
When you pull new changes, you may need to update the dependencies. When you pull new changes, you may need to update the dependencies.
To do so, first make sure you are in the virtual environment, and then in the `python` directory, run: To do so, first make sure you are in the virtual environment, and then in the `python` directory, run:
@ -75,7 +83,135 @@ uv sync --all-extras
This will update the dependencies in the virtual environment. This will update the dependencies in the virtual environment.
### Creating a New Package ## Building Documentation
The documentation source directory is located at `docs/src/`.
To build the documentation, run this from the root of the Python directory:
```sh
poe docs-build
```
To serve the documentation locally, run:
```sh
poe docs-serve
```
When you make changes to the doc strings or add new modules, you may need to
refresh the API references in the documentation by first cleaning the docs and
then building them again:
```sh
poe docs-clean # This will remove the build directory and the reference directory
poe docs-build # This will rebuild the documentation from scratch
```
## Writing Documentation
When you add a new public class or function, you should always add a docstring
to it. The docstring should follow the
[Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) layout
and the Sphinx RST format for Python docstrings.
The docstring for a public class or function should include:
- A short description of the class or function at the beginning immediately after the `"""`.
- A longer description if necessary, explaining the purpose and usage.
- A list of arguments with their types and descriptions, using the `Args` section.
Each argument should be listed with its name, type, and a brief description.
- A description of the return value and its type, using the `Returns` section.
If the function does not return anything, you can omit this section.
- A list of exceptions that the function may raise, with descriptions,
using the `Raises` section. This is optional but recommended if the function can raise exceptions that users should be aware of.
- Examples of how to use the class or function, using the `Examples` section,
and formatted using `.. code-block:: python` directive. Optionally, also include the output of the example using
`.. code-block:: text` directive.
Here is an example of a docstring for `McpWorkbench` class:
```python
class McpWorkbench(Workbench, Component[McpWorkbenchConfig]):
"""A workbench that wraps an MCP server and provides an interface
to list and call tools provided by the server.
This workbench should be used as a context manager to ensure proper
initialization and cleanup of the underlying MCP session.
Args:
server_params (McpServerParams): The parameters to connect to the MCP server.
This can be either a :class:`StdioServerParams` or :class:`SseServerParams`.
tool_overrides (Optional[Dict[str, ToolOverride]]): Optional mapping of original tool
names to override configurations for name and/or description. This allows
customizing how server tools appear to consumers while maintaining the underlying
tool functionality.
Raises:
ValueError: If there are conflicts in tool override names.
Examples:
Here is a simple example of how to use the workbench with a `mcp-server-fetch` server:
.. code-block:: python
import asyncio
from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams
async def main() -> None:
params = StdioServerParams(
command="uvx",
args=["mcp-server-fetch"],
read_timeout_seconds=60,
)
# You can also use `start()` and `stop()` to manage the session.
async with McpWorkbench(server_params=params) as workbench:
tools = await workbench.list_tools()
print(tools)
result = await workbench.call_tool(tools[0]["name"], {"url": "https://github.com/"})
print(result)
asyncio.run(main())
```
The code blocks with `.. code-block:: python` is checked by the `docs-check-examples` task using Pyright,
so make sure the code is valid. Running the code as a script and checking it using `pyright`
is a good way to ensure the code examples are correct.
When you reference a class, method, or function in the docstring, you should always
use the `:class:`, `:meth:`, or `:func:` directive to create a link to the class or function.
Always use the fully qualified name of the class or function, including the package name, but
prefix it with a `~` for shorter rendering in the documentation.
For example, if you are referencing the `AssistantAgent` class in the `autogen-agentchat` package,
you should write it as `:class:~autogen_agentchat.AssistantAgent`.
For a public data class, including those that are Pydantic models, you should also include docstrings
for each field in the class.
## Writing Tests
When you add a new public class or function, you should also always add tests for it.
We track test coverage and aim for not reducing the coverage percentage with new changes.
We use `pytest` for testing, and you should always use fixtures to set up the test dependencies.
Use mock objects to simulate dependencies and avoid making real API calls or database queries in tests.
See existing tests for examples of how to use fixtures and mocks.
For model clients, use `autogen_ext.models.replay.ReplayChatCompletionClient` as a
drop-in replacement for the model client to simulate responses without making real API calls.
When certain tests requires interaction with actual model APIs or other external services,
you should configure the tests to be skipped if the required services are not available.
For example, if you are testing a model client that requires an OpenAI API key,
you can use the `pytest.mark.skipif` decorator to skip the test if the environment variable for the API key is not set.
## Creating a New Package
To create a new package, similar to `autogen-core` or `autogen-chat`, use the following: To create a new package, similar to `autogen-core` or `autogen-chat`, use the following:

29
python/docs/README.md Normal file
View File

@ -0,0 +1,29 @@
## Building the AutoGen Documentation
AutoGen documentation is based on the sphinx documentation system and uses the myst-parser to render markdown files. It uses the [pydata-sphinx-theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/) to style the documentation.
### Prerequisites
Ensure you have all of the dev dependencies for the `autogen-core` package installed. You can install them by running the following command from the root of the python repository:
```bash
uv sync
source .venv/bin/activate
```
## Building Docs
To build the documentation, run the following command from the root of the python directory:
```bash
poe docs-build
```
To serve the documentation locally, run the following command from the root of the python directory:
```bash
poe docs-serve
```
[!NOTE]
Sphinx will only rebuild files that have changed since the last build. If you want to force a full rebuild, you can delete the `./docs/build` directory before running the `docs-build` command.

View File

@ -1,202 +1,222 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0" version="25.0.3"> <mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0" version="26.0.6">
<diagram name="Page-1" id="bkX10E6zblEP7POKMJXw"> <diagram name="Page-1" id="bkX10E6zblEP7POKMJXw">
<mxGraphModel dx="1768" dy="1089" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> <mxGraphModel dx="775" dy="621" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root> <root>
<mxCell id="0" /> <mxCell id="0" />
<mxCell id="1" parent="0" /> <mxCell id="1" parent="0" />
<mxCell id="NpWbz43RdM9-YawIMZhB-93" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-93" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="1" vertex="1">
<mxGeometry x="180" y="220" width="490" height="800" as="geometry" /> <mxGeometry x="180" y="220" width="500" height="890" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-90" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-90" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" parent="1" vertex="1">
<mxGeometry x="210" y="856" width="430" height="143" as="geometry" /> <mxGeometry x="210" y="951" width="430" height="143" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-100" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-83" target="NpWbz43RdM9-YawIMZhB-84"> <mxCell id="NpWbz43RdM9-YawIMZhB-100" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-83" target="NpWbz43RdM9-YawIMZhB-84" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-83" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-83" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" parent="1" vertex="1">
<mxGeometry x="210" y="248" width="430" height="61" as="geometry" /> <mxGeometry x="210" y="248" width="430" height="61" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-118" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-84" target="NpWbz43RdM9-YawIMZhB-85"> <mxCell id="NpWbz43RdM9-YawIMZhB-118" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-84" target="NpWbz43RdM9-YawIMZhB-85" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-84" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-84" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" parent="1" vertex="1">
<mxGeometry x="210" y="329" width="430" height="90" as="geometry" /> <mxGeometry x="210" y="329" width="430" height="90" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-122" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-85" target="NpWbz43RdM9-YawIMZhB-70"> <mxCell id="NpWbz43RdM9-YawIMZhB-122" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="NpWbz43RdM9-YawIMZhB-85" target="NpWbz43RdM9-YawIMZhB-70" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-85" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-85" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" parent="1" vertex="1">
<mxGeometry x="210" y="438" width="430" height="110" as="geometry" /> <mxGeometry x="210" y="438" width="430" height="110" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-123" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-87" target="NpWbz43RdM9-YawIMZhB-111"> <mxCell id="NpWbz43RdM9-YawIMZhB-123" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="NpWbz43RdM9-YawIMZhB-87" target="NpWbz43RdM9-YawIMZhB-111" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-87" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-87" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;dashed=1;" parent="1" vertex="1">
<mxGeometry x="210" y="616" width="430" height="114" as="geometry" /> <mxGeometry x="210" y="616" width="430" height="114" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-78" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-90" target="NpWbz43RdM9-YawIMZhB-51"> <mxCell id="NpWbz43RdM9-YawIMZhB-78" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-90" target="NpWbz43RdM9-YawIMZhB-51" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-50" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-50" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="910" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="1005" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-35" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-35" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="646" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="646" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-3" target="NpWbz43RdM9-YawIMZhB-12"> <mxCell id="NpWbz43RdM9-YawIMZhB-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-3" target="NpWbz43RdM9-YawIMZhB-12" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-3" value="New Messages" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-3" value="New Messages" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="245" y="170" width="90" height="30" as="geometry" /> <mxGeometry x="245" y="170" width="90" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-68" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=-15;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-6" target="NpWbz43RdM9-YawIMZhB-19"> <mxCell id="NpWbz43RdM9-YawIMZhB-68" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=-15;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-6" target="NpWbz43RdM9-YawIMZhB-19" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-6" value="Memory" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-6" value="Memory" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="520" y="340" width="90" height="69" as="geometry" /> <mxGeometry x="520" y="340" width="90" height="69" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.13;exitY=0.77;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-10" target="NpWbz43RdM9-YawIMZhB-29"> <mxCell id="NpWbz43RdM9-YawIMZhB-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.13;exitY=0.77;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-10" target="NpWbz43RdM9-YawIMZhB-29" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-10" value="Model Client" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-10" value="Model Client" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="1" vertex="1">
<mxGeometry x="490" y="438" width="150" height="100" as="geometry" /> <mxGeometry x="490" y="438" width="150" height="100" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-89" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=60;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-11" target="NpWbz43RdM9-YawIMZhB-35"> <mxCell id="NpWbz43RdM9-YawIMZhB-89" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=60;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-11" target="NpWbz43RdM9-YawIMZhB-35" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-11" value="Tools" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-11" value="Tools" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="505" y="636" width="120" height="80" as="geometry" /> <mxGeometry x="505" y="636" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-12" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-12" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="259" width="120" height="40" as="geometry" /> <mxGeometry x="230" y="259" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-17" value="1. Add New Messages to Context" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-17" value="1. Add New Messages to Context" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="370" y="263.5" width="190" height="30" as="geometry" /> <mxGeometry x="370" y="263.5" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-19" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-19" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="349" width="120" height="60" as="geometry" /> <mxGeometry x="230" y="349" width="120" height="60" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-22" value="2. Update Context" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-22" value="2. Update Context" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="370" y="359" width="110" height="30" as="geometry" /> <mxGeometry x="370" y="359" width="110" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-24" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-24" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="349" width="120" height="40" as="geometry" /> <mxGeometry x="230" y="349" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0.25;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-27" target="NpWbz43RdM9-YawIMZhB-10"> <mxCell id="NpWbz43RdM9-YawIMZhB-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0.25;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-27" target="NpWbz43RdM9-YawIMZhB-10" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-31" value="3. Chat Completion" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-31" value="3. Chat Completion" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="370" y="475" width="110" height="30" as="geometry" /> <mxGeometry x="370" y="475" width="110" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-32" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-32" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="626" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="626" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-33" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-33" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="626" width="120" height="60" as="geometry" /> <mxGeometry x="230" y="626" width="120" height="60" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-34" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-34" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="626" width="120" height="40" as="geometry" /> <mxGeometry x="230" y="626" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-38" value="4. Tool Execution" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-38" value="4. Tool Execution" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="370" y="666" width="110" height="30" as="geometry" /> <mxGeometry x="370" y="666" width="110" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.13;exitY=0.77;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-41" target="NpWbz43RdM9-YawIMZhB-50"> <mxCell id="NpWbz43RdM9-YawIMZhB-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.13;exitY=0.77;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-41" target="NpWbz43RdM9-YawIMZhB-50" edge="1">
<mxGeometry relative="1" as="geometry"> <mxGeometry relative="1" as="geometry">
<mxPoint x="370" y="950" as="targetPoint" /> <mxPoint x="370" y="1045" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-41" value="Model Client" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-41" value="Model Client" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="1" vertex="1">
<mxGeometry x="490" y="870" width="150" height="100" as="geometry" /> <mxGeometry x="490" y="965" width="150" height="100" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0.25;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-49" target="NpWbz43RdM9-YawIMZhB-41"> <mxCell id="NpWbz43RdM9-YawIMZhB-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0.25;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-49" target="NpWbz43RdM9-YawIMZhB-41" edge="1">
<mxGeometry relative="1" as="geometry"> <mxGeometry relative="1" as="geometry">
<mxPoint x="370" y="910" as="sourcePoint" /> <mxPoint x="370" y="1005" as="sourcePoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-45" value="5. Chat Completion (Reflect on Tool Use)" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-45" value="5. Chat Completion (Reflect on Tool Use)" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="355" y="905" width="130" height="30" as="geometry" /> <mxGeometry x="355" y="1000" width="130" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-46" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-46" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="890" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="985" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-47" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-47" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="870" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="965" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-48" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-48" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="870" width="120" height="60" as="geometry" /> <mxGeometry x="230" y="965" width="120" height="60" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-49" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-49" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="870" width="120" height="40" as="geometry" /> <mxGeometry x="230" y="965" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-51" value="Response&lt;div&gt;(Text)&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-51" value="Response&lt;div&gt;(Text)&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="395" y="1040" width="60" height="30" as="geometry" /> <mxGeometry x="395" y="1135" width="60" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-53" value="Response&amp;nbsp;&lt;div&gt;(Tool Result Summary)&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-53" value="Response&amp;nbsp;&lt;div&gt;(Tool Result Summary)&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="10" y="806" width="140" height="30" as="geometry" /> <mxGeometry x="10" y="888" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-58" value="Response&amp;nbsp;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;(Text Message)&lt;/span&gt;&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-58" value="Response&amp;nbsp;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;(Text Message)&lt;/span&gt;&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="10" y="569" width="140" height="30" as="geometry" /> <mxGeometry x="10" y="569" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-67" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=15;entryPerimeter=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-24" target="NpWbz43RdM9-YawIMZhB-6"> <mxCell id="NpWbz43RdM9-YawIMZhB-67" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=15;entryPerimeter=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-24" target="NpWbz43RdM9-YawIMZhB-6" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-29" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-29" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="455" width="120" height="80" as="geometry" /> <mxGeometry x="230" y="455" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-26" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-26" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="455" width="120" height="60" as="geometry" /> <mxGeometry x="230" y="455" width="120" height="60" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-27" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-27" value="Model Context" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="230" y="455" width="120" height="40" as="geometry" /> <mxGeometry x="230" y="455" width="120" height="40" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-71" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-70" target="NpWbz43RdM9-YawIMZhB-58"> <mxCell id="NpWbz43RdM9-YawIMZhB-71" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="NpWbz43RdM9-YawIMZhB-70" target="NpWbz43RdM9-YawIMZhB-58" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-126" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-126" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry"> <mxGeometry relative="1" as="geometry">
<mxPoint x="422.75" y="599" as="sourcePoint" /> <mxPoint x="422.75" y="599" as="sourcePoint" />
<mxPoint x="424" y="616" as="targetPoint" /> <mxPoint x="424" y="616" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-70" value="Tool Call Detected?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-70" value="Tool Call Detected?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="367.5" y="569" width="112.5" height="30" as="geometry" /> <mxGeometry x="367.5" y="569" width="112.5" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-77" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-74" target="NpWbz43RdM9-YawIMZhB-53"> <mxCell id="NpWbz43RdM9-YawIMZhB-77" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-74" target="NpWbz43RdM9-YawIMZhB-53" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-124" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-74" target="NpWbz43RdM9-YawIMZhB-90"> <mxCell id="NpWbz43RdM9-YawIMZhB-124" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-74" target="NpWbz43RdM9-YawIMZhB-90" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-74" value="Reflect on Tool Use?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-74" value="Reflect on Tool Use?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="365.5" y="806" width="120" height="30" as="geometry" /> <mxGeometry x="365.5" y="888" width="120" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-106" value="No" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-106" value="No" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="230" y="560" width="60" height="30" as="geometry" /> <mxGeometry x="230" y="560" width="60" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-107" value="No" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-107" value="No" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="230" y="790" width="60" height="30" as="geometry" /> <mxGeometry x="230" y="877" width="60" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-110" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=30;entryPerimeter=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-34" target="NpWbz43RdM9-YawIMZhB-11"> <mxCell id="NpWbz43RdM9-YawIMZhB-110" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=30;entryPerimeter=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-34" target="NpWbz43RdM9-YawIMZhB-11" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-113" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-111" target="NpWbz43RdM9-YawIMZhB-112"> <mxCell id="NpWbz43RdM9-YawIMZhB-113" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NpWbz43RdM9-YawIMZhB-111" target="NpWbz43RdM9-YawIMZhB-112" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-117" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-111" target="NpWbz43RdM9-YawIMZhB-74"> <mxCell id="NpWbz43RdM9-YawIMZhB-117" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="ajhwLJHiypqY-D0M9j8j-1" target="NpWbz43RdM9-YawIMZhB-74" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-111" value="Handoff Detected?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;shadow=1;" vertex="1" parent="1"> <mxCell id="ajhwLJHiypqY-D0M9j8j-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="NpWbz43RdM9-YawIMZhB-111" target="ajhwLJHiypqY-D0M9j8j-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-111" value="Handoff Detected?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;shadow=1;" parent="1" vertex="1">
<mxGeometry x="370.75" y="754" width="110" height="30" as="geometry" /> <mxGeometry x="370.75" y="754" width="110" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-112" value="Response&lt;div&gt;(Handoff)&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-112" value="Response&lt;div&gt;(Handoff)&lt;/div&gt;" style="text;html=1;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="90" y="754" width="60" height="30" as="geometry" /> <mxGeometry x="90" y="754" width="60" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-115" value="Yes" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-115" value="Yes" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="230" y="744" width="60" height="30" as="geometry" /> <mxGeometry x="230" y="744" width="60" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="NpWbz43RdM9-YawIMZhB-127" value="Assistant Agent" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="NpWbz43RdM9-YawIMZhB-127" value="Assistant Agent" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="700" y="218" width="109.25" height="30" as="geometry" /> <mxGeometry x="700" y="218" width="109.25" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ajhwLJHiypqY-D0M9j8j-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="ajhwLJHiypqY-D0M9j8j-1" target="NpWbz43RdM9-YawIMZhB-85">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="660" y="835" />
<mxPoint x="660" y="493" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ajhwLJHiypqY-D0M9j8j-1" value="Maximum Tool Iterations Reached?" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="325" y="820" width="201" height="30" as="geometry" />
</mxCell>
<mxCell id="ajhwLJHiypqY-D0M9j8j-3" value="Yes" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="420.75" y="850" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="ajhwLJHiypqY-D0M9j8j-5" value="No" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="550" y="808" width="60" height="30" as="geometry" />
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>

View File

@ -32,6 +32,17 @@ html[data-theme="dark"] {
color: white; color: white;
text-shadow: 0.5px 0 0 currentColor; text-shadow: 0.5px 0 0 currentColor;
} }
/* Adding header icon hover and focus effects */
.bd-header a:focus-visible {
color: var(--pst-color-secondary) !important;
text-decoration: underline !important;
text-shadow: 0.5px 0 0 currentColor;
transform: scale(1.05);
transition: all 0.2s ease-in-out;
outline: none;
}
nav.bd-links .current>a { nav.bd-links .current>a {
box-shadow: inset 1px 0 0 var(--pst-color-primary); box-shadow: inset 1px 0 0 var(--pst-color-primary);
} }

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -8,6 +8,7 @@ from typing import Any, Dict
from pathlib import Path from pathlib import Path
import sys import sys
import os import os
import subprocess
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
@ -149,7 +150,7 @@ html_context = {
"github_user": "microsoft", "github_user": "microsoft",
"github_repo": "autogen", "github_repo": "autogen",
"github_version": "main", "github_version": "main",
"doc_path": "python/packages/autogen-core/docs/src/", "doc_path": "python/docs/src/",
} }
autodoc_default_options = { autodoc_default_options = {
@ -182,6 +183,42 @@ rediraffe_redirects = {
} }
def generate_api_reference() -> None:
"""Generate API documentation before building."""
reference_dir = Path(__file__).parent / "reference"
# Only generate if reference directory doesn't exist
if reference_dir.exists():
print("📁 Reference directory already exists, skipping API generation")
return
script_path = Path(__file__).parent / "generate_api_reference.py"
if script_path.exists():
print("🔄 Generating API documentation...")
try:
result = subprocess.run(
[sys.executable, str(script_path)],
cwd=script_path.parent,
capture_output=True,
text=True,
check=True
)
print("✅ API documentation generated successfully")
# Print the output for visibility
if result.stdout:
for line in result.stdout.strip().split('\n'):
print(f" {line}")
except subprocess.CalledProcessError as e:
print(f"❌ Failed to generate API documentation: {e}")
if e.stdout:
print(f"stdout: {e.stdout}")
if e.stderr:
print(f"stderr: {e.stderr}")
# Don't fail the build, just warn
else:
print(f"⚠️ API documentation generator not found at {script_path}")
def setup_to_main( def setup_to_main(
app: Sphinx, pagename: str, templatename: str, context, doctree app: Sphinx, pagename: str, templatename: str, context, doctree
) -> None: ) -> None:
@ -211,6 +248,9 @@ def setup(app: Sphinx) -> Dict[str, Any]:
Returns: Returns:
the 2 parallel parameters set to ``True``. the 2 parallel parameters set to ``True``.
""" """
# Generate API documentation before building
app.connect("builder-inited", lambda app: generate_api_reference())
app.connect("html-page-context", setup_to_main) app.connect("html-page-context", setup_to_main)
# Adding here so it is inline and not in a separate file. # Adding here so it is inline and not in a separate file.

View File

@ -0,0 +1,305 @@
#!/usr/bin/env python3
"""
Script to automatically generate the API reference table of contents for AutoGen.
This script scans all packages and their modules to generate the toctree entries
for the API documentation index.md file.
"""
import os
from pathlib import Path
from typing import List, Dict, Set
import re
# Constants for package filtering and organization
DOCUMENTED_PACKAGES = ["autogen_core", "autogen_agentchat", "autogen_ext"]
PACKAGE_SECTIONS = {
"autogen_agentchat": "AutoGen AgentChat",
"autogen_core": "AutoGen Core",
"autogen_ext": "AutoGen Extensions"
}
# Exclusion patterns for submodules that are re-exported by parent modules
EXCLUSION_PATTERNS = [
# task_centric_memory re-exports from memory_controller and utils
(r'^autogen_ext\.experimental\.task_centric_memory\.memory_controller$',
'autogen_ext.experimental.task_centric_memory'),
# utils package re-exports from utils.apprentice and other utils submodules
(r'^autogen_ext\.experimental\.task_centric_memory\.utils\.apprentice$',
'autogen_ext.experimental.task_centric_memory.utils'),
(r'^autogen_ext\.experimental\.task_centric_memory\.utils\.chat_completion_client_recorder$',
'autogen_ext.experimental.task_centric_memory.utils'),
(r'^autogen_ext\.experimental\.task_centric_memory\.utils\.grader$',
'autogen_ext.experimental.task_centric_memory.utils'),
(r'^autogen_ext\.experimental\.task_centric_memory\.utils\.page_logger$',
'autogen_ext.experimental.task_centric_memory.utils'),
(r'^autogen_ext\.experimental\.task_centric_memory\.utils\.teachability$',
'autogen_ext.experimental.task_centric_memory.utils'),
]
def is_private_module(module_parts: List[str]) -> bool:
"""Check if any part of the module path indicates it's a private module."""
return any(part.startswith('_') and part != '__init__' for part in module_parts)
def find_python_packages() -> List[Path]:
"""Find documented Python packages in the workspace."""
packages_dir = Path(__file__).parent.parent.parent / "packages"
python_packages = []
for package_dir in packages_dir.iterdir():
if package_dir.is_dir():
# Check if this package is in our documented packages list
package_name = package_dir.name.replace("-", "_")
if package_name in DOCUMENTED_PACKAGES:
src_dir = package_dir / "src"
if src_dir.exists():
python_packages.append(src_dir)
return python_packages
def get_module_hierarchy(package_root: Path) -> Dict[str, Set[str]]:
"""Get the module hierarchy for a package, filtering only documented packages."""
modules: Dict[str, Set[str]] = {}
for root, dirs, files in os.walk(package_root):
# Skip __pycache__ and hidden directories
dirs[:] = [d for d in dirs if not d.startswith('__pycache__') and not d.startswith('.')]
root_path = Path(root)
# Process Python files (excluding private modules)
for file in files:
if file.endswith('.py') and file != '__init__.py' and not file.startswith('_'):
file_path = root_path / file
module_path = file_path.relative_to(package_root)
# Convert file path to module name
module_parts = list(module_path.parts[:-1]) + [module_path.stem]
if module_parts:
# Skip if any part of the module path is private
if is_private_module(module_parts):
continue
module_name = '.'.join(module_parts)
package_name = module_parts[0]
# Only include modules from documented packages
if package_name in DOCUMENTED_PACKAGES:
if package_name not in modules:
modules[package_name] = set()
modules[package_name].add(module_name)
# Also check for directories with __init__.py (packages, excluding private)
for dir_name in dirs:
if not dir_name.startswith('_'): # Skip private directories
dir_path = root_path / dir_name
if (dir_path / '__init__.py').exists():
module_path = dir_path.relative_to(package_root)
module_parts = list(module_path.parts)
if module_parts:
# Skip if any part of the module path is private
if is_private_module(module_parts):
continue
module_name = '.'.join(module_parts)
package_name = module_parts[0]
# Only include modules from documented packages
if package_name in DOCUMENTED_PACKAGES:
if package_name not in modules:
modules[package_name] = set()
modules[package_name].add(module_name)
return modules
def should_exclude_submodule(module_name: str, all_modules: Set[str]) -> bool:
"""Check if a submodule should be excluded to avoid duplicate documentation."""
for pattern, parent_module in EXCLUSION_PATTERNS:
if re.match(pattern, module_name) and parent_module in all_modules:
return True
return False
def clean_rst_files(reference_dir: Path) -> None:
"""Clean existing RST files to ensure fresh generation."""
python_ref_dir = reference_dir / "python"
if python_ref_dir.exists():
print("🧹 Cleaning existing .rst files...")
rst_files = list(python_ref_dir.glob("*.rst"))
for rst_file in rst_files:
rst_file.unlink()
print(f" Removed {len(rst_files)} existing .rst files")
def generate_rst_files(package_roots: List[Path], reference_dir: Path) -> Set[str]:
"""Generate .rst files for all modules found in the packages."""
python_ref_dir = reference_dir / "python"
python_ref_dir.mkdir(exist_ok=True, parents=True)
# Clean existing RST files first
clean_rst_files(reference_dir)
generated_files = set()
all_module_names = set()
# First pass: collect all module names
for package_root in package_roots:
modules = get_module_hierarchy(package_root)
for package_name, module_set in modules.items():
all_module_names.update(module_set)
# Second pass: generate RST files, excluding problematic submodules
for package_root in package_roots:
modules = get_module_hierarchy(package_root)
for package_name, module_set in modules.items():
for module_name in module_set:
# Skip modules that would cause duplicate documentation
if should_exclude_submodule(module_name, all_module_names):
print(f" Skipping {module_name} (re-exported by parent)")
continue
# Use the proper RST filename pattern (keep dots for submodules)
rst_filename = module_name + '.rst'
rst_path = python_ref_dir / rst_filename
# Generate .rst content with proper title formatting
# Title should use dots as separators, but escape underscores for RST
title = module_name.replace('_', r'\_')
underline = '=' * len(title) # Underline matches title length
rst_content = f"""{title}
{underline}
.. automodule:: {module_name}
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
"""
# Write the .rst file
with open(rst_path, 'w') as f:
f.write(rst_content)
generated_files.add(module_name)
return generated_files
def generate_toctree_from_rst_files(reference_dir: Path) -> Dict[str, List[str]]:
"""Generate toctree entries directly from existing .rst files."""
# Initialize sections using constants
toctree_sections: Dict[str, List[str]] = {section: [] for section in PACKAGE_SECTIONS.values()}
python_ref_dir = reference_dir / "python"
if not python_ref_dir.exists():
return toctree_sections
# Collect modules by package using constants
modules_by_section: Dict[str, List[str]] = {section: [] for section in PACKAGE_SECTIONS.values()}
# Get all .rst files and organize them by package
for rst_file in python_ref_dir.glob("*.rst"):
module_name = rst_file.stem # filename without .rst extension
# Find which documented package this module belongs to
for package_prefix, section_name in PACKAGE_SECTIONS.items():
if module_name.startswith(package_prefix):
modules_by_section[section_name].append(module_name)
break
# Sort modules so parent modules come before child modules
def sort_modules_hierarchically(modules):
"""Sort modules so that parent modules come before child modules."""
return sorted(modules, key=lambda x: (x.count('.'), x))
# Apply hierarchical sorting and convert to rst paths
for section_name, modules in modules_by_section.items():
toctree_sections[section_name] = [f"python/{m}" for m in sort_modules_hierarchically(modules)]
return toctree_sections
def generate_index_content(toctree_sections: Dict[str, List[str]]) -> str:
"""Generate the complete index.md content with automatic toctrees."""
content = """---
myst:
html_meta:
"description lang=en": |
AutoGen is a community-driven project. Learn how to get involved, contribute, and connect with the community.
---
# API Reference
"""
for section_name, modules in toctree_sections.items():
if modules: # Only add section if it has modules
content += f"""```{{toctree}}
:caption: {section_name}
:maxdepth: 2
"""
for module in modules:
content += f"{module}\n"
content += "```\n\n"
return content
def main():
"""Main function to generate the API documentation index."""
script_dir = Path(__file__).parent
reference_dir = script_dir / "reference"
index_file = reference_dir / "index.md"
print("🔍 Scanning Python packages...")
package_roots = find_python_packages()
all_modules = {}
for package_root in package_roots:
print(f" 📦 Scanning {package_root}")
modules = get_module_hierarchy(package_root)
all_modules.update(modules)
print("🏗️ Generating .rst files for all discovered modules...")
generated_files = generate_rst_files(package_roots, reference_dir)
print(f" Generated {len(generated_files)} .rst files")
print("📝 Generating toctree entries from .rst files...")
toctree_sections = generate_toctree_from_rst_files(reference_dir)
for section, modules in toctree_sections.items():
print(f" {section}: {len(modules)} modules")
print("✍️ Writing index.md...")
content = generate_index_content(toctree_sections)
with open(index_file, 'w') as f:
f.write(content)
print(f"✅ Generated API documentation index at {index_file}")
print("\n📖 Summary:")
total_modules = sum(len(modules) for modules in toctree_sections.values())
print(f" Total modules documented: {total_modules}")
for section, modules in toctree_sections.items():
if modules:
print(f" {section}: {len(modules)} modules")
if __name__ == "__main__":
main()

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -46,40 +46,12 @@ A framework for building AI agents and applications
::::{grid} ::::{grid}
:gutter: 2 :gutter: 2
:::{grid-item-card}
:shadow: none
:margin: 2 0 0 0
:columns: 12 12 6 6
<div class="sd-card-title sd-font-weight-bold docutils">
{fas}`book;pst-color-primary`
Magentic-One CLI [![PyPi magentic-one-cli](https://img.shields.io/badge/PyPi-magentic--one--cli-blue?logo=pypi)](https://pypi.org/project/magentic-one-cli/)
</div>
A console-based multi-agent assistant for web and file-based tasks.
Built on AgentChat.
```bash
pip install -U magentic-one-cli
m1 "Find flights from Seattle to Paris and format the result in a table"
```
+++
```{button-ref} user-guide/agentchat-user-guide/magentic-one
:color: secondary
Get Started
```
:::
:::{grid-item-card} {fas}`palette;pst-color-primary` Studio [![PyPi autogenstudio](https://img.shields.io/badge/PyPi-autogenstudio-blue?logo=pypi)](https://pypi.org/project/autogenstudio/) :::{grid-item-card} {fas}`palette;pst-color-primary` Studio [![PyPi autogenstudio](https://img.shields.io/badge/PyPi-autogenstudio-blue?logo=pypi)](https://pypi.org/project/autogenstudio/)
:shadow: none :shadow: none
:margin: 2 0 0 0 :margin: 2 0 0 0
:columns: 12 12 6 6 :columns: 12 12 12 12
An app for prototyping and managing agents without writing code. An web-based UI for prototyping with agents without writing code.
Built on AgentChat. Built on AgentChat.
```bash ```bash
@ -87,6 +59,8 @@ pip install -U autogenstudio
autogenstudio ui --port 8080 --appdir ./myapp autogenstudio ui --port 8080 --appdir ./myapp
``` ```
_Start here if you are new to AutoGen and want to prototype with agents without writing code._
+++ +++
```{button-ref} user-guide/autogenstudio-user-guide/index ```{button-ref} user-guide/autogenstudio-user-guide/index
@ -124,7 +98,7 @@ async def main() -> None:
asyncio.run(main()) asyncio.run(main())
``` ```
_Start here if you are building conversational agents. [Migrating from AutoGen 0.2?](./user-guide/agentchat-user-guide/migration-guide.md)._ _Start here if you are prototyping with agents using Python. [Migrating from AutoGen 0.2?](./user-guide/agentchat-user-guide/migration-guide.md)._
+++ +++
@ -147,7 +121,7 @@ An event-driven programming framework for building scalable multi-agent AI syste
* Research on multi-agent collaboration. * Research on multi-agent collaboration.
* Distributed agents for multi-language applications. * Distributed agents for multi-language applications.
_Start here if you are building workflows or distributed agent systems._ _Start here if you are getting serious about building multi-agent systems._
+++ +++
@ -167,7 +141,7 @@ Get Started
Implementations of Core and AgentChat components that interface with external services or other libraries. Implementations of Core and AgentChat components that interface with external services or other libraries.
You can find and use community extensions or create your own. Examples of built-in extensions: You can find and use community extensions or create your own. Examples of built-in extensions:
* {py:class}`~autogen_ext.tools.langchain.LangChainToolAdapter` for using LangChain tools. * {py:class}`~autogen_ext.tools.mcp.McpWorkbench` for using Model-Context Protocol (MCP) servers.
* {py:class}`~autogen_ext.agents.openai.OpenAIAssistantAgent` for using Assistant API. * {py:class}`~autogen_ext.agents.openai.OpenAIAssistantAgent` for using Assistant API.
* {py:class}`~autogen_ext.code_executors.docker.DockerCommandLineCodeExecutor` for running model-generated code in a Docker container. * {py:class}`~autogen_ext.code_executors.docker.DockerCommandLineCodeExecutor` for running model-generated code in a Docker container.
* {py:class}`~autogen_ext.runtimes.grpc.GrpcWorkerAgentRuntime` for distributed agents. * {py:class}`~autogen_ext.runtimes.grpc.GrpcWorkerAgentRuntime` for distributed agents.

View File

@ -16,7 +16,9 @@
"- {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_reset`: The abstract method that resets the agent to its initial state. This method is called when the agent is asked to reset itself.\n", "- {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_reset`: The abstract method that resets the agent to its initial state. This method is called when the agent is asked to reset itself.\n",
"- {py:attr}`~autogen_agentchat.agents.BaseChatAgent.produced_message_types`: The list of possible {py:class}`~autogen_agentchat.messages.BaseChatMessage` message types the agent can produce in its response.\n", "- {py:attr}`~autogen_agentchat.agents.BaseChatAgent.produced_message_types`: The list of possible {py:class}`~autogen_agentchat.messages.BaseChatMessage` message types the agent can produce in its response.\n",
"\n", "\n",
"Optionally, you can implement the the {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages_stream` method to stream messages as they are generated by the agent. If this method is not implemented, the agent\n", "Optionally, you can implement the the {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages_stream` method to stream messages as they are generated by the agent.\n",
"This method is called by {py:meth}`~autogen_agentchat.agents.BaseChatAgent.run_stream` to stream messages.\n",
"If this method is not implemented, the agent\n",
"uses the default implementation of {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages_stream`\n", "uses the default implementation of {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages_stream`\n",
"that calls the {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages` method and\n", "that calls the {py:meth}`~autogen_agentchat.agents.BaseChatAgent.on_messages` method and\n",
"yields all messages in the response." "yields all messages in the response."
@ -731,7 +733,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.12.3" "version": "3.12.7"
} }
}, },
"nbformat": 4, "nbformat": 4,

File diff suppressed because one or more lines are too long

View File

@ -68,6 +68,13 @@ Multi-agent coordination through a shared context and localized, tool-based sele
Get started with Magentic-One Get started with Magentic-One
::: :::
:::{grid-item-card} {fas}`sitemap;pst-color-primary` GraphFlow (Workflow)
:link: ./graph-flow.html
:link-alt: GraphFlow: Multi-agent workflows through a directed graph of agents.
Multi-agent workflows through a directed graph of agents.
:::
:::{grid-item-card} {fas}`brain;pst-color-primary` Memory :::{grid-item-card} {fas}`brain;pst-color-primary` Memory
:link: ./memory.html :link: ./memory.html
:link-alt: Memory: Add memory capabilities to your agents :link-alt: Memory: Add memory capabilities to your agents
@ -138,6 +145,7 @@ custom-agents
selector-group-chat selector-group-chat
swarm swarm
magentic-one magentic-one
graph-flow
memory memory
logging logging
serialize-components serialize-components

View File

@ -17,13 +17,19 @@ When installing AgentChat locally, we recommend using a virtual environment for
Create and activate: Create and activate:
Linux/Mac:
```bash ```bash
# On Windows, change `python3` to `python` (if `python` is Python 3).
python3 -m venv .venv python3 -m venv .venv
# On Windows, change `bin` to `scripts`.
source .venv/bin/activate source .venv/bin/activate
``` ```
Windows command-line:
```batch
# The command may be `python3` instead of `python` depending on your setup
python -m venv .venv
.venv\Scripts\activate.bat
```
To deactivate later, run: To deactivate later, run:
```bash ```bash

BIN
python/docs/src/user-guide/agentchat-user-guide/jaeger.png (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -272,6 +272,11 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"The string variables available in the selector prompt are:\n",
"- `{participants}`: The names of candidates for selection. The format is `[\"<name1>\", \"<name2>\", ...]`.\n",
"- `{roles}`: A newline-separated list of names and descriptions of the candidate agents. The format for each line is: `\"<name> : <description>\"`.\n",
"- `{history}`: The conversation history formatted as a double newline separated of names and message content. The format for each message is: `\"<name> : <message content>\"`.\n",
"\n",
"```{tip}\n", "```{tip}\n",
"Try not to overload the model with too much instruction in the selector prompt.\n", "Try not to overload the model with too much instruction in the selector prompt.\n",
"\n", "\n",
@ -433,6 +438,10 @@
"\n", "\n",
"```{note}\n", "```{note}\n",
"Returning `None` from the custom selector function will use the default model-based selection.\n", "Returning `None` from the custom selector function will use the default model-based selection.\n",
"``` \n",
"\n",
"```{note}\n",
"Custom selector functions are not [serialized](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/serialize-components.html) when `.dump_component()` is called on the SelectorGroupChat team . If you need to serialize team configurations with custom selector functions, consider implementing custom workflows and serialization logic.\n",
"```" "```"
] ]
}, },
@ -1018,7 +1027,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.12.9" "version": "3.12.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -19,6 +19,10 @@
" \n", " \n",
"```\n", "```\n",
"\n", "\n",
"```{note}\n",
"`selector_func` is not serializable and will be ignored during serialization and deserialization process.\n",
"```\n",
"\n",
" \n", " \n",
"### Termination Condition Example \n", "### Termination Condition Example \n",
"\n", "\n",

View File

@ -0,0 +1,331 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Tracing and Observability\n",
"\n",
"AutoGen has [built-in support for tracing](https://microsoft.github.io/autogen/dev/user-guide/core-user-guide/framework/telemetry.html) and observability for collecting comprehensive records on the execution of your application. This feature is useful for debugging, performance analysis, and understanding the flow of your application.\n",
"\n",
"This capability is powered by the [OpenTelemetry](https://opentelemetry.io/) library, which means you can use any OpenTelemetry-compatible backend to collect and analyze traces.\n",
"\n",
"AutoGen follows the [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/) for tracing, for agents and tools.\n",
"It also follows the [Semantic Conventions for GenAI Systems](https://opentelemetry.io/docs/specs/semconv/gen-ai/) currently under development.\n",
"\n",
"## Setup\n",
"\n",
"To begin, you need to install the OpenTelemetry Python package. You can do this using pip:\n",
"\n",
"```bash\n",
"pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc opentelemetry-instrumentation-openai\n",
"```\n",
"\n",
"Once you have the SDK installed, the simplest way to set up tracing in AutoGen is to:\n",
"\n",
"1. Configure an OpenTelemetry tracer provider\n",
"2. Set up an exporter to send traces to your backend\n",
"3. Connect the tracer provider to the AutoGen runtime\n",
"\n",
"## Telemetry Backend\n",
"\n",
"To collect and view traces, you need to set up a telemetry backend. Several open-source options are available, including Jaeger, Zipkin. For this example, we will use Jaeger as our telemetry backend.\n",
"\n",
"For a quick start, you can run Jaeger locally using Docker:\n",
"\n",
"```bash\n",
"docker run -d --name jaeger \\\n",
" -e COLLECTOR_OTLP_ENABLED=true \\\n",
" -p 16686:16686 \\\n",
" -p 4317:4317 \\\n",
" -p 4318:4318 \\\n",
" jaegertracing/all-in-one:latest\n",
"```\n",
"\n",
"This command starts a Jaeger instance that listens on port 16686 for the Jaeger UI and port 4317 for the OpenTelemetry collector. You can access the Jaeger UI at `http://localhost:16686`.\n",
"\n",
"## Tracing an AgentChat Team\n",
"\n",
"In the following section, we will review how to enable tracing with an AutoGen GroupChat team. The AutoGen runtime already supports open telemetry (automatically logging message metadata). To begin, we will create a tracing service that will be used to instrument the AutoGen runtime. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Overriding of current TracerProvider is not allowed\n",
"Attempting to instrument while already instrumented\n"
]
}
],
"source": [
"from opentelemetry import trace\n",
"from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter\n",
"from opentelemetry.instrumentation.openai import OpenAIInstrumentor\n",
"from opentelemetry.sdk.resources import Resource\n",
"from opentelemetry.sdk.trace import TracerProvider\n",
"from opentelemetry.sdk.trace.export import BatchSpanProcessor\n",
"\n",
"# Set up telemetry span exporter.\n",
"otel_exporter = OTLPSpanExporter(endpoint=\"http://localhost:4317\", insecure=True)\n",
"span_processor = BatchSpanProcessor(otel_exporter)\n",
"\n",
"# Set up telemetry trace provider.\n",
"tracer_provider = TracerProvider(resource=Resource({\"service.name\": \"autogen-test-agentchat\"}))\n",
"tracer_provider.add_span_processor(span_processor)\n",
"trace.set_tracer_provider(tracer_provider)\n",
"\n",
"# Instrument the OpenAI Python library\n",
"OpenAIInstrumentor().instrument()\n",
"\n",
"# we will get reference this tracer later using its service name\n",
"# tracer = trace.get_tracer(\"autogen-test-agentchat\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"All of the code to create a [team](./tutorial/teams.ipynb) should already be familiar to you.\n",
"\n",
"```{note}\n",
"AgentChat teams are run using the AutoGen Core's agent runtime.\n",
"In turn, the runtime is already instrumented to log, see [Core Telemetry Guide](../core-user-guide/framework/telemetry.md).\n",
"To disable the agent runtime telemetry, you can set the `trace_provider` to\n",
"`opentelemetry.trace.NoOpTraceProvider` in the runtime constructor.\n",
"\n",
"Additionally, you can set the environment varibale `AUTOGEN_DISABLE_RUNTIME_TRACING` to `true` to disable the agent runtime telemetry if you don't have access to the runtime constructor. For example, if you are using `ComponentConfig`.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from autogen_agentchat.agents import AssistantAgent\n",
"from autogen_agentchat.conditions import MaxMessageTermination, TextMentionTermination\n",
"from autogen_agentchat.teams import SelectorGroupChat\n",
"from autogen_agentchat.ui import Console\n",
"from autogen_core import SingleThreadedAgentRuntime\n",
"from autogen_ext.models.openai import OpenAIChatCompletionClient\n",
"\n",
"\n",
"def search_web_tool(query: str) -> str:\n",
" if \"2006-2007\" in query:\n",
" return \"\"\"Here are the total points scored by Miami Heat players in the 2006-2007 season:\n",
" Udonis Haslem: 844 points\n",
" Dwayne Wade: 1397 points\n",
" James Posey: 550 points\n",
" ...\n",
" \"\"\"\n",
" elif \"2007-2008\" in query:\n",
" return \"The number of total rebounds for Dwayne Wade in the Miami Heat season 2007-2008 is 214.\"\n",
" elif \"2008-2009\" in query:\n",
" return \"The number of total rebounds for Dwayne Wade in the Miami Heat season 2008-2009 is 398.\"\n",
" return \"No data found.\"\n",
"\n",
"\n",
"def percentage_change_tool(start: float, end: float) -> float:\n",
" return ((end - start) / start) * 100\n",
"\n",
"\n",
"async def main() -> None:\n",
" model_client = OpenAIChatCompletionClient(model=\"gpt-4o\")\n",
"\n",
" # Get a tracer with the default tracer provider.\n",
" tracer = trace.get_tracer(\"tracing-autogen-agentchat\")\n",
"\n",
" # Use the tracer to create a span for the main function.\n",
" with tracer.start_as_current_span(\"run_team\"):\n",
" planning_agent = AssistantAgent(\n",
" \"PlanningAgent\",\n",
" description=\"An agent for planning tasks, this agent should be the first to engage when given a new task.\",\n",
" model_client=model_client,\n",
" system_message=\"\"\"\n",
" You are a planning agent.\n",
" Your job is to break down complex tasks into smaller, manageable subtasks.\n",
" Your team members are:\n",
" WebSearchAgent: Searches for information\n",
" DataAnalystAgent: Performs calculations\n",
"\n",
" You only plan and delegate tasks - you do not execute them yourself.\n",
"\n",
" When assigning tasks, use this format:\n",
" 1. <agent> : <task>\n",
"\n",
" After all tasks are complete, summarize the findings and end with \"TERMINATE\".\n",
" \"\"\",\n",
" )\n",
"\n",
" web_search_agent = AssistantAgent(\n",
" \"WebSearchAgent\",\n",
" description=\"An agent for searching information on the web.\",\n",
" tools=[search_web_tool],\n",
" model_client=model_client,\n",
" system_message=\"\"\"\n",
" You are a web search agent.\n",
" Your only tool is search_tool - use it to find information.\n",
" You make only one search call at a time.\n",
" Once you have the results, you never do calculations based on them.\n",
" \"\"\",\n",
" )\n",
"\n",
" data_analyst_agent = AssistantAgent(\n",
" \"DataAnalystAgent\",\n",
" description=\"An agent for performing calculations.\",\n",
" model_client=model_client,\n",
" tools=[percentage_change_tool],\n",
" system_message=\"\"\"\n",
" You are a data analyst.\n",
" Given the tasks you have been assigned, you should analyze the data and provide results using the tools provided.\n",
" If you have not seen the data, ask for it.\n",
" \"\"\",\n",
" )\n",
"\n",
" text_mention_termination = TextMentionTermination(\"TERMINATE\")\n",
" max_messages_termination = MaxMessageTermination(max_messages=25)\n",
" termination = text_mention_termination | max_messages_termination\n",
"\n",
" selector_prompt = \"\"\"Select an agent to perform task.\n",
"\n",
" {roles}\n",
"\n",
" Current conversation context:\n",
" {history}\n",
"\n",
" Read the above conversation, then select an agent from {participants} to perform the next task.\n",
" Make sure the planner agent has assigned tasks before other agents start working.\n",
" Only select one agent.\n",
" \"\"\"\n",
"\n",
" task = \"Who was the Miami Heat player with the highest points in the 2006-2007 season, and what was the percentage change in his total rebounds between the 2007-2008 and 2008-2009 seasons?\"\n",
"\n",
" runtime = SingleThreadedAgentRuntime(\n",
" tracer_provider=trace.NoOpTracerProvider(), # Disable telemetry for runtime.\n",
" )\n",
" runtime.start()\n",
"\n",
" team = SelectorGroupChat(\n",
" [planning_agent, web_search_agent, data_analyst_agent],\n",
" model_client=model_client,\n",
" termination_condition=termination,\n",
" selector_prompt=selector_prompt,\n",
" allow_repeated_speaker=True,\n",
" runtime=runtime,\n",
" )\n",
" await Console(team.run_stream(task=task))\n",
"\n",
" await runtime.stop()\n",
"\n",
" await model_client.close()\n",
"\n",
"\n",
"# asyncio.run(main())"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"---------- TextMessage (user) ----------\n",
"Who was the Miami Heat player with the highest points in the 2006-2007 season, and what was the percentage change in his total rebounds between the 2007-2008 and 2008-2009 seasons?\n",
"---------- TextMessage (PlanningAgent) ----------\n",
"To find the information requested, we need to follow these steps:\n",
"\n",
"1. Identify the Miami Heat player with the highest points during the 2006-2007 season.\n",
"2. Get the total rebounds for that player in both the 2007-2008 and 2008-2009 seasons.\n",
"3. Calculate the percentage change in total rebounds between these two seasons.\n",
"\n",
"Here are the tasks assigned to achieve this:\n",
"\n",
"1. WebSearchAgent: Find the Miami Heat player with the highest points during the 2006-2007 season.\n",
"2. WebSearchAgent: After identifying the player, find the total rebounds for that player in the 2007-2008 and 2008-2009 seasons.\n",
"3. DataAnalystAgent: Calculate the percentage change in the player's total rebounds between the 2007-2008 and 2008-2009 seasons.\n",
"---------- ToolCallRequestEvent (WebSearchAgent) ----------\n",
"[FunctionCall(id='call_hS8yod9l6CYUllDveUffp58e', arguments='{\"query\":\"Miami Heat leading scorer 2006-2007 season\"}', name='search_web_tool')]\n",
"---------- ToolCallExecutionEvent (WebSearchAgent) ----------\n",
"[FunctionExecutionResult(content='Here are the total points scored by Miami Heat players in the 2006-2007 season:\\n Udonis Haslem: 844 points\\n Dwayne Wade: 1397 points\\n James Posey: 550 points\\n ...\\n ', name='search_web_tool', call_id='call_hS8yod9l6CYUllDveUffp58e', is_error=False)]\n",
"---------- ToolCallSummaryMessage (WebSearchAgent) ----------\n",
"Here are the total points scored by Miami Heat players in the 2006-2007 season:\n",
" Udonis Haslem: 844 points\n",
" Dwayne Wade: 1397 points\n",
" James Posey: 550 points\n",
" ...\n",
" \n",
"---------- ToolCallRequestEvent (WebSearchAgent) ----------\n",
"[FunctionCall(id='call_bUJxtpxUXFSxECDogye9WL0g', arguments='{\"query\":\"Dwyane Wade total rebounds in 2007-2008 season\"}', name='search_web_tool')]\n",
"---------- ToolCallExecutionEvent (WebSearchAgent) ----------\n",
"[FunctionExecutionResult(content='The number of total rebounds for Dwayne Wade in the Miami Heat season 2007-2008 is 214.', name='search_web_tool', call_id='call_bUJxtpxUXFSxECDogye9WL0g', is_error=False)]\n",
"---------- ToolCallSummaryMessage (WebSearchAgent) ----------\n",
"The number of total rebounds for Dwayne Wade in the Miami Heat season 2007-2008 is 214.\n",
"---------- ToolCallRequestEvent (WebSearchAgent) ----------\n",
"[FunctionCall(id='call_pgYNSDhhyodtteot56FRktxp', arguments='{\"query\":\"Dwyane Wade total rebounds in 2008-2009 season\"}', name='search_web_tool')]\n",
"---------- ToolCallExecutionEvent (WebSearchAgent) ----------\n",
"[FunctionExecutionResult(content='The number of total rebounds for Dwayne Wade in the Miami Heat season 2008-2009 is 398.', name='search_web_tool', call_id='call_pgYNSDhhyodtteot56FRktxp', is_error=False)]\n",
"---------- ToolCallSummaryMessage (WebSearchAgent) ----------\n",
"The number of total rebounds for Dwayne Wade in the Miami Heat season 2008-2009 is 398.\n",
"---------- ToolCallRequestEvent (DataAnalystAgent) ----------\n",
"[FunctionCall(id='call_A89acjYHlNDLzG09rVNJ0J6H', arguments='{\"start\":214,\"end\":398}', name='percentage_change_tool')]\n",
"---------- ToolCallExecutionEvent (DataAnalystAgent) ----------\n",
"[FunctionExecutionResult(content='85.98130841121495', name='percentage_change_tool', call_id='call_A89acjYHlNDLzG09rVNJ0J6H', is_error=False)]\n",
"---------- ToolCallSummaryMessage (DataAnalystAgent) ----------\n",
"85.98130841121495\n",
"---------- TextMessage (PlanningAgent) ----------\n",
"The Miami Heat player with the highest points during the 2006-2007 season was Dwyane Wade, who scored 1,397 points. \n",
"\n",
"The total rebounds for Dwyane Wade in the 2007-2008 season were 214, and in the 2008-2009 season, they were 398.\n",
"\n",
"The percentage change in his total rebounds between these two seasons is approximately 86.0%.\n",
"\n",
"TERMINATE\n"
]
}
],
"source": [
"await main()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can then use the Jaeger UI to view the traces collected from the application run above. \n",
"\n",
"![Jaeger UI](jaeger.png)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More