Skip to content

A programming framework for agentic AI

Add code executor modules in API doc and minor doc fixes (#4579)

Eric Zhuf5f364ccea99
diff --git a/python/packages/autogen-core/docs/src/reference/index.md b/python/packages/autogen-core/docs/src/reference/index.md
index c3e8dc104..c35ca1f9e 100644
--- a/python/packages/autogen-core/docs/src/reference/index.md
+++ b/python/packages/autogen-core/docs/src/reference/index.md
@@ -45,6 +45,9 @@ python/autogen_ext.agents.video_surfer
python/autogen_ext.agents.video_surfer.tools
python/autogen_ext.models
python/autogen_ext.tools
+python/autogen_ext.code_executors.local
+python/autogen_ext.code_executors.docker
+python/autogen_ext.code_executors.azure
python/autogen_ext.runtimes.grpc
```
diff --git a/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.azure.rst b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.azure.rst
new file mode 100644
index 000000000..08fd3bdcf
--- /dev/null
+++ b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.azure.rst
@@ -0,0 +1,8 @@
+autogen\_ext.code\_executors.azure
+==================================
+
+
+.. automodule:: autogen_ext.code_executors.azure
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.docker.rst b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.docker.rst
new file mode 100644
index 000000000..b4a9a287a
--- /dev/null
+++ b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.docker.rst
@@ -0,0 +1,8 @@
+autogen\_ext.code\_executors.docker
+===================================
+
+
+.. automodule:: autogen_ext.code_executors.docker
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.local.rst b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.local.rst
new file mode 100644
index 000000000..7fa6f06d6
--- /dev/null
+++ b/python/packages/autogen-core/docs/src/reference/python/autogen_ext.code_executors.local.rst
@@ -0,0 +1,8 @@
+autogen\_ext.code\_executors.local
+==================================
+
+
+.. automodule:: autogen_ext.code_executors.local
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/messages.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/messages.ipynb
index f677c02e5..e2d49d65f 100644
--- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/messages.ipynb
+++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/messages.ipynb
@@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In AutoGen, _messages_ facilitate communication and information exchange with other agents, orchestrators, and applications. AgentChat supports various message types, each designed for specific purposes."
+ "In AutoGen AgentChat, _messages_ facilitate communication and information exchange with other agents, orchestrators, and applications. AgentChat supports various message types, each designed for specific purposes."
]
},
{
@@ -67,11 +67,12 @@
}
],
"source": [
+ "from io import BytesIO\n",
+ "\n",
+ "import requests\n",
"from autogen_agentchat.messages import MultiModalMessage\n",
"from autogen_core import Image as AGImage\n",
"from PIL import Image\n",
- "from io import BytesIO\n",
- "import requests\n",
"\n",
"pil_image = Image.open(BytesIO(requests.get(\"https://picsum.photos/300/200\").content))\n",
"img = AGImage(pil_image)\n",
@@ -83,7 +84,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "The {py:class}`~autogen_agentchat.messages.TextMessage` and {py:class}`~autogen_agentchat.messages.MultiModalMessage` we have created can be passed to agents directly via the `agent.on_messages` method, or as tasks given to a team {py:meth}`~autogen_agentchat.teams.BaseGroupChat.run` method. Messages are also used in the responses of an agent. We will explain these in more detail in the next sections."
+ "The {py:class}`~autogen_agentchat.messages.TextMessage` and {py:class}`~autogen_agentchat.messages.MultiModalMessage` we have created can be passed to agents directly via the {py:class}`~autogen_agentchat.base.ChatAgent.on_messages` method, or as tasks given to a team {py:meth}`~autogen_agentchat.teams.BaseGroupChat.run` method. Messages are also used in the responses of an agent. We will explain these in more detail in [Agents](./agents.ipynb) and [Teams](./teams.ipynb)."
]
},
{
@@ -96,16 +97,17 @@
"\n",
"Examples of these include {py:class}`~autogen_agentchat.messages.ToolCallMessage`, which indicates that a request was made to call a tool, and {py:class}`~autogen_agentchat.messages.ToolCallResultMessage`, which contains the results of tool calls.\n",
"\n",
- "Typically, these messages are created by the agent itself and are usually contained in the `inner_messages` field of its response. If you are building a custom agent and have events that you want to communicate to other entities (e.g., a UI), you can append these to the `inner_messages` field of the response. We will show examples of this in the next sections.\n",
+ "Typically, these messages are created by the agent itself and are contained in the {py:attr}`~autogen_agentchat.base.Response.inner_messages` field of the {py:class}`~autogen_agentchat.base.Response` returned from {py:class}`~autogen_agentchat.base.ChatAgent.on_messages`. If you are building a custom agent and have events that you want to communicate to other entities (e.g., a UI), you can inlcude these in the {py:attr}`~autogen_agentchat.base.Response.inner_messages` field of the {py:class}`~autogen_agentchat.base.Response`. We will show examples of this in [Custom Agents](./custom-agents.ipynb).\n",
"\n",
"\n",
- "You can read about the full set of messages supported in AgentChat in the {py:mod}`~autogen_agentchat.messages` module. Note that this is not an exhaustive list, and you can create custom messages as needed by subclassing the {py:class}`~autogen_agentchat.messages.BaseMessage` class."
+ "You can read about the full set of messages supported in AgentChat in the {py:mod}`~autogen_agentchat.messages` module. \n",
+ "<!-- Note that this is not an exhaustive list, and you can create custom messages as needed by subclassing the {py:class}`~autogen_agentchat.messages.BaseMessage` class. -->"
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "agnext",
+ "display_name": ".venv",
"language": "python",
"name": "python3"
},
@@ -119,7 +121,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.9"
+ "version": "3.12.6"
}
},
"nbformat": 4,
diff --git a/python/packages/autogen-ext/src/autogen_ext/code_executors/local/__init__.py b/python/packages/autogen-ext/src/autogen_ext/code_executors/local/__init__.py
index 9055804d1..b538b373e 100644
--- a/python/packages/autogen-ext/src/autogen_ext/code_executors/local/__init__.py
+++ b/python/packages/autogen-ext/src/autogen_ext/code_executors/local/__init__.py
@@ -71,7 +71,8 @@ class LocalCommandLineCodeExecutor(CodeExecutor):
import asyncio
from autogen_core import CancellationToken
- from autogen_core.components.code_executor import CodeBlock, LocalCommandLineCodeExecutor
+ from autogen_core.code_executor import CodeBlock
+ from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor
async def example():