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.1.2.tar.gz (8.2 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.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agents-bar-0.1.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for agents-bar-0.1.2.tar.gz
Algorithm Hash digest
SHA256 630b04ccdee34cccb22299f2672740d3a4875b3d61568df21846374058a49d54
MD5 593f326a0bafdba9297df11d5ee91139
BLAKE2b-256 8220ea1e0f2c8944d73ca0231936d0929b3aa6d2da5b0e09d25c839a0733de6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agents_bar-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for agents_bar-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a056ee855da8ed6bbcdbe29df729662a00cc1b07ff5f1ff4073a1a2e48fb1d0
MD5 5685d2065de4311d9c6c6ac8e2ab9509
BLAKE2b-256 da575cbecd1395e393da82c9e7e372e01f769ba53f18c25c43d8ef1032eb3430

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