Skip to main content

A client to work with Agents Bar (https://agents.bar).

Project description

Agents Bar Python Client

This package is a python client for Agents Bar service. It isn't supposed to be used in an isolation and you are supposed to have an existing account. Check the website for more information about the service, or check the Agents Bar Docs to learn more how to use this client.

Quick start

The client allows to communicate with service by wrapping around APIs and coveraging common use patterns.

A common usage is replacing your deep reinforcement learning agent with an entity that uses step and act APIs for progressing agent and infering action, respectively. For usage examples as Google Colab check Doc's quick start link and for scripts check examples directory.

For a minimal (almost) working example check this code snippet:

env = gym.make('CartPole-v1')  # OpenAI Gym
agent = RemoteAgent(obs_size=4, action_size=2, agent_model="DQN", agent_name="DQN_Test")
obs = env.reset().tolist()

for iteration in range(10):
    action = agent.act(obs, eps)

    next_obs, reward, done, _ = env.step(action)
    next_obs = next_obs.tolist()

    agent.step(obs, action, reward, next_obs, done)
    obs = next_obs

Installation

Pip (Recommended)

The latest stable version should always be accessible through pip as agents-bar. To install locally add agents-bar to your dependency file, e.g. requirements.txt, or install it directly using

pip install agents-bar

GitHub source

Checkout this package using git clone git@github.com:agents-bar/agents-bar-client-python. This will create a new directory agents-bar-client-python. Go ahead, enter the directory and install the package via pip install -e ..

Note we recommend having a separate python environment for standalone projects, e.g. using python -m venv command.

Authentication

To use the client you need to be pass Agents Bar credentials or some proof that you're a user, e.g. access_token. There are a few ways how to authenticate your client.

Note: Never store your credentials in places easy accessible by others. This includes git repositories that have the slightest chance to leave your computer. Definitely nothing that goes to the GitHub/GitLab.

Environment variables (suggested)

Currently suggested approach for authentication is to set your token or credentials as environment variables. The client looks first for AGENTS_BAR_ACCESS_TOKEN and uses that as its access token. You can use this approach if you want to login using a different application with securely stored credentials and temporarily set the access token. Otherwise, you can also set your username and password in AGENTS_BAR_USERNAME and AGENTS_BAR_PASSWORD, respectively.

As an example, in unix, you can set environment variables by using export command in shell

export AGENTS_BAR_ACCESS_TOKEN=<access_token>
... or ...
export AGENTS_BAR_USERNAME=<username>
export AGENTS_BAR_PASSWORD=<password>

Instantiating with credentials

The RemoteClient can authenticate using access_token or credentials (username and password) provided when instantiating the agent. Only one of these is required and the access_token has priority over credentials pair. Also, note that directly passed variables have priority over the environment variables.

access_token = "<access_token>"
username = "<username>"
password = "<password>"

client = RemoteClient(..., access_token=access_token, username=username, password=password)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agents-bar-0.4.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agents_bar-0.4.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file agents-bar-0.4.0.tar.gz.

File metadata

  • Download URL: agents-bar-0.4.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for agents-bar-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fa8e7910270a0ff0bb3390fd9a15bc7b01734d3255def2cb601c6907df433906
MD5 0f27d1312bd50887a7233d9175a73ef6
BLAKE2b-256 a27db0b4b00d6c889887b8198d9ba0f003d52fcac5d1f2c98a27544dd877e576

See more details on using hashes here.

File details

Details for the file agents_bar-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: agents_bar-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for agents_bar-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2430f277041e3deee4104a3d080d8fba76312929cc68730ad802347d14420bc
MD5 13db416e1a89cff53f3ec3a118d09e0c
BLAKE2b-256 68a7cf20deec69d5e3064a3a9f1f4b5b6dc24c999736344d2ca773abb4fc372d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page