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: website/docs/FAQ.mdx
+32-17
Original file line number
Diff line number
Diff line change
@@ -71,31 +71,46 @@ in the system message. This line is in the default system message of the `Assist
71
71
If the `# filename` doesn't appear in the suggested code still, consider adding explicit instructions such as "save the code to disk" in the initial user message in `initiate_chat`.
72
72
The `AssistantAgent` doesn't save all the code by default, because there are cases in which one would just like to finish a task without saving the code.
73
73
74
-
## Code execution
74
+
## Legacy code executor
75
75
76
-
We strongly recommend using docker to execute code. There are two ways to use docker:
76
+
:::note
77
+
The new code executors offers more choices of execution backend.
78
+
Read more about [code executors](/docs/tutorial/code-executors).
79
+
:::
77
80
78
-
1. Run AutoGen in a docker container. For example, when developing in [GitHub codespace](https://codespaces.new/microsoft/autogen?quickstart=1), AutoGen runs in a docker container. If you are not developing in Github codespace, follow instructions [here](installation/Docker.md#option-1-install-and-run-autogen-in-docker) to install and run AutoGen in docker.
79
-
2. Run AutoGen outside of a docker, while performing code execution with a docker container. For this option, make sure docker is up and running. If you want to run the code locally (not recommended) then `use_docker` can be set to `False` in `code_execution_config` for each code-execution agent, or set `AUTOGEN_USE_DOCKER` to `False` as an environment variable.
81
+
The legacy code executor is used by specifying the `code_execution_config` in the agent's constructor.
80
82
81
-
### Enable Python 3 docker image
82
-
83
-
You might want to override the default docker image used for code execution. To do that set `use_docker` key of `code_execution_config` property to the name of the image. E.g.:
system_message=""""Reply TERMINATE if the task has been solved at full satisfaction.
92
-
Otherwise, reply CONTINUE, or the reason why the task is not solved yet."""
93
89
)
94
90
```
95
91
96
-
If you have problems with agents running `pip install` or get errors similar to `Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')`, you can choose **'python:3'** as image as shown in the code example above and that should solve the problem.
97
-
98
-
### Agents keep thanking each other when using `gpt-3.5-turbo`
92
+
In this example, the `code_execution_config` specifies that the code will be
93
+
executed in a docker container with the image `python:3`.
94
+
By default, the image name is `python:3-slim` if not specified.
95
+
The `work_dir` specifies the directory where the code will be executed.
96
+
If you have problems with agents running `pip install` or get errors similar to
97
+
`Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')`,
98
+
you can choose **'python:3'** as image as shown in the code example above and
99
+
that should solve the problem.
100
+
101
+
By default it runs code in a docker container. If you want to run code locally
102
+
(not recommended) then `use_docker` can be set to `False` in `code_execution_config`
103
+
for each code-execution agent, or set `AUTOGEN_USE_DOCKER` to `False` as an
104
+
environment variable.
105
+
106
+
You can also develop your AutoGen application in a docker container.
107
+
For example, when developing in [GitHub codespace](https://codespaces.new/microsoft/autogen?quickstart=1),
## Agents keep thanking each other when using `gpt-3.5-turbo`
99
114
100
115
When using `gpt-3.5-turbo` you may often encounter agents going into a "gratitude loop", meaning when they complete a task they will begin congratulating and thanking each other in a continuous loop. This is a limitation in the performance of `gpt-3.5-turbo`, in contrast to `gpt-4` which has no problem remembering instructions. This can hinder the experimentation experience when trying to test out your own use case with cheaper models.
Copy file name to clipboardExpand all lines: website/docs/installation/Installation.mdx
+19-25
Original file line number
Diff line number
Diff line change
@@ -78,35 +78,29 @@ pip install pyautogen
78
78
79
79
:::
80
80
81
+
## Install Docker for Code Execution
81
82
82
-
## Code execution with Docker (default)
83
+
We recommend using Docker for code execution.
84
+
To install Docker, follow the instructions for your operating system on the [Docker website](https://docs.docker.com/get-docker/).
83
85
84
-
Even if you install AutoGen locally, we highly recommend using Docker for [code execution](FAQ.mdx#code-execution).
85
-
86
-
The default behaviour for code-execution agents is for code execution to be performed in a docker container.
87
-
88
-
**To turn this off**: if you want to run the code locally (not recommended) then `use_docker` can be set to `False` in `code_execution_config` for each code-execution agent, or set `AUTOGEN_USE_DOCKER` to `False` as an environment variable.
89
-
90
-
You might want to override the default docker image used for code execution. To do that set `use_docker` key of `code_execution_config` property to the name of the image. E.g.:
86
+
A simple example of how to use Docker for code execution is shown below:
description="Software Coder, writes Python code as required and reiterates with feedback from the Code Reviewer.",
61
66
system_message="You are a senior Python developer, a specialist in writing succinct Python functions.",
62
-
llm_config=llm_config,
67
+
llm_config={"config_list": config_list},
63
68
)
64
69
65
70
# Code Reviewer agent
66
-
reviewer =autogen.AssistantAgent(
71
+
reviewer = AssistantAgent(
67
72
name="codeReviewer",
68
73
description="Code Reviewer, reviews written code for correctness, efficiency, and security. Asks the Software Coder to address issues.",
69
74
system_message="You are a Code Reviewer, experienced in checking code for correctness, efficiency, and security. Review and provide feedback to the Software Coder until you are satisfied, then return the word TERMINATE",
# Start the chat with a request to write a function
89
-
user_proxy.initiate_chat(
90
-
manager,
91
-
message="Write a Python function for the Fibonacci sequence, the function will have one parameter for the number in the sequence, which the function will return the Fibonacci number for."
92
-
)
93
-
# type exit to terminate the chat
95
+
from autogen.cache import Cache
96
+
97
+
# Cache LLM responses.
98
+
with Cache.disk() as cache:
99
+
# Start the chat with a request to write a function
100
+
user_proxy.initiate_chat(
101
+
manager,
102
+
message="Write a Python function for the Fibonacci sequence, the function will have one parameter for the number in the sequence, which the function will return the Fibonacci number for.",
0 commit comments