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.2.0.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.2.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agents-bar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e1e5f8402e85e780b738685d79913e3cf0adabf1eb5579956c79af85cae39709
MD5 7e7008a89ac7515da024e257c70334e6
BLAKE2b-256 720ff06a4c673fa1bb292d4e327e3793da705f8599ddc4c912357cdcd6ff0fa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agents_bar-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for agents_bar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32c32f49b49fe6bacb8f86641cf2d262f26f297232cf1af8618678011ca9e940
MD5 71a4ae64c1963e627f0eadeddbb3d066
BLAKE2b-256 96aba5bf27dcde175c8827997557e02c304a54a2cbb6ab69c3986fe372165b63

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