SenseLab CLI for managing AI agents
Project description
Raia Backend Server
Prerequisites
The official development environment is configured for Ubuntu 22.04 LTS. In order to work on the project, the following components must be installed (in brackets confirmed working version were placed):
- docker (20.10.14)
- docker compose plugin (version v2.3.3)
Development setup
For local env (backend server and postgres containers deployed locally using docker compose)
-
cp .env.example .env -
Fill missing values in .env template file
-
docker compose build -
docker compose up -
Application server should be exposed on APP_PORT defined in .env file
-
Gunicorn inside backend container will reload automatically upon code change in src/ directory
-
Also, you can connect to Postgres DB from your workstation using localhost as a host and 15432 as a port
(Optional) Running backend directly from command line from workstation
-
Create python virtualenv with python 3.11 and activate it
-
pip install -r requirements.txt -
In your .env file change POSTGRES_HOST=localhost and POSTGRES_PORT=15432
-
Comment out raia-backend service in docker-compose.yml file
-
docker compose up (Only postgres container will be spawned)
-
cd src/ -
Run in console:
ENVIRONMENT=local gunicorn --config gunicorn_config.py 'app:create_app()'orENVIRONMENT=local python app.py
(Optional) Connecting to dev env AWS resources (at this moment it means only RDS)
Running backend from command line:
Be aware that below command will utilise your AWS credentials stored in ~/.aws/ directory
ENVIRONMENT=dev AWS_REGION=eu-west-1 python app.py
OR
ENVIRONMENT=dev AWS_REGION=eu-west-1 gunicorn --config gunicorn_config.py 'app:create_app()'
Running backend inside container:
-
In raia-backend service comment out env_file section (Almost all needed configuration will be fetched from AWS SecretManager and ParameterStore)
-
Set ENVIRONMENT=dev under raia-backend service environment section
-
Turn on Raia AWS VPN (to enable access to RDS instance)
-
Comment out raia-database service section in docker-compose.yml
-
docker compose up
(Optional) Running examples
-
Create python virtualenv with python 3.11 and activate it
-
pip install -r requirements.txt -
cd examples/ -
export PYTHONPATH="${PYTHONPATH}:<repo_root_path>/src/" -
cp .env.example .env -
Fill missing values in .env template file
-
Run desired python script
How to perform changes on DB schema
-
Make desired changes in src/repository/models.py file
-
In src/ directory perform:
flask db migrate -m "Migration description" -
New file under src/migrations/versions/ directory should appear
-
Check it content and apply adjustments if needed
-
flask db upgradewill apply migration(s) to DB to which you are actually connected to. (Use with caution when connecting to RDS instances. For RDS instances it should be done via CI server) -
After migration was applied to any of RDS instances, the migration should not be altered, unless upgrade command failed. If something requires further changes. Please crate a follow-up migration.
-
Single migration should be as small as possible.
How to create an empty migration
-
In src/ directory perform:
flask db revision -m "Migration description" -
Continue creating the operations as needed.
Sense CLI (specialist chat)
This repository now includes a new CLI package under cli/ for specialist chat and function execution.
- Run CLI locally from repo root:
python3 -m cli.main --help - Default API URL:
https://api.raia.live - Login options:
- Token mode:
python3 -m cli.main login --token <CI_CD_TOKEN> - Browser flow:
python3 -m cli.main login --connect-url <frontend-cli-connect-url>
- Token mode:
New backend telemetry migration
The CLI telemetry endpoint persists events in a cli_telemetry table.
Apply DB migration in src/:
flask db upgrade
Latest migration revision introduced for this feature:
9b4f31ad7c2e_add_cli_telemetry_table.py
Sense CLI build and distribution
After this branch is merged, you can build and distribute the CLI package from this repo.
Build locally
- Create and activate a Python 3.11+ virtualenv.
- Install build tooling:
python3 -m pip install --upgrade build twine pipx
- Build package artifacts:
python3 -m build
- Validate artifacts:
python3 -m twine check dist/*
Generated artifacts:
dist/senselab_cli-<version>-py3-none-any.whldist/senselab_cli-<version>.tar.gz
Install locally for smoke tests
pipx install dist/senselab_cli-<version>-py3-none-any.whlsense-cli --helpsense-cli version
Publish package
For PyPI:
python3 -m twine upload dist/*
For private package indexes, use your index URL and credentials with twine upload.
Homebrew distribution (SenseLab branding)
Recommended naming:
- Tap:
senselab/tap - Formula:
sense-cli
Example user install flow:
brew tap senselab/tapbrew install sense-cli
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file senselab_cli-0.1.2.tar.gz.
File metadata
- Download URL: senselab_cli-0.1.2.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27abf4f5aefc7fd616389cada34538c5af1dd046558f58d07953866980c1b8e4
|
|
| MD5 |
e29eb1f82576e2ff1a1cb0c042108b65
|
|
| BLAKE2b-256 |
f135c51ec78266448b4fd38864d3cde31e3b219051f777a13cc3ec93a9775a88
|
File details
Details for the file senselab_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: senselab_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
548115d720917028a82e7b03bf307c89cee766261741d78e2a40144a97300bf0
|
|
| MD5 |
24aa0dc88f69de6b8a06731a0f310c37
|
|
| BLAKE2b-256 |
1ffe2b278bc15d08adffc3fe62477f669d7af8ca25f0dc146430619cfc21fd49
|