This is a proof of concept for collaborating with multiple AI agents on Slack.
git clone
this repository- Run
pip install -r requirements.txt
- Run
source venv/bin/activate
- Copy the
.env.example
file to.env
. Follow the stepts below to get the necessary tokens.
- Go to Slack API and create a new app.
- Name your app and select a workspace.
- Under
Socket Mode
- Enable Socket Mode
- Generate an app token. The app token starts with
xapp-
. - Copy the app token and use it in your
.env
file.
- Under
Event Subscriptions
- Enable events
- Subscribe to bot events:
message.channels
message.groups
message.im
message.mpim
- Under
OAuth & Permissions
- Add the following scopes:
app_mentions:read
chat:write
- Install the app to your workspace.
- Copy the
Bot User OAuth Token
(starting withxoxb-
) and use it in your.env
file.
- Add the following scopes:
- Go to OpenAI and create an account (or log in).
- Under
Billing
, add a payment method and add some funds to your account. - Under
API Keys
, create a new API key. - Copy the API key and use it in your
.env
file.
- Make sure all environment variables are set in
.env
. - Run
python main.py
. - Invite the bot to a channel using
/invite @your-bot-name
. - Interact with an agent by mentioning it in a message, prefixed with an
!
. For example,Hello !echo, what's up?
.
Each agent's behavior can be customized through a YAML configuration file located in its directory. For example, the Echo agent's configuration is in src/agents/echo/config.yaml
.
agent_name
: The name used to invoke the agent in Slack (e.g., "echo" for!echo
)prompt_template
: The template used to format the agent's instructions to the LLMtemperature
: Controls the randomness of the LLM's responses (0.0 for deterministic, higher values for more creative responses)
# src/agents/echo/config.yaml
agent_name: "echo"
prompt_template: "Echo the following message: {text}"
temperature: 0.5
To modify an agent's behavior:
- Locate its configuration file in
src/agents/config/
- Adjust the parameters as needed
- Restart the application for changes to take effect