Code, samples, and a working app for creating and using a debate team of AI agents with with Agent AutoBuild.
Meant mainly as an example of what can be done with multiple agents and of how easy it is to create badly-needed teachingl tools with AI.
Autobuild is part of autogen from Microsoft. It partly automates the task of a creating a group of agents to coloborate on a task. It is low-code but not no-code.
builddebateteam.py in this repository builds a team of four debating agents, a moderator, and a judge to debate any proposition given to them. The agents are created as a JSON file, debateteam.json, which is then input to the user-facing debate application.
The depository is set up so that an application can be uploaded to the Streamlit cloud. That has been done and the application is here. The .gitignore and requirements.txt are specific to streamlit cloud.
debatemanager.py is incorporated in the streamlit app but also be run as standalone Python with a console-based interface to test debating and debate topics.
ststreamer.py is a helper module for the streamer app which reditects console output and streams it to the streamlit user while a long-running app (like a debate) is writing to console. It is usable independent of the rest of this code but is not on PyPi.
Click the URL https://debateteam.streamlit.app/. You will need an OPENAI api key in the paid tier. The free api key will not work because the agents use GPT4.
- clone the repository.
- make any changes you want to make.
- be sure to update .gitignore and requirements.txt as needed.
- deploy from Streamlit (you need an acount, of course).
- download builddebateteamm.py and SAMPLE.env into your favorite IDE.
- modify SAMPLE.env by addind your own paid OPENAI api key where indicated. The free api key will not work because the agents and agentbuilder use GPT4.
- save as .env.
- pip install autogen[autobuild]
- change the text of building_task in builddebateteam tyo whatever you want.
- run.
- you will be prompted for an optional test debate topic and a name for the saved debate team.
- if you use your debate team with either debatemanager or a Streamlit app, be sure to specifiy the name and location of your debate team json file in debatemanager main_ or streamlit_app.py as appropriate. If you uploaded the json file containing your debate team speciifcation to your own repository or somewhere else, you can give the url ratther than a file address.
- download ststreamer.py (it's not on PyPi).
- import ststreamer into the code that you're writing
- write a function like this and use it to call your function.
# Function to capture the console output
def capture_console_output(func, *args, **kwargs):
f = ststreamer.ObservableStringIO()
with redirect_stdout(f):
func(*args, **kwargs)
output = f.getvalue()
return output
Let one or more of the debaters be humans
Empower the debaters to do research
Empower the judge to fact-check
Implement with an open source LLM
No code here explititly collects any information of any kind. However, some usage stastics are available from both github and Streamlit.
This all comes with no warranty of any kind nor any promise to fix problems or maintain compatabity with the code it uses. However, bug reports, issues, and enhancement pull requests are welcome.