Skip to content

AutoGen Tutorial #1702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3aade55
update intro
ekzhu Feb 15, 2024
db1b9fa
update intro
ekzhu Feb 15, 2024
29d4350
tutorial
ekzhu Feb 16, 2024
da827a7
update notebook
ekzhu Feb 17, 2024
0dc7181
Merge branch 'main' into tutorial
ekzhu Feb 17, 2024
8d7fe94
update notebooks
ekzhu Feb 17, 2024
c37bb05
update
ekzhu Feb 20, 2024
c626bbf
Merge branch 'main' into tutorial
ekzhu Feb 21, 2024
bd4eab1
merge
ekzhu Feb 21, 2024
cfd4999
add conversation patterns
ekzhu Feb 21, 2024
9f702d5
rename; delete unused files.
ekzhu Feb 21, 2024
633aa10
Reorganize new guides
jackgerrits Feb 21, 2024
d0238c0
Merge pull request #1751 from jackgerrits/tutorial_website_organization
ekzhu Feb 21, 2024
a8d0369
Improve intro, fix typos
gagb Feb 21, 2024
4516a7d
Merge pull request #1754 from microsoft/gagb-tutorial
ekzhu Feb 22, 2024
4cf31d5
add what is next
ekzhu Feb 22, 2024
fc70ffe
outline for code executor
ekzhu Feb 22, 2024
898e48d
initiate chats png
ekzhu Feb 23, 2024
b2838ee
Improve language
gagb Feb 23, 2024
591c81f
Improve language of human in the loop tutorial
gagb Feb 23, 2024
34d4e0c
Merge pull request #1774 from microsoft/gagb-tutorial
ekzhu Feb 24, 2024
48ca642
update
ekzhu Feb 25, 2024
c8ef623
update
ekzhu Feb 25, 2024
a72d15b
Merge branch 'main' into tutorial
ekzhu Feb 25, 2024
7098662
Update group chat
ekzhu Feb 25, 2024
160e8b9
code executor
ekzhu Feb 26, 2024
4d4b0ba
update convsersation patterns
ekzhu Feb 27, 2024
eda0473
Merge branch 'main' into tutorial
ekzhu Feb 29, 2024
82fe004
update code executor section to use legacy code executor
ekzhu Feb 29, 2024
5ef964b
Merge branch 'main' into tutorial
ekzhu Feb 29, 2024
e492193
Merge branch 'main' into tutorial
ekzhu Mar 1, 2024
012e558
update conversation pattern
ekzhu Mar 1, 2024
853edb4
redirect
ekzhu Mar 3, 2024
1319786
update figures
ekzhu Mar 3, 2024
1499737
Merge branch 'main' into tutorial
ekzhu Mar 3, 2024
c83d8d8
update whats next
ekzhu Mar 3, 2024
a0b816d
Break down chapter 2 into two chapters
gagb Mar 5, 2024
0b53c1e
Merge branch 'main' into tutorial
ekzhu Mar 6, 2024
f4cb6d6
udpate
ekzhu Mar 6, 2024
d65ec9c
Merge pull request #1864 from microsoft/gagb-tutorial
ekzhu Mar 6, 2024
39928c7
fix website build
jackgerrits Mar 7, 2024
41a7b55
Minor corrections of typos and grammar.
joshkyh Mar 7, 2024
e48e486
Merge branch 'main' into tutorial
ekzhu Mar 8, 2024
60dbd38
remove broken links, update sidebar
ekzhu Mar 8, 2024
91952f5
Merge branch 'main' into tutorial
ekzhu Mar 8, 2024
579840d
code executor update
ekzhu Mar 8, 2024
4d71e27
Suggest changes to the code executor section
jackgerrits Mar 8, 2024
904167f
update what is next
jackgerrits Mar 8, 2024
39a8c31
reorder
jackgerrits Mar 8, 2024
8a5a835
update getting started
jackgerrits Mar 8, 2024
5a3eadb
title
jackgerrits Mar 8, 2024
fa504fc
update navbar
jackgerrits Mar 8, 2024
d4c82d8
Delete website/docs/tutorial/what-is-next.ipynb
jackgerrits Mar 8, 2024
a967fb3
Merge pull request #1917 from jackgerrits/edits_to_tut
ekzhu Mar 8, 2024
cec33a6
update conversable patterns
ekzhu Mar 8, 2024
5bd2211
Improve language
gagb Mar 9, 2024
affb9f3
Fix typo
gagb Mar 9, 2024
4671bd8
Merge pull request #1927 from microsoft/gagb-tutorial
ekzhu Mar 9, 2024
dafa042
minor fixes
ekzhu Mar 9, 2024
0d5e4f1
Merge branch 'tutorial' of https://github.com/microsoft/autogen into …
ekzhu Mar 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ repos:
pyproject.toml |
website/static/img/ag.svg |
website/yarn.lock |
website/docs/tutorial/code-executors.ipynb |
notebook/.*
)$
- repo: https://github.com/nbQA-dev/nbQA
Expand Down
11 changes: 11 additions & 0 deletions website/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
docs/Tutorial/code_executor_files/figure-markdown_strict/cell-8-output-1.png filter=lfs diff=lfs merge=lfs -text
docs/Tutorial/assets/Human-in-the-loop.png filter=lfs diff=lfs merge=lfs -text
docs/Tutorial/assets/conversable-agent.png filter=lfs diff=lfs merge=lfs -text
docs/Tutorial/.cache/41/cache.db filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/nested-chats.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/sequential-two-agent-chat.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/two-agent-chat.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/code-execution-in-conversation.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/code-executor-docker.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/code-executor-no-docker.png filter=lfs diff=lfs merge=lfs -text
docs/tutorial/assets/group-chat.png filter=lfs diff=lfs merge=lfs -text
5 changes: 4 additions & 1 deletion website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ package-lock.json
docs/reference
/docs/notebooks

docs/tutorial/*.mdx
docs/tutorial/**/*.png
!docs/tutorial/assets/*.png
docs/topics/llm_configuration.mdx
docs/topics/code-execution/jupyter-code-executor.mdx
docs/topics/code-execution/*.mdx

# Misc
.DS_Store
Expand Down
78 changes: 0 additions & 78 deletions website/docs/Getting-Started.md

This file was deleted.

138 changes: 138 additions & 0 deletions website/docs/Getting-Started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Getting Started

AutoGen is a framework that enables development of LLM applications using
multiple agents that can converse with each other to solve tasks. AutoGen agents
are customizable, conversable, and seamlessly allow human participation. They
can operate in various modes that employ combinations of LLMs, human inputs, and
tools.

![AutoGen Overview](/img/autogen_agentchat.png)

### Main Features


- AutoGen enables building next-gen LLM applications based on [multi-agent
conversations](/docs/Use-Cases/agent_chat) with minimal effort. It simplifies
the orchestration, automation, and optimization of a complex LLM workflow. It
maximizes the performance of LLM models and overcomes their weaknesses.
- It supports [diverse conversation
patterns](/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns)
for complex workflows. With customizable and conversable agents, developers can
use AutoGen to build a wide range of conversation patterns concerning
conversation autonomy, the number of agents, and agent conversation topology.
- It provides a collection of working systems with different complexities. These
systems span a [wide range of
applications](/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen)
from various domains and complexities. This demonstrates how AutoGen can
easily support diverse conversation patterns.

AutoGen is powered by collaborative [research studies](/docs/Research) from
Microsoft, Penn State University, and University of Washington.

### Quickstart

```sh
pip install pyautogen
```

<Tabs>
<TabItem value="local" label="Local execution" default>
:::warning
When asked, be sure to check the generated code before continuing to ensure it is safe to run.
:::

```python
from autogen import AssistantAgent, UserProxyAgent
from autogen.coding import LocalCommandLineCodeExecutor

import os
from pathlib import Path

llm_config = {
"config_list": [{"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}],
}

work_dir = Path("coding")
work_dir.mkdir(exist_ok=True)

assistant = AssistantAgent("assistant", llm_config=llm_config)

code_executor = LocalCommandLineCodeExecutor(work_dir=work_dir)
user_proxy = UserProxyAgent(
"user_proxy", code_execution_config={"executor": code_executor}
)

# Start the chat
user_proxy.initiate_chat(
assistant,
message="Plot a chart of NVDA and TESLA stock price change YTD.",
)
```

</TabItem>
<TabItem value="docker" label="Docker execution" default>


```python
from autogen import AssistantAgent, UserProxyAgent
from autogen.coding import DockerCommandLineCodeExecutor

import os
from pathlib import Path

llm_config = {
"config_list": [{"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}],
}

work_dir = Path("coding")
work_dir.mkdir(exist_ok=True)

with DockerCommandLineCodeExecutor(work_dir=work_dir) as code_executor:
assistant = AssistantAgent("assistant", llm_config=llm_config)
user_proxy = UserProxyAgent(
"user_proxy", code_execution_config={"executor": code_executor}
)

# Start the chat
user_proxy.initiate_chat(
assistant,
message="Plot a chart of NVDA and TESLA stock price change YTD. Save the plot to a file called plot.png",
)
```

Open `coding/plot.png` to see the generated plot.

</TabItem>
</Tabs>

:::tip
Learn more about configuring LLMs for agents [here](/docs/topics/llm_configuration).
:::



#### Multi-Agent Conversation Framework
Autogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.
By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),

The figure below shows an example conversation flow with AutoGen.

![Agent Chat Example](/img/chat_example.png)


### Where to Go Next?

* Go through the [tutorial](/docs/tutorial/introduction) to learn more about the core concepts in AutoGen
* Read the examples and guides in the [notebooks section](/docs/notebooks)
* Understand the use cases for [multi-agent conversation](/docs/Use-Cases/agent_chat) and [enhanced LLM inference](/docs/Use-Cases/enhanced_inference)
* Read the [API](/docs/reference/agentchat/conversable_agent/) docs
* Learn about [research](/docs/Research) around AutoGen
* Chat on [Discord](https://discord.gg/pAbnFJrkgZ)
* Follow on [Twitter](https://twitter.com/pyautogen)

If you like our project, please give it a [star](https://github.com/microsoft/autogen/stargazers) on GitHub. If you are interested in contributing, please read [Contributor's Guide](/docs/Contribute).

<iframe src="https://ghbtns.com/github-btn.html?user=microsoft&amp;repo=autogen&amp;type=star&amp;count=true&amp;size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/code-executor-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/code-executor-no-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/conversable-agent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/group-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/human-in-the-loop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/nested-chats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/sequential-two-agent-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/tutorial/assets/two-agent-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading