Skip to content

Commit 9b1260d

Browse files
ekzhujackgerrits
andauthored
docs: update AssistantAgent documentation with a new figure, attention and warning notes (microsoft#5099)
* docs: update AssistantAgent documentation with attention and warning notes * update --------- Co-authored-by: Jack Gerrits <[email protected]>
1 parent 8643ff6 commit 9b1260d

File tree

3 files changed

+215
-3
lines changed

3 files changed

+215
-3
lines changed

python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,31 @@ class AssistantAgent(BaseChatAgent, Component[AssistantAgentConfig]):
7777
the inner messages as they are created, and the :class:`~autogen_agentchat.base.Response`
7878
object as the last item before closing the generator.
7979
80-
.. note::
80+
.. attention::
8181
8282
The caller must only pass the new messages to the agent on each call
8383
to the :meth:`on_messages` or :meth:`on_messages_stream` method.
8484
The agent maintains its state between calls to these methods.
8585
Do not pass the entire conversation history to the agent on each call.
8686
87-
.. note::
87+
.. warning::
8888
The assistant agent is not thread-safe or coroutine-safe.
8989
It should not be shared between multiple tasks or coroutines, and it should
9090
not call its methods concurrently.
9191
92+
The following diagram shows how the assistant agent works:
93+
94+
.. image:: ../../images/assistant-agent.svg
95+
9296
Tool call behavior:
9397
9498
* 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`.
9599
* When the model returns tool calls, they will be executed right away:
96100
- 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.
97101
- 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`.
98103
99-
.. note::
104+
.. tip::
100105
By default, the tool call results are returned as response when tool calls are made.
101106
So it is recommended to pay attention to the formatting of the tools return values,
102107
especially if another agent is expecting them in a specific format.
@@ -111,6 +116,7 @@ class AssistantAgent(BaseChatAgent, Component[AssistantAgentConfig]):
111116
112117
.. note::
113118
If multiple handoffs are detected, only the first handoff is executed.
119+
To avoid this, disable parallel tool calls in the model client configuration.
114120
115121
116122
Limit context size sent to the model:

0 commit comments

Comments
 (0)