Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose β€œCustomize” or β€œDecline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose β€œAccept” or β€œDecline.” To make more detailed choices, choose β€œCustomize.”

AWS Logo
Menu

Your idea is my command: multi-agent collaboration for software development πŸ’‘πŸš€

Create your own virtual software company with Amazon Bedrock ⛰️ and ChatDev πŸ‘¨πŸΌβ€πŸ’» and use it to build custom applications through LLM-powered multi-agent interactions.

JoΓ£o Galego
Amazon Employee
Published Jun 3, 2024

Make your ideas go brrr... in minutes! ⏱️

πŸ¦₯ "Procrastination is like a credit card: it's a lot of fun until you get the bill" ―Christopher Parker
We all have that one super-secret, this-might-just-work idea that we're too afraid to share with others.
Yes, that one... the one that has always been there, a constant gnawing in the back of your mind reminding you not to procrastinate. The one that is just too good to pass up, but that you never seem to have the time nor the resources to work on.
What if we could change that? What if you had a whole team working for you 24/7? A dedicated workforce whose sole purpose in "life" is to turn your ideas... into reality?
If this sounds too good to be true, think again.
Today's blog post is about ChatDev πŸ‘¨β€πŸ’», an open source project for creating virtual software companies powered by AI agents, and some of my attempts to hack it using Amazon Bedrock.
If you never tried ChatDev (not to be confused with ChatDev IDE), here's the general idea.
You start by choosing a "team" (RoleConfig.json)
Meet the team...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
"Chief Executive Officer": [
"{chatdev_prompt}",
"You are Chief Executive Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"Your main responsibilities include being an active decision-maker on users' demands and other key policy issues, leader, manager, and executor. Your decision-making role involves high-level decisions about policy and strategy; and your communicator role can involve speaking to the organization's management and employees.",
"Here is a new customer's task: {task}.",
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs."
],
"Chief Product Officer": [
"{chatdev_prompt}",
"You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing.",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Counselor": [
"{chatdev_prompt}",
"You are Counselor. Now, we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"Your main responsibilities include asking what user and customer think and provide your valuable suggestions. ",
"Here is a new customer's task: {task}.",
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs."
],
"Chief Technology Officer": [
"{chatdev_prompt}",
"You are Chief Technology Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You are very familiar to information technology. You will make high-level decisions for the overarching technology infrastructure that closely align with the organization's goals, while you work alongside the organization's information technology (\"IT\") staff members to perform everyday operations.",
"Here is a new customer's task: {task}.",
"To complete the task, You must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Chief Human Resource Officer": [
"{chatdev_prompt}",
"You are Chief Human Resource Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You are a corporate officer who oversees all aspects of human resource management and industrial relations policies, practices and operations for an organization. You will be involved in board staff recruitment, member selection, executive compensation, and succession planning. Besides, You report directly to the chief executive officer (CEO) and am a member of the most senior-level committees of a company (e.g., executive committee or office of CEO).",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Programmer": [
"{chatdev_prompt}",
"You are Programmer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You can write/create computer software or applications by providing a specific programming language to the computer. You have extensive computing and coding experience in many varieties of programming languages and platforms, such as Python, Java, C, C++, HTML, CSS, JavaScript, XML, SQL, PHP, etc,.",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Code Reviewer": [
"{chatdev_prompt}",
"You are Code Reviewer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You can help programmers to assess source codes for software troubleshooting, fix bugs to increase code quality and robustness, and offer proposals to improve the source codes.",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Software Test Engineer": [
"{chatdev_prompt}",
"You are Software Test Engineer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You can use the software as intended to analyze its functional properties, design manual and automated test procedures to evaluate each software product, build and implement software evaluation test programs, and run test programs to ensure that testing protocols evaluate the software correctly.",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
],
"Chief Creative Officer": [
"{chatdev_prompt}",
"You are Chief Creative Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
"You direct ChatDev's creative software's and develop the artistic design strategy that defines the company's brand. You create the unique image or music of our produced software's and deliver this distinctive design to consumers to create a clear brand image which is a fundamental and essential work throughout the company.",
"Here is a new customer's task: {task}.",
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
]
}
and defining how the project will be structured (ChatChainConfig.json) - zoom in if needed πŸ”Ž
Both configurations are optional, but you'll get better results if you tweak the default configurations.
Once this is done, you just give "everyone" an idea to work on and just wait a couple of minutes ⏳
Need inspiration? πŸ€”πŸ’‘βœ¨ Check out the Community Contribution Software list.
ChatDev will be able to generate code, documentation and more, depending on the deliverables specified in the project configuration. Cool, right?
I'll dive deeper into the implementation in the next section, but for now, suffice it to say that every team member (agent) will be powered by one or more models through Amazon Bedrock.
Enough chit-chat about ChatDev... let's take it for a spin! 🎰
Want to learn more about ChatDev? πŸ‘€ Scroll all the way down to the References section!

