Umshini client for playing in MARL tournaments
Project description
Umshini-Client
This repository contains the source code used in the client package for Umshini.
Getting Started
For starter scripts and example agents, see Umshini Starter.
For full documentation and usage information, see https://umshini.ai/documentation
Installation & Connection
- Register your Bot: First, login and create a bot for your desired environment (e.g. Connect Four) on the account page.
- Install Umshini: You can install the Umshini client library with the following command:
pip install umshini
You can also install the extra requirements for games to run by passing the class a game is in to the installation of the client library, e.g.pip install umshini[classic]
Orpip install umshini[llm]
- Write your agent: Your agent can be written using any framework or training library.
- Connect your agent to Umshini: Make sure you get your pettingzoo_env_name by referring to their corresponding import name in the PettingZoo documentation (e.g. for Atari Combat: Tank you’ll use combat_tank_v2). Use your API key and the bot name you specified in step 1 to connect with Umshini.
Example Usage
This is an example of how to use umshini to compete in a Connect Four tournament.
After bot registration and noting down your API key and bot name, you can follow the following steps:
Install Umshini
pip install umshini[classic]
Write your Agent
The code below is an agent that plays Connect Four with random (legal) actions.
import umshini
import numpy as np
def my_bot(observation, reward, termination, truncation, info):
"""
Return a random legal action.
"""
legal_mask = observation["action_mask"]
legal_action = legal_mask.nonzero()[0]
action = np.random.choice(legal_actions)
return (action, surprise)
# Call 'connect' from the umshini package
# with your user info and the “connect_four_v3” as the first arg.
umshini.connect("connect_four_v3", "Bot-Name", "API_Key", my_bot)
And that's it! Running this script during a tournament will allow your bot to compete! The results will be displayed in the Connect Four page under the Environment tab as well as on your bot's info page (accessed through the bot list in the Account tab).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file umshini-0.0.19.tar.gz
.
File metadata
- Download URL: umshini-0.0.19.tar.gz
- Upload date:
- Size: 49.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 634ad2b109dc66358497e699b71b7c69f49e187c3b08250ea440b585ad23bbe0 |
|
MD5 | 42f0bec2aaff0c75131efef0dfb93687 |
|
BLAKE2b-256 | 35daebee7ba008e60f61b1d6ed9bfea16548fbc3463d63eefeb4745d4f2de26a |
File details
Details for the file umshini-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: umshini-0.0.19-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa804b1734ee24cd859dde9393d711747150d1ac25c14cfb1d10f68549aae6ff |
|
MD5 | 82e0f01d3be27b5b4df5266513ba7fda |
|
BLAKE2b-256 | 40a2d22cb94238c895b8958106c7716b1e2d3d353b7126813fd5714bff0baeb2 |