From f6ced0b7394b093b599b6382f153f7233f636133 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sun, 31 Dec 2023 14:33:48 -0500 Subject: [PATCH 01/34] docker documentation --- README.md | 13 +++---------- samples/dockers/Dockerfile | 19 +++++++++++++++++++ samples/dockers/Dockerfile.dev | 30 ++++++++++++++++++++++++++++++ samples/dockers/Dockerfile.user | 19 +++++++++++++++++++ website/docs/Installation.md | 11 +++++++---- 5 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 samples/dockers/Dockerfile create mode 100644 samples/dockers/Dockerfile.dev create mode 100644 samples/dockers/Dockerfile.user diff --git a/README.md b/README.md index 3fe3139f873..6c9dd6af781 100644 --- a/README.md +++ b/README.md @@ -58,18 +58,11 @@ The easiest way to start playing is 2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration. 3. Start playing with the notebooks! -## Using existing docker image -Install docker, save your oai key into an environment variable name OPENAI_API_KEY, and then run the following. - -``` -docker pull yuandongtian/autogen:latest -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 docker.io/yuandongtian/autogen:latest -``` - -Then open `http://localhost:8081/` in your browser to use AutoGen. The UI is from `./samples/apps/autogen-assistant`. See docker hub [link](https://hub.docker.com/r/yuandongtian/autogen) for more details. - ## Installation +### Option 1. [Run AutoGen in Docker (suggested)](https://microsoft.github.io/autogen/docs/Installation#option-1-using-docker) + +### Option 2. Install AutoGen without Docker AutoGen requires **Python version >= 3.8, < 3.12**. It can be installed from pip: ```bash diff --git a/samples/dockers/Dockerfile b/samples/dockers/Dockerfile new file mode 100644 index 00000000000..cc5eeb28e91 --- /dev/null +++ b/samples/dockers/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.11-slim + +RUN : \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + software-properties-common \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + python3-venv \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && : + +RUN python3 -m venv /venv +ENV PATH=/venv/bin:$PATH +EXPOSE 8081 + +RUN cd /venv; pip install pyautogen autogenra +RUN pip install yfinance numpy scipy matplotlib pandas +RUN pip install beautifulsoup4 diff --git a/samples/dockers/Dockerfile.dev b/samples/dockers/Dockerfile.dev new file mode 100644 index 00000000000..7f85ac9e5b9 --- /dev/null +++ b/samples/dockers/Dockerfile.dev @@ -0,0 +1,30 @@ +# basic setup +FROM python:3.10 +RUN apt-get update && apt-get -y update +RUN apt-get install -y sudo git npm + +# Setup user to not run as root +RUN adduser --disabled-password --gecos '' autogen-dev +RUN adduser autogen-dev sudo +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER autogen-dev + +# Pull repo +RUN cd /home/autogen-dev && git clone https://github.com/microsoft/autogen.git +WORKDIR /home/autogen-dev/autogen + +# Install autogen (Note: extra components can be installed if needed) +RUN sudo pip install -e .[test] + +# Install precommit hooks +RUN pre-commit install + +# For docs +RUN sudo npm install --global yarn +RUN sudo pip install pydoc-markdown +RUN cd website +RUN yarn install --frozen-lockfile --ignore-engines + +# override default image starting point +CMD /bin/bash +ENTRYPOINT [] diff --git a/samples/dockers/Dockerfile.user b/samples/dockers/Dockerfile.user new file mode 100644 index 00000000000..cc5eeb28e91 --- /dev/null +++ b/samples/dockers/Dockerfile.user @@ -0,0 +1,19 @@ +FROM python:3.11-slim + +RUN : \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + software-properties-common \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + python3-venv \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && : + +RUN python3 -m venv /venv +ENV PATH=/venv/bin:$PATH +EXPOSE 8081 + +RUN cd /venv; pip install pyautogen autogenra +RUN pip install yfinance numpy scipy matplotlib pandas +RUN pip install beautifulsoup4 diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 60fc2e7cfd4..74cead111a0 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,10 +1,13 @@ # Installation -## Setup Virtual Environment +## Option 1: Using Docker +[TO Add Content] + +## Option 2: Use Virtual Environment When not using a docker container, we recommend using a virtual environment to install AutoGen. This will ensure that the dependencies for AutoGen are isolated from the rest of your system. -### Option 1: venv +### Option a: venv You can create a virtual environment with `venv` as below: ```bash @@ -17,7 +20,7 @@ The following command will deactivate the current `venv` environment: deactivate ``` -### Option 2: conda +### Option b: conda Another option is with `Conda`, Conda works better at solving dependency conflicts than pip. You can install it by following [this doc](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html), and then create a virtual environment as below: @@ -31,7 +34,7 @@ The following command will deactivate the current `conda` environment: conda deactivate ``` -### Option 3: poetry +### Option c: poetry Another option is with `poetry`, which is a dependency manager for Python. From fe4ed591c0ff12e917f2c8ac4c618d88dd8afa78 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sun, 31 Dec 2023 14:34:07 -0500 Subject: [PATCH 02/34] docker doc --- Dockerfile | 30 ------------------------------ samples/dockers/Dockerfile | 19 ------------------- 2 files changed, 49 deletions(-) delete mode 100644 Dockerfile delete mode 100644 samples/dockers/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7f85ac9e5b9..00000000000 --- a/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# basic setup -FROM python:3.10 -RUN apt-get update && apt-get -y update -RUN apt-get install -y sudo git npm - -# Setup user to not run as root -RUN adduser --disabled-password --gecos '' autogen-dev -RUN adduser autogen-dev sudo -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers -USER autogen-dev - -# Pull repo -RUN cd /home/autogen-dev && git clone https://github.com/microsoft/autogen.git -WORKDIR /home/autogen-dev/autogen - -# Install autogen (Note: extra components can be installed if needed) -RUN sudo pip install -e .[test] - -# Install precommit hooks -RUN pre-commit install - -# For docs -RUN sudo npm install --global yarn -RUN sudo pip install pydoc-markdown -RUN cd website -RUN yarn install --frozen-lockfile --ignore-engines - -# override default image starting point -CMD /bin/bash -ENTRYPOINT [] diff --git a/samples/dockers/Dockerfile b/samples/dockers/Dockerfile deleted file mode 100644 index cc5eeb28e91..00000000000 --- a/samples/dockers/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM python:3.11-slim - -RUN : \ - && apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - software-properties-common \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - python3-venv \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && : - -RUN python3 -m venv /venv -ENV PATH=/venv/bin:$PATH -EXPOSE 8081 - -RUN cd /venv; pip install pyautogen autogenra -RUN pip install yfinance numpy scipy matplotlib pandas -RUN pip install beautifulsoup4 From ca9b4351b2fd7cb0b87451b80ed5201eed930d70 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sun, 31 Dec 2023 14:59:19 -0500 Subject: [PATCH 03/34] clean contribute.md --- website/docs/Contribute.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index 4ed0ed755b6..984c9fe09b7 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -97,12 +97,8 @@ pip install -e autogen ### Docker -We provide a simple [Dockerfile](https://github.com/microsoft/autogen/blob/main/Dockerfile). +We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/sample/dockers/). -```bash -docker build https://github.com/microsoft/autogen.git#main -t autogen-dev -docker run -it autogen-dev -``` ### Develop in Remote Container From a7813d875852e3d160abd81dfa1f6f254460a7bf Mon Sep 17 00:00:00 2001 From: Yuandong Tian Date: Sun, 31 Dec 2023 20:02:51 -0800 Subject: [PATCH 04/34] minor change --- website/docs/Installation.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 42a5c198484..13f6f56749b 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -10,8 +10,11 @@ docker build -t autogen_user . -f Dockerfile.user Once you build the docker image, you can use `docker images` to check whether it has been created successfully. -Now suppose you have a AutoGen application in a current folder `test`, then you can mount it into the docker image and run it. In the example below, `test` is mounted into `/test` in the docker, and the script `twoagent.py` is executed in the docker. +Now suppose you have some AutoGen application in a current folder `test`, then you can mount it into the docker image and run it. In the example below, `test` is mounted into `/test` in the docker, and the script `twoagent.py` is executed in the docker. ``` +# Go back to the root folder of AutoGen +cd ../.. + # Mount the local folder test into docker image and run the script in the docker. docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/test:/test autogen_user:latest python /test/twoagent.py ``` From 19281689ea379b2bd3cb5bf9dd108a865747d481 Mon Sep 17 00:00:00 2001 From: Yuandong Tian Date: Sun, 31 Dec 2023 20:10:50 -0800 Subject: [PATCH 05/34] Add more detailed description --- website/docs/Installation.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 13f6f56749b..77167df1ab5 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,7 +1,12 @@ # Installation ## Option 1: Using Docker -Install docker, save your oai key into an environment variable name OPENAI_API_KEY, and then run the following: +Install docker (TODO: some introduction about the docker). Save your oai key into an environment variable name OPENAI_API_KEY, which can be done by adding the following line in your `~/.bashrc` (or `~/.zshrc`): +``` +export OPENAI_API_KEY="sk-xxxxxx" +``` + +Then build the docker image: ``` cd ./samples/dockers # Build a local docker image From 1d82c046b8dc5c32d875948fee38308d1de74c57 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Tue, 2 Jan 2024 01:09:20 -0500 Subject: [PATCH 06/34] add docker instructions --- website/docs/Installation.md | 38 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 77167df1ab5..d0cbfa4cda4 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,32 +1,38 @@ # Installation -## Option 1: Using Docker -Install docker (TODO: some introduction about the docker). Save your oai key into an environment variable name OPENAI_API_KEY, which can be done by adding the following line in your `~/.bashrc` (or `~/.zshrc`): +## Option 1: Using Docker (Recommended) +#### Step 1. Install [docker](https://www.docker.com/). + +Docker is recommended as a properly built docker image could provide isolated and consistent environment to run your code securely across platforms. Install docker following [this instruction](https://docs.docker.com/get-docker/). + +#### Step 2. Build a docker image + +AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfile: ``` -export OPENAI_API_KEY="sk-xxxxxx" +docker build -f sample/docker/Dockerfile.user -t autogen_img https://github.com/microsoft/autogen.git ``` +Once you build the docker image, you can use `docker images` to check whether it has been created successfully. + +#### Step 3. Run applications built with AutoGen from a docker image. + +**Save keys into environment variable:** +If your application needs an oai key, save your oai key into an environment variable `OPENAI_API_KEY`, which can be done by adding the following line in your `~/.bashrc` (or `~/.zshrc`), -Then build the docker image: ``` -cd ./samples/dockers -# Build a local docker image -docker build -t autogen_user . -f Dockerfile.user +export OPENAI_API_KEY="sk-xxxxxx" ``` -Once you build the docker image, you can use `docker images` to check whether it has been created successfully. +**Mount your code to the docker image and run your application from there:** Now suppose you have your application built with AutoGen in a folder named `myapp`. You can mount it into the docker image and run it. In the example below, the folder `myapp` is mounted into `/myapp` in the docker, and the script `main_twoagent.py` is executed in the docker. -Now suppose you have some AutoGen application in a current folder `test`, then you can mount it into the docker image and run it. In the example below, `test` is mounted into `/test` in the docker, and the script `twoagent.py` is executed in the docker. +```python +# Mount the local folder `myapp` into docker image and run the script in the docker. +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py ``` -# Go back to the root folder of AutoGen -cd ../.. -# Mount the local folder test into docker image and run the script in the docker. -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/test:/test autogen_user:latest python /test/twoagent.py -``` +Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) as below: -Similarly, you may also run AutoGen assistant (`./samples/apps/autogen-assistant`) as below: ``` -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_user:latest autogenra ui --host 0.0.0.0 +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_img:latest autogenra ui --host 0.0.0.0 ``` Then open `http://localhost:8081/` in your browser to use AutoGen assistant. From 5855d594eb723bd199b72398557d94cfdeaa747f Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Tue, 2 Jan 2024 16:52:25 -0500 Subject: [PATCH 07/34] more dockerfiles --- .../{Dockerfile.user => Dockerfile.base} | 6 +++--- samples/dockers/Dockerfile.dev | 7 +++++-- samples/dockers/Dockerfile.full | 21 +++++++++++++++++++ website/docs/Contribute.md | 12 ++++++++++- website/docs/Installation.md | 9 ++++++-- 5 files changed, 47 insertions(+), 8 deletions(-) rename samples/dockers/{Dockerfile.user => Dockerfile.base} (63%) create mode 100644 samples/dockers/Dockerfile.full diff --git a/samples/dockers/Dockerfile.user b/samples/dockers/Dockerfile.base similarity index 63% rename from samples/dockers/Dockerfile.user rename to samples/dockers/Dockerfile.base index e83b0a6180e..433f66a7714 100644 --- a/samples/dockers/Dockerfile.user +++ b/samples/dockers/Dockerfile.base @@ -14,8 +14,8 @@ RUN python3 -m venv /venv ENV PATH=/venv/bin:$PATH EXPOSE 8081 -RUN cd /venv; pip install pyautogen autogenra -RUN pip install yfinance numpy scipy matplotlib pandas -RUN pip install beautifulsoup4 +RUN cd /venv; pip install pyautogen +# Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/ +RUN pip install numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest beautifulsoup4 ENTRYPOINT [] diff --git a/samples/dockers/Dockerfile.dev b/samples/dockers/Dockerfile.dev index 7f85ac9e5b9..5e37bac4562 100644 --- a/samples/dockers/Dockerfile.dev +++ b/samples/dockers/Dockerfile.dev @@ -13,8 +13,8 @@ USER autogen-dev RUN cd /home/autogen-dev && git clone https://github.com/microsoft/autogen.git WORKDIR /home/autogen-dev/autogen -# Install autogen (Note: extra components can be installed if needed) -RUN sudo pip install -e .[test] +# Install autogen in editable mode (Note: extra components can be installed if needed) +RUN sudo pip install -e .[test,teachable,lmm,graphs] # Install precommit hooks RUN pre-commit install @@ -25,6 +25,9 @@ RUN sudo pip install pydoc-markdown RUN cd website RUN yarn install --frozen-lockfile --ignore-engines +# Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/ +RUN pip install numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest beautifulsoup4 + # override default image starting point CMD /bin/bash ENTRYPOINT [] diff --git a/samples/dockers/Dockerfile.full b/samples/dockers/Dockerfile.full new file mode 100644 index 00000000000..681becb4913 --- /dev/null +++ b/samples/dockers/Dockerfile.full @@ -0,0 +1,21 @@ +FROM python:3.11-slim + +RUN : \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + software-properties-common \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + python3-venv \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && : + +RUN python3 -m venv /venv +ENV PATH=/venv/bin:$PATH +EXPOSE 8081 + +RUN cd /venv; pip install pyautogen[teachable,lmm,graphs,retrievechat,mathchat,blendsearch] autogenra +# Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/ +RUN pip install numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest beautifulsoup4 + +ENTRYPOINT [] diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index 984c9fe09b7..eb802c5fa06 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -97,7 +97,17 @@ pip install -e autogen ### Docker -We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/sample/dockers/). +We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/sample/dockers/Dockerfile.dev) for developers to use. + +Use the following command line to build and run a docker image. + +``` +docker build -f sample/docker/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git + +docker run -it autogen-dev +``` + +Detailed instructions can be found [here](Installation.md#option-1-using-docker-recommended) ### Develop in Remote Container diff --git a/website/docs/Installation.md b/website/docs/Installation.md index d0cbfa4cda4..d8e19d22546 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -7,9 +7,14 @@ Docker is recommended as a properly built docker image could provide isolated an #### Step 2. Build a docker image -AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfile: +AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.baes`: ``` -docker build -f sample/docker/Dockerfile.user -t autogen_img https://github.com/microsoft/autogen.git +docker build -f sample/docker/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git +``` +which includes some common python libraries and essential dependencies of AutoGen, or build from `Dockerfile.full` which include additional dependencies for more advanced features of AutoGen with the following command line: + +``` +docker build -f sample/docker/Dockerfile.full -t autogen_img https://github.com/microsoft/autogen.git ``` Once you build the docker image, you can use `docker images` to check whether it has been created successfully. From 05ad1f07d2ab2e8fb927af18d73dac6865d70716 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Tue, 2 Jan 2024 16:55:14 -0500 Subject: [PATCH 08/34] readme update --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f4001b90da..fcae87df5ab 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,9 @@ The easiest way to start playing is ## Installation -### Option 1. [Run AutoGen in Docker (recommended)](https://microsoft.github.io/autogen/docs/Installation#option-1-using-docker) +### Option 1. Run AutoGen in Docker (recommended) + +Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/Installation#option-1-using-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker). ### Option 2. Install AutoGen without Docker AutoGen requires **Python version >= 3.8, < 3.12**. It can be installed from pip: From 71ba44b621e342265405526cc826d0c83819c774 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Tue, 2 Jan 2024 17:01:43 -0500 Subject: [PATCH 09/34] latest python --- samples/dockers/Dockerfile.base | 2 +- samples/dockers/Dockerfile.dev | 2 +- samples/dockers/Dockerfile.full | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/dockers/Dockerfile.base b/samples/dockers/Dockerfile.base index 433f66a7714..4d08608ff29 100644 --- a/samples/dockers/Dockerfile.base +++ b/samples/dockers/Dockerfile.base @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.11-slim-bookworm RUN : \ && apt-get update \ diff --git a/samples/dockers/Dockerfile.dev b/samples/dockers/Dockerfile.dev index 5e37bac4562..990eb40bd62 100644 --- a/samples/dockers/Dockerfile.dev +++ b/samples/dockers/Dockerfile.dev @@ -1,5 +1,5 @@ # basic setup -FROM python:3.10 +FROM python:3.11-slim-bookworm RUN apt-get update && apt-get -y update RUN apt-get install -y sudo git npm diff --git a/samples/dockers/Dockerfile.full b/samples/dockers/Dockerfile.full index 681becb4913..ac06dd547eb 100644 --- a/samples/dockers/Dockerfile.full +++ b/samples/dockers/Dockerfile.full @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.11-slim-bookworm RUN : \ && apt-get update \ From 2235094ced3924ab41a5f57484c716926de75a33 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Tue, 2 Jan 2024 18:16:32 -0500 Subject: [PATCH 10/34] dev docker python version --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 13eae66491a..2645445194f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See LICENSE file in the project root for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10 +FROM mcr.microsoft.com/vscode/devcontainers/python:3.10-bookworm # # Update the OS and maybe install packages From 7ec37a67eb70a8e49a3ba2bb9fe9600523229ef2 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 13:11:26 -0500 Subject: [PATCH 11/34] add version --- .devcontainer/Dockerfile | 2 +- website/docs/Installation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2645445194f..5bf2d4c27d8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See LICENSE file in the project root for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/vscode/devcontainers/python:3.10-bookworm +FROM mcr.microsoft.com/vscode/devcontainers/python:3.10 # # Update the OS and maybe install packages diff --git a/website/docs/Installation.md b/website/docs/Installation.md index d8e19d22546..2387f72d547 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,6 +1,6 @@ # Installation -## Option 1: Using Docker (Recommended) +## Option 1: Using Docker #### Step 1. Install [docker](https://www.docker.com/). Docker is recommended as a properly built docker image could provide isolated and consistent environment to run your code securely across platforms. Install docker following [this instruction](https://docs.docker.com/get-docker/). From ec9f2b863fccde03e3a8ab44e215246c49d88ff7 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 13:13:20 -0500 Subject: [PATCH 12/34] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fcae87df5ab..487d3945095 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The easiest way to start playing is ## Installation -### Option 1. Run AutoGen in Docker (recommended) +### Option 1. Run AutoGen in Docker Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/Installation#option-1-using-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker). From 465cabebe97e9308a046adacaeea5cabb000a497 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 13:21:00 -0500 Subject: [PATCH 13/34] improve doc --- README.md | 9 +++++---- website/docs/Installation.md | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 487d3945095..b04dc7747d4 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,14 @@ The easiest way to start playing is 2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration. 3. Start playing with the notebooks! -## Installation +## [Installation](https://microsoft.github.io/autogen/docs/Installation) -### Option 1. Run AutoGen in Docker +### Option 1. Install and Run AutoGen in Docker -Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/Installation#option-1-using-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker). +Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/Installation#option-1-install-and-run-autogen-in-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker). + +### Option 2. Install AutoGen Locally without Docker -### Option 2. Install AutoGen without Docker AutoGen requires **Python version >= 3.8, < 3.12**. It can be installed from pip: ```bash diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 2387f72d547..c4fd484e25a 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,6 +1,6 @@ # Installation -## Option 1: Using Docker +## Option 1: Install and Run AutoGen in Docker #### Step 1. Install [docker](https://www.docker.com/). Docker is recommended as a properly built docker image could provide isolated and consistent environment to run your code securely across platforms. Install docker following [this instruction](https://docs.docker.com/get-docker/). @@ -41,7 +41,7 @@ docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_img:latest ``` Then open `http://localhost:8081/` in your browser to use AutoGen assistant. -## Option 2: Use Virtual Environment +## Option 2: Install AutoGen Locally Using Virtual Environment When not using a docker container, we recommend using a virtual environment to install AutoGen. This will ensure that the dependencies for AutoGen are isolated from the rest of your system. From 9ce2b80b3f43824c1a4584c1d4a9d2a763b30e02 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 14:38:26 -0500 Subject: [PATCH 14/34] improve doc --- website/docs/Contribute.md | 2 +- website/docs/Installation.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index b5ea21d46a8..140ecbc8a1e 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -107,7 +107,7 @@ docker build -f sample/docker/Dockerfile.dev -t autogen_dev_img https://github.c docker run -it autogen-dev ``` -Detailed instructions can be found [here](Installation.md#option-1-using-docker-recommended) +Detailed instructions can be found [here](Installation.md#option-1-install-and-run-autogen-in-docker) ### Develop in Remote Container diff --git a/website/docs/Installation.md b/website/docs/Installation.md index c4fd484e25a..935ff850bf8 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -14,7 +14,7 @@ docker build -f sample/docker/Dockerfile.base -t autogen_img https://github.com/ which includes some common python libraries and essential dependencies of AutoGen, or build from `Dockerfile.full` which include additional dependencies for more advanced features of AutoGen with the following command line: ``` -docker build -f sample/docker/Dockerfile.full -t autogen_img https://github.com/microsoft/autogen.git +docker build -f sample/docker/Dockerfile.full -t autogen_full_img https://github.com/microsoft/autogen.git ``` Once you build the docker image, you can use `docker images` to check whether it has been created successfully. @@ -34,10 +34,10 @@ export OPENAI_API_KEY="sk-xxxxxx" docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py ``` -Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) as below: +Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full`)as below: ``` -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_img:latest autogenra ui --host 0.0.0.0 +docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_full_img:latest autogenra ui --host 0.0.0.0 ``` Then open `http://localhost:8081/` in your browser to use AutoGen assistant. From ef99ea2635e52990b694f5832fa9280be56350b0 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 14:41:39 -0500 Subject: [PATCH 15/34] path name --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 935ff850bf8..8d9ea3faf93 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -9,7 +9,7 @@ Docker is recommended as a properly built docker image could provide isolated an AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.baes`: ``` -docker build -f sample/docker/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git +docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git ``` which includes some common python libraries and essential dependencies of AutoGen, or build from `Dockerfile.full` which include additional dependencies for more advanced features of AutoGen with the following command line: From 535491131e7adc4a922c6e7a157bce856ac5bda8 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 14:47:13 -0500 Subject: [PATCH 16/34] naming --- website/docs/Contribute.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index 140ecbc8a1e..88f9a427936 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -102,12 +102,12 @@ We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/sample/d Use the following command line to build and run a docker image. ``` -docker build -f sample/docker/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git +docker build -f samples/dockers/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git -docker run -it autogen-dev +docker run -it autogen_dev_img ``` -Detailed instructions can be found [here](Installation.md#option-1-install-and-run-autogen-in-docker) +Detailed instructions can be found [here](Installation.md#option-1-install-and-run-autogen-in-docker). ### Develop in Remote Container From 3559f19e649ba441714908e83a9ed2bfb1813b37 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 20:24:36 -0500 Subject: [PATCH 17/34] Update website/docs/Installation.md Co-authored-by: Chi Wang --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 8d9ea3faf93..97f2eabe70a 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -39,7 +39,7 @@ Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autoge ``` docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_full_img:latest autogenra ui --host 0.0.0.0 ``` -Then open `http://localhost:8081/` in your browser to use AutoGen assistant. +Then open `http://localhost:8081/` in your browser to use AutoGen Studio. ## Option 2: Install AutoGen Locally Using Virtual Environment From 51b408265d309ac441c02fb28853e8e583759241 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Wed, 3 Jan 2024 20:25:08 -0500 Subject: [PATCH 18/34] Update website/docs/Installation.md Co-authored-by: Chi Wang --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 97f2eabe70a..03aa5e23bf8 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -7,7 +7,7 @@ Docker is recommended as a properly built docker image could provide isolated an #### Step 2. Build a docker image -AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.baes`: +AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.base`: ``` docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git ``` From 97ef73d45cb9da24f4e472431ba273e1fd696df7 Mon Sep 17 00:00:00 2001 From: Yuandong Tian Date: Wed, 3 Jan 2024 20:07:38 -0800 Subject: [PATCH 19/34] Add suggestion to install colima for Mac users --- website/docs/Installation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 03aa5e23bf8..5cdb6cbe16d 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -5,6 +5,8 @@ Docker is recommended as a properly built docker image could provide isolated and consistent environment to run your code securely across platforms. Install docker following [this instruction](https://docs.docker.com/get-docker/). +For Mac users, alternatively you may choose to install [colima](https://smallsharpsoftwaretools.com/tutorials/use-colima-to-run-docker-containers-on-macos/) to run docker containers, if there is any issues with starting the docker daemon. + #### Step 2. Build a docker image AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.base`: From 1d55fc4aee5bade05d07f85c7278c361ad4d980b Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:19:48 -0500 Subject: [PATCH 20/34] Update website/docs/Installation.md Co-authored-by: Chi Wang --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 5cdb6cbe16d..65f5b2facab 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -36,7 +36,7 @@ export OPENAI_API_KEY="sk-xxxxxx" docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py ``` -Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full`)as below: +Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full`) as below: ``` docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_full_img:latest autogenra ui --host 0.0.0.0 From 662aca80b2c13b67da4ccd2050d56db2ead9695c Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:21:18 -0500 Subject: [PATCH 21/34] Update website/docs/Installation.md Co-authored-by: olgavrou --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 65f5b2facab..94ac184b814 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -9,7 +9,7 @@ For Mac users, alternatively you may choose to install [colima](https://smallsha #### Step 2. Build a docker image -AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to built docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.base`: +AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to build docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.base`: ``` docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git ``` From c2c892d7b27f106c6944ee96ee536d9de007961c Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:23:32 -0500 Subject: [PATCH 22/34] update doc --- samples/dockers/Dockerfile.full | 2 +- website/docs/Installation.md | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/dockers/Dockerfile.full b/samples/dockers/Dockerfile.full index ac06dd547eb..4307177d0de 100644 --- a/samples/dockers/Dockerfile.full +++ b/samples/dockers/Dockerfile.full @@ -14,7 +14,7 @@ RUN python3 -m venv /venv ENV PATH=/venv/bin:$PATH EXPOSE 8081 -RUN cd /venv; pip install pyautogen[teachable,lmm,graphs,retrievechat,mathchat,blendsearch] autogenra +RUN cd /venv; pip install pyautogen[teachable,lmm,retrievechat,mathchat,blendsearch] autogenra # Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/ RUN pip install numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest beautifulsoup4 diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 5cdb6cbe16d..faba99846a4 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -1,9 +1,12 @@ # Installation ## Option 1: Install and Run AutoGen in Docker -#### Step 1. Install [docker](https://www.docker.com/). -Docker is recommended as a properly built docker image could provide isolated and consistent environment to run your code securely across platforms. Install docker following [this instruction](https://docs.docker.com/get-docker/). +[Docker](https://www.docker.com/) is a containerization platform that simplifies the setup and execution of your code. A properly built docker image could provide isolated and consistent environment to run your code securely across platforms. One option of using AutoGen is to run it in a docker container. Follow the steps below to install and run AutoGen in a docker container. + +#### Step 1. Install Docker. + +Install docker following [this instruction](https://docs.docker.com/get-docker/). For Mac users, alternatively you may choose to install [colima](https://smallsharpsoftwaretools.com/tutorials/use-colima-to-run-docker-containers-on-macos/) to run docker containers, if there is any issues with starting the docker daemon. From 646dcda484d167c01d7de3bafe0c759c896c14e4 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:26:23 -0500 Subject: [PATCH 23/34] typo --- website/docs/Contribute.md | 2 +- website/docs/Installation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index 88f9a427936..5dada0cd126 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -97,7 +97,7 @@ pip install -e autogen ### Docker -We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/sample/dockers/Dockerfile.dev) for developers to use. +We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/samples/dockers/Dockerfile.dev) for developers to use. Use the following command line to build and run a docker image. diff --git a/website/docs/Installation.md b/website/docs/Installation.md index ba043cb8703..0ff47b07958 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -19,7 +19,7 @@ docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.co which includes some common python libraries and essential dependencies of AutoGen, or build from `Dockerfile.full` which include additional dependencies for more advanced features of AutoGen with the following command line: ``` -docker build -f sample/docker/Dockerfile.full -t autogen_full_img https://github.com/microsoft/autogen.git +docker build -f samples/dockers/Dockerfile.full -t autogen_full_img https://github.com/microsoft/autogen.git ``` Once you build the docker image, you can use `docker images` to check whether it has been created successfully. From 719435cb3312b361e1bad3c54037812751cfb625 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:53:59 -0500 Subject: [PATCH 24/34] improve doc --- README.md | 4 ++-- website/docs/FAQ.md | 4 ++-- website/docs/Installation.md | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b04dc7747d4..c359cb12207 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ The easiest way to start playing is Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/Installation#option-1-install-and-run-autogen-in-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker). -### Option 2. Install AutoGen Locally without Docker +### Option 2. Install AutoGen Locally AutoGen requires **Python version >= 3.8, < 3.12**. It can be installed from pip: @@ -83,7 +83,7 @@ Find more options in [Installation](https://microsoft.github.io/autogen/docs/Ins -For [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution), we strongly recommend installing the Python docker package and using docker. +Even if you are installing AutoGen locally, for better user experience and seamless code execution, we recommend performing [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. To do so, you will need to install Python docker package and set `use_docker` to `True` in `code_execution_config`. For LLM inference configurations, check the [FAQs](https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints). diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index dcd4dab6f54..4f52118fd2f 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -71,8 +71,8 @@ The `AssistantAgent` doesn't save all the code by default, because there are cas We strongly recommend using docker to execute code. There are two ways to use docker: -1. Run autogen in a docker container. For example, when developing in GitHub codespace, the autogen runs in a docker container. -2. Run autogen outside of a docker, while perform code execution with a docker container. For this option, make sure the python package `docker` is installed. When it is not installed and `use_docker` is omitted in `code_execution_config`, the code will be executed locally (this behavior is subject to change in future). +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.md#option-1-install-and-run-autogen-in-docker) to install and run AutoGen in docker. +2. Run AutoGen outside of a docker, while perform code execution with a docker container. For this option, make sure the python package `docker` is installed. When it is not installed and `use_docker` is omitted in `code_execution_config`, the code will be executed locally (this behavior is subject to change in future). ### Enable Python 3 docker image diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 0ff47b07958..3ffaad78ce7 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -2,7 +2,7 @@ ## Option 1: Install and Run AutoGen in Docker -[Docker](https://www.docker.com/) is a containerization platform that simplifies the setup and execution of your code. A properly built docker image could provide isolated and consistent environment to run your code securely across platforms. One option of using AutoGen is to run it in a docker container. Follow the steps below to install and run AutoGen in a docker container. +[Docker](https://www.docker.com/) is a containerization platform that simplifies the setup and execution of your code. A properly built docker image could provide isolated and consistent environment to run your code securely across platforms. One option of using AutoGen is to install and run it in a docker container. You can do that in [Github codespace](https://codespaces.new/microsoft/autogen?quickstart=1) or follow the instructions below to do so. #### Step 1. Install Docker. @@ -12,9 +12,10 @@ For Mac users, alternatively you may choose to install [colima](https://smallsha #### Step 2. Build a docker image -AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to build docker images. Use the following command line to build a docker image named `autogen_img` (or some other name you like) one of the provided dockerfiles named `Dockerfile.base`: +AutoGen provides [dockerfiles](https://github.com/microsoft/autogen/tree/main/samples/dockers/) that could be used to build docker images. Use the following command line to build a docker image named `autogen_img` (or other names you prefer) from one of the provided dockerfiles named `Dockerfile.base`: + ``` -docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git +docker build -f samples/dockers/Dockerfile.base -t autogen_img https://github.com/microsoft/autogen.git#main ``` which includes some common python libraries and essential dependencies of AutoGen, or build from `Dockerfile.full` which include additional dependencies for more advanced features of AutoGen with the following command line: @@ -48,7 +49,7 @@ Then open `http://localhost:8081/` in your browser to use AutoGen Studio. ## Option 2: Install AutoGen Locally Using Virtual Environment -When not using a docker container, we recommend using a virtual environment to install AutoGen. This will ensure that the dependencies for AutoGen are isolated from the rest of your system. +When installing AutoGen locally, we recommend using a virtual environment for the installation. This will ensure that the dependencies for AutoGen are isolated from the rest of your system. ### Option a: venv @@ -139,9 +140,9 @@ Inference parameter tuning can be done via [`flaml.tune`](https://microsoft.gith ### Optional Dependencies - #### docker -For the best user experience and seamless code execution, we highly recommend using Docker with AutoGen. Docker is a containerization platform that simplifies the setup and execution of your code. Developing in a docker container, such as GitHub Codespace, also makes the development convenient. +For the best user experience and seamless code execution, even if you are installing AutoGen locally, we highly recommend using Docker for [code execution](FAQ.md#enable-python-3-docker-image). -When running AutoGen out of a docker container, to use docker for code execution, you also need to install the python package `docker`: +To use docker for code execution, you also need to install the python package `docker`: ```bash pip install docker ``` From 7815c686e3c8a2891f794ebcfe17b973425ee8f3 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:56:48 -0500 Subject: [PATCH 25/34] add more options in dev file --- samples/dockers/Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/dockers/Dockerfile.dev b/samples/dockers/Dockerfile.dev index 990eb40bd62..07c0bb35739 100644 --- a/samples/dockers/Dockerfile.dev +++ b/samples/dockers/Dockerfile.dev @@ -14,7 +14,7 @@ RUN cd /home/autogen-dev && git clone https://github.com/microsoft/autogen.git WORKDIR /home/autogen-dev/autogen # Install autogen in editable mode (Note: extra components can be installed if needed) -RUN sudo pip install -e .[test,teachable,lmm,graphs] +RUN sudo pip install -e .[test,teachable,lmm,retrievechat,mathchat,blendsearch] # Install precommit hooks RUN pre-commit install From 52329f76810692794730ee0b5024b2cbb3f11bbc Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 16:59:13 -0500 Subject: [PATCH 26/34] contrib --- website/docs/Contribute.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Contribute.md b/website/docs/Contribute.md index 5dada0cd126..eb8305e7d91 100644 --- a/website/docs/Contribute.md +++ b/website/docs/Contribute.md @@ -102,7 +102,7 @@ We provide [Dockerfiles](https://github.com/microsoft/autogen/blob/main/samples/ Use the following command line to build and run a docker image. ``` -docker build -f samples/dockers/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git +docker build -f samples/dockers/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git#main docker run -it autogen_dev_img ``` From 0f5e02c30305cc9575fe7f700ccc5499c01e3f27 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 17:07:11 -0500 Subject: [PATCH 27/34] add link to doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c359cb12207..5d0fac0da15 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Find more options in [Installation](https://microsoft.github.io/autogen/docs/Ins -Even if you are installing AutoGen locally, for better user experience and seamless code execution, we recommend performing [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. To do so, you will need to install Python docker package and set `use_docker` to `True` in `code_execution_config`. +Even if you are installing AutoGen locally out of docker, for better user experience and seamless code execution, we recommend performing [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. To do so, you will need to [install Python docker package](https://microsoft.github.io/autogen/docs/Installation#docker) and set `use_docker` to `True` in `code_execution_config`. For LLM inference configurations, check the [FAQs](https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints). From 46e77a19de6ce28bb00cf514ddb58e7340a7f7b8 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Thu, 4 Jan 2024 17:10:08 -0500 Subject: [PATCH 28/34] add link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d0fac0da15..4aec85e423a 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Minimal dependencies are installed without extra options. You can install extra pip install "pyautogen[blendsearch]" ``` --> -Find more options in [Installation](https://microsoft.github.io/autogen/docs/Installation). +Find more options in [Installation](https://microsoft.github.io/autogen/docs/Installation#option-2-install-autogen-locally-using-virtual-environment). From 4f8e086b41a064faba8115163af11f3ce218310a Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sat, 6 Jan 2024 19:07:38 -0500 Subject: [PATCH 29/34] Update website/docs/Installation.md Co-authored-by: Chi Wang --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 3ffaad78ce7..2459ff376fa 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -140,7 +140,7 @@ Inference parameter tuning can be done via [`flaml.tune`](https://microsoft.gith ### Optional Dependencies - #### docker -For the best user experience and seamless code execution, even if you are installing AutoGen locally, we highly recommend using Docker for [code execution](FAQ.md#enable-python-3-docker-image). +Even if you install AutoGen locally, we highly recommend using Docker for [code execution](FAQ.md#enable-python-3-docker-image). To use docker for code execution, you also need to install the python package `docker`: ```bash From 0941445bfd092cf0687df457160262d967a1008d Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sat, 6 Jan 2024 19:07:50 -0500 Subject: [PATCH 30/34] Update website/docs/Installation.md Co-authored-by: Chi Wang --- website/docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 2459ff376fa..453f60735b0 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -66,7 +66,7 @@ deactivate ### Option b: conda -Another option is with `Conda`, Conda works better at solving dependency conflicts than pip. You can install it by following [this doc](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html), +Another option is with `Conda`. You can install it by following [this doc](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html), and then create a virtual environment as below: ```bash conda create -n pyautogen python=3.10 # python 3.10 is recommended as it's stable and not too old From 716a5a04ff0d7e7e7ff2b7170b864c9439cf31f2 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sat, 6 Jan 2024 19:16:15 -0500 Subject: [PATCH 31/34] instruction --- README.md | 2 +- website/docs/Installation.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5078593c841..62d51727b48 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Find more options in [Installation](https://microsoft.github.io/autogen/docs/Ins -Even if you are installing AutoGen locally out of docker, for better user experience and seamless code execution, we recommend performing [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. To do so, you will need to [install Python docker package](https://microsoft.github.io/autogen/docs/Installation#docker) and set `use_docker` to `True` in `code_execution_config`. +Even if you are installing AutoGen locally out of docker, we recommend performing [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. Find more instructions [here](https://microsoft.github.io/autogen/docs/Installation#docker). For LLM inference configurations, check the [FAQs](https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints). diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 453f60735b0..d89df17330e 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -147,6 +147,19 @@ To use docker for code execution, you also need to install the python package `d pip install docker ``` +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.: +```python +user_proxy = autogen.UserProxyAgent( + name="agent", + human_input_mode="TERMINATE", + max_consecutive_auto_reply=10, + code_execution_config={"work_dir":"_output", "use_docker":"python:3"}, + llm_config=llm_config, + system_message=""""Reply TERMINATE if the task has been solved at full satisfaction. +Otherwise, reply CONTINUE, or the reason why the task is not solved yet.""" +) +``` + - #### blendsearch `pyautogen<0.2` offers a cost-effective hyperparameter optimization technique [EcoOptiGen](https://arxiv.org/abs/2303.04673) for tuning Large Language Models. Please install with the [blendsearch] option to use it. From 7f0d63dc2ecd23974fb45c535ad1e5460e3f0fe8 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sat, 6 Jan 2024 19:34:24 -0500 Subject: [PATCH 32/34] Update website/docs/FAQ.md Co-authored-by: Chi Wang --- website/docs/FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index 4f52118fd2f..56f75f73cfb 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -72,7 +72,7 @@ The `AssistantAgent` doesn't save all the code by default, because there are cas We strongly recommend using docker to execute code. There are two ways to use docker: 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.md#option-1-install-and-run-autogen-in-docker) to install and run AutoGen in docker. -2. Run AutoGen outside of a docker, while perform code execution with a docker container. For this option, make sure the python package `docker` is installed. When it is not installed and `use_docker` is omitted in `code_execution_config`, the code will be executed locally (this behavior is subject to change in future). +2. Run AutoGen outside of a docker, while performing code execution with a docker container. For this option, make sure the python package `docker` is installed and ... ### Enable Python 3 docker image From 9d90e75cfe15d9ef75ffa4859ff808460b650425 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sat, 6 Jan 2024 19:42:26 -0500 Subject: [PATCH 33/34] FAQ --- website/docs/FAQ.md | 2 +- website/docs/Installation.md | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index 56f75f73cfb..27057144e6d 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -72,7 +72,7 @@ The `AssistantAgent` doesn't save all the code by default, because there are cas We strongly recommend using docker to execute code. There are two ways to use docker: 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.md#option-1-install-and-run-autogen-in-docker) to install and run AutoGen in docker. -2. Run AutoGen outside of a docker, while performing code execution with a docker container. For this option, make sure the python package `docker` is installed and ... +2. Run AutoGen outside of a docker, while performing code execution with a docker container. For this option, set up docker and make sure the python package `docker` is installed. When not installed and `use_docker` is omitted in `code_execution_config`, the code will be executed locally (this behavior is subject to change in future). ### Enable Python 3 docker image diff --git a/website/docs/Installation.md b/website/docs/Installation.md index d89df17330e..c68f9646299 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -26,21 +26,14 @@ Once you build the docker image, you can use `docker images` to check whether it #### Step 3. Run applications built with AutoGen from a docker image. -**Save keys into environment variable:** -If your application needs an oai key, save your oai key into an environment variable `OPENAI_API_KEY`, which can be done by adding the following line in your `~/.bashrc` (or `~/.zshrc`), - -``` -export OPENAI_API_KEY="sk-xxxxxx" -``` - -**Mount your code to the docker image and run your application from there:** Now suppose you have your application built with AutoGen in a folder named `myapp`. You can mount it into the docker image and run it. In the example below, the folder `myapp` is mounted into `/myapp` in the docker, and the script `main_twoagent.py` is executed in the docker. +**Mount your code to the docker image and run your application from there:** Now suppose you have your application built with AutoGen in a main script named `twoagent.py` ([example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py)) in a folder named `myapp`. With the command line below, you can mont your folder and run the application in docker. ```python -# Mount the local folder `myapp` into docker image and run the script in the docker. -docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py +# Mount the local folder `myapp` into docker image and run the script named "twoagent.py" in the docker. +docker run -it -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py ``` -Similarly, you may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full`) as below: +You may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full` and you have set the environment variable `OPENAI_API_KEY` to your OpenAI API key) as below: ``` docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8081:8081 autogen_full_img:latest autogenra ui --host 0.0.0.0 From 7c49f31fe4e198eb277bc2d0da3b2cab76f3c5c2 Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Sun, 7 Jan 2024 18:11:54 -0500 Subject: [PATCH 34/34] comment autogen studio --- website/docs/Installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/Installation.md b/website/docs/Installation.md index c68f9646299..977fa3ed0ac 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -33,12 +33,12 @@ Once you build the docker image, you can use `docker images` to check whether it docker run -it -v `pwd`/myapp:/myapp autogen_img:latest python /myapp/main_twoagent.py ``` -You may also run [AutoGen Studio](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio) (assuming that you have built a docker image named `autogen_full_img` with `Dockerfile.full` and you have set the environment variable `OPENAI_API_KEY` to your OpenAI API key) as below: + ## Option 2: Install AutoGen Locally Using Virtual Environment