You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py
+9-3
Original file line number
Diff line number
Diff line change
@@ -77,26 +77,31 @@ class AssistantAgent(BaseChatAgent, Component[AssistantAgentConfig]):
77
77
the inner messages as they are created, and the :class:`~autogen_agentchat.base.Response`
78
78
object as the last item before closing the generator.
79
79
80
-
.. note::
80
+
.. attention::
81
81
82
82
The caller must only pass the new messages to the agent on each call
83
83
to the :meth:`on_messages` or :meth:`on_messages_stream` method.
84
84
The agent maintains its state between calls to these methods.
85
85
Do not pass the entire conversation history to the agent on each call.
86
86
87
-
.. note::
87
+
.. warning::
88
88
The assistant agent is not thread-safe or coroutine-safe.
89
89
It should not be shared between multiple tasks or coroutines, and it should
90
90
not call its methods concurrently.
91
91
92
+
The following diagram shows how the assistant agent works:
93
+
94
+
.. image:: ../../images/assistant-agent.svg
95
+
92
96
Tool call behavior:
93
97
94
98
* If the model returns no tool call, then the response is immediately returned as a :class:`~autogen_agentchat.messages.TextMessage` in :attr:`~autogen_agentchat.base.Response.chat_message`.
95
99
* When the model returns tool calls, they will be executed right away:
96
100
- When `reflect_on_tool_use` is False (default), the tool call results are returned as a :class:`~autogen_agentchat.messages.ToolCallSummaryMessage` in :attr:`~autogen_agentchat.base.Response.chat_message`. `tool_call_summary_format` can be used to customize the tool call summary.
97
101
- When `reflect_on_tool_use` is True, the another model inference is made using the tool calls and results, and the text response is returned as a :class:`~autogen_agentchat.messages.TextMessage` in :attr:`~autogen_agentchat.base.Response.chat_message`.
102
+
* If the model returns multiple tool calls, they will be executed concurrently. To disable parallel tool calls you need to configure the model client. For example, set `parallel_tool_calls=False` for :class:`~autogen_ext.models.openai.OpenAIChatCompletionClient` and :class:`~autogen_ext.models.openai.AzureOpenAIChatCompletionClient`.
98
103
99
-
.. note::
104
+
.. tip::
100
105
By default, the tool call results are returned as response when tool calls are made.
101
106
So it is recommended to pay attention to the formatting of the tools return values,
102
107
especially if another agent is expecting them in a specific format.
@@ -111,6 +116,7 @@ class AssistantAgent(BaseChatAgent, Component[AssistantAgentConfig]):
111
116
112
117
.. note::
113
118
If multiple handoffs are detected, only the first handoff is executed.
119
+
To avoid this, disable parallel tool calls in the model client configuration.
0 commit comments