Demo: ChatDev >> Amazon Bedrock ⛰️

πŸ™‹β€β™‚οΈ "There is only one boss. The customer" ―Sam Walton

Prerequisites βœ…

Before we get started, take some time perform the following prerequisite actions:
  1. Make sure these tools are installed and properly configured:
  2. Request model access via Amazon Bedrock
πŸ’‘ For more information on how enable model access, please refer to the Amazon Bedrock User Guide (Set up > Model access)

Steps πŸ‘£

Let's start by creating a new Conda environment to keep everything isolated
1
2
conda create -n chatdev-bedrock python=3.9
conda activate chatdev-bedrock
Instead of original project (OpenBMB/ChatDev), we'll clone the one attached to this pull request (PR)
1
2
3
4
# ❗ As of June 2024, the PR to add 'proxied' model support is still *open*
# https://github.com/OpenBMB/ChatDev/pull/379
git clone -b feat/custom-model https://github.com/JGalego/ChatDev
cd ChatDev
The idea behind this PR is to add support for custom models beyond those offered by OpenAI. The hack-y part is that we want to implement this without affecting the original functionality and with minimal code changes.
The solution, which is still under review (so you're free to think of a better one), is to use an OpenAI-compatible proxy like LiteLLM or Bedrock Access Gateway, and adjust the OpenAI environment variables (OPENAI_BASE_URL and OPENAI_API_KEY) accordingly.
We also need to add some environment variables to select the models for generating text (CHATDEV_CUSTOM_MODEL) and images (CHATDEV_CUSTOM_IMAGE_MODEL), but that's about it.
Let's go ahead and install the ChatDev dependencies
1
pip install -r requirements.txt
plus the LiteLLM Proxy with Boto3 so we can call Amazon Bedrock
1
pip install boto3 litellm[proxy]
Next, let's create a proxy configuration for the text (Claude 3 Sonnet) and image (SDXL) models
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# config.yaml
# Adapted from https://litellm.vercel.app/docs/proxy/configs

model_list:
- model_name: claude3-sonnet
litellm_params:
model: bedrock/anthropic.claude-3-sonnet-20240229-v1:0
aws_region_name: us-east-1
temperature: 0.0
- model_name: sdxl
litellm_params:
model: bedrock/stability.stable-diffusion-xl-v1
aws_region_name: us-east-1

litellm_settings:
drop_params: True
modify_params: True # hack to get around Claude's Message API restrictions

general_settings:
master_key: correct-horse-battery-staple
add some AWS credentials
1
2
3
4
5
6
7
# Option 1: (recommended) AWS CLI
aws configure

# Option 2: environment variables
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION=...
and fire up the LiteLLM proxy
1
litellm --config config.yaml
At this point, you should be able to open the LiteLLM API server on your browser (defaults to port 4000)
Finally, let's open a new window or tab
πŸ”” Don't forget to open the ChatDev folder and activate the Conda environment.
set up the OpenAI+ChatDev environment variables
1
2
3
4
5
6
7
8
# OpenAI
export OPENAI_BASE_URL=http://0.0.0.0:4000
export OPENAI_API_KEY=correct-horse-battery-staple

# ChatDev
export CHATDEV_CUSTOM_MODEL=claude3-sonnet
export CHATDEV_NUM_MAX_TOKEN=200000
export CHATDEV_CUSTOM_IMAGE_MODEL=sdxl
and kick things off
1
2
3
4
python3 run.py --task "Design a simple game of tic-tac-toe" \
--name "TicTacToe" \
--org "THUNLP" \
--config "Default"
ChatDev usually takes a few minutes ⏱️ to create the app and everything in it. The actual runtime will vary depending on the task complexity, model latency and several other factors.
As an optional step, you can open (yet another) window to start the Visualizer app
1
python3 visualizer/app.py
and track all communications within the team
✨ Take it for a spin, let me know what you think and feel free to share your creations in the comments section below ⬇️
Thanks for reading all the way to the end - see you next time! πŸ––
PS: I'm sure you can create something better than a boring game of tic-tac-toe βŒβ­• so let's pump those creative juices!
🎨 "You can't use up creativity. The more you use, the more you have" ―Maya Angelou

References

Articles πŸ“‘

Code πŸ‘©πŸ»β€πŸ’»


 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments

Log in to comment