Skip to main content

Enterprise-grade CLI for the Xase AI Lab (governed AI training datasets)

Project description

๐ŸŽจ Xase AI Lab CLI

Enterprise-grade command-line interface for governed AI training datasets

Version Python License

Beautiful, interactive CLI for discovering, managing, and consuming governed AI training datasets with enterprise compliance built-in.

โœจ Features

  • ๐ŸŽจ Beautiful UI - Claude-inspired orange theme with rich terminal formatting
  • ๐Ÿš€ Interactive Onboarding - Guided setup wizard for first-time users
  • ๐Ÿ” Secure Authentication - Email OTP with token management
  • ๐Ÿ“Š Rich Tables - Formatted displays for offers, leases, and usage stats
  • โšก Fast & Reliable - Built with async support and retry logic
  • ๐Ÿ›ก๏ธ Compliance-First - GDPR & AI Act compliant data access

๐Ÿ“ฆ Installation

# Clone or navigate to the CLI directory
cd packages/xase-cli

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install in editable mode
pip install -e .

# Verify installation
xase-cli --help

๐Ÿš€ Quick Start

First Run - Interactive Onboarding

On first run, Xase CLI will guide you through setup:

xase-cli

You'll see:

  1. Beautiful ASCII art banner with orange theme
  2. Interactive setup wizard to configure API URL
  3. Guided next steps for authentication and usage

Manual Setup

Run the setup wizard anytime:

xase-cli setup

Choose from:

  • ๐ŸŒ API Connection Settings
  • ๐Ÿ” Authentication & Login
  • โš™๏ธ Advanced Settings
  • ๐Ÿ‘๏ธ View Current Configuration

Authentication

# Login with email OTP
xase-cli login
# Enter your email
# Check email for 6-digit code
# Enter code to complete authentication

# View usage statistics
xase-cli usage

# Logout
xase-cli logout

Working with Datasets

# List available offers
xase-cli list-offers --limit 20 --risk LOW

# Create a lease for a dataset
xase-cli mint-lease DATASET_ID --ttl-seconds 3600

# View active leases
xase-cli list-leases

# Get lease details
xase-cli lease-details LEASE_ID

# Stream dataset for training
xase-cli stream DATASET_ID --lease-id LEASE_ID --output batch.json

๐Ÿ“š Commands Reference

Core Commands

setup

Interactive setup wizard

xase-cli setup

login

Authenticate via email OTP

xase-cli login

logout

Remove saved tokens

xase-cli logout

version

Show CLI version

xase-cli version

Dataset Discovery

list-offers

List available access offers with filters

xase-cli list-offers [OPTIONS]

Options:
  --limit N          Maximum number of offers (default: 20)
  --risk LEVEL       Filter by risk level (LOW, MEDIUM, HIGH)
  --language LANG    Filter by language

Example:

xase-cli list-offers --risk MEDIUM --language en --limit 50

Lease Management

mint-lease

Create a new lease for a dataset

xase-cli mint-lease DATASET_ID [OPTIONS]

Arguments:
  DATASET_ID         Dataset ID to lease

Options:
  --ttl-seconds N    Lease time-to-live in seconds (default: 1800)

Example:

xase-cli mint-lease ds_abc123 --ttl-seconds 3600

Output:

โœ“ Lease minted
โ„น Lease ID: lease_xyz789
โ„น Expires: 2026-02-15T19:30:00Z

list-leases

List active leases

xase-cli list-leases [OPTIONS]

Options:
  --limit N          Maximum number of leases (default: 20)

Example:

xase-cli list-leases --limit 10

Output:

                Active Leases                
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Lease ID     โ”‚ Dataset    โ”‚ Status โ”‚ Expires โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ lease_xyz123 โ”‚ ds_med_001 โ”‚ ACTIVE โ”‚ 18:30   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

lease-details

Show detailed information about a lease

xase-cli lease-details LEASE_ID

Arguments:
  LEASE_ID           Lease ID to inspect

Example:

xase-cli lease-details lease_xyz789

Data Streaming

stream

Stream dataset batch for training

xase-cli stream DATASET_ID [OPTIONS]

Arguments:
  DATASET_ID         Dataset to stream

Options:
  --lease-id ID      Lease ID to use (required)
  --env ENV          Environment (development, staging, production)
  --estimated-hours  Estimated hours of usage (default: 0.5)
  --output FILE      Output file path

Example:

xase-cli stream ds_def456 \
  --lease-id lease_xyz789 \
  --env production \
  --output training_batch.json

Monitoring

usage

Show usage statistics

xase-cli usage

Output:

       Usage Statistics        
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Tenant ID     โ”‚ tenant_01 โ”‚
โ”‚ Active Offers โ”‚        15 โ”‚
โ”‚ Active Leases โ”‚         3 โ”‚
โ”‚ Auth Mode     โ”‚   api_key โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ”„ Production Workflow

Complete flow from discovery to consumption:

# 1. First-time setup
xase-cli setup
xase-cli login

# 2. Discover datasets
xase-cli list-offers --risk MEDIUM --language en

# 3. Create lease for dataset
xase-cli mint-lease ds_abc123 --ttl-seconds 7200
# Note the lease ID from output

# 4. Stream data in batches
xase-cli stream ds_abc123 \
  --lease-id lease_xyz789 \
  --env production \
  --output batch_001.json

xase-cli stream ds_abc123 \
  --lease-id lease_xyz789 \
  --env production \
  --output batch_002.json

# 5. Monitor active leases
xase-cli list-leases

# 6. Check usage statistics
xase-cli usage

# 7. View lease details
xase-cli lease-details lease_xyz789

Error Handling

The CLI exits with standard codes:

  • 0 - Success
  • 1 - General error (API error, validation failed)
  • 2 - Configuration error (missing API key)
  • 130 - Interrupted by user (Ctrl+C)

Example error:

$ python xase_cli.py validate pol_invalid
โœ— HTTP 404: Policy not found

Best Practices

1. Always validate before consuming

# โœ… Good
python xase_cli.py validate pol_xyz789 --requested-hours 0.5
python xase_cli.py stream ds_def456 --output data.json

# โŒ Bad (no validation)
python xase_cli.py stream ds_def456 --output data.json

2. Use small batches for long-running jobs

# โœ… Good - consume in 0.5h increments
for i in {1..10}; do
  python xase_cli.py validate pol_xyz789 --requested-hours 0.5
  python xase_cli.py stream ds_def456 --output batch_$(printf %03d $i).json
  sleep 60
done

# โŒ Bad - single large request
python xase_cli.py stream ds_def456 --output all_data.json  # May timeout

3. Monitor lease expiration

# Check lease status regularly
python xase_cli.py list-leases | grep "Expires"

4. Secure your API key

# โœ… Good - use environment variable
export XASE_API_KEY="xase_pk_..."

# โŒ Bad - hardcode in script
XASE_API_KEY="xase_pk_..." python xase_cli.py list-offers

Automation Example

Bash script for continuous consumption:

#!/bin/bash
set -e

POLICY_ID="pol_xyz789"
DATASET_ID="ds_def456"
BATCH_SIZE=0.5
OUTPUT_DIR="./training_data"

mkdir -p "$OUTPUT_DIR"

for i in {1..20}; do
  echo "Processing batch $i..."
  
  # Validate access
  python xase_cli.py validate "$POLICY_ID" --requested-hours "$BATCH_SIZE"
  
  # Stream data
  OUTPUT_FILE="$OUTPUT_DIR/batch_$(printf %03d $i).json"
  python xase_cli.py stream "$DATASET_ID" --output "$OUTPUT_FILE"
  
  echo "โœ“ Batch $i saved to $OUTPUT_FILE"
  
  # Wait before next batch
  sleep 30
done

echo "โœ“ All batches completed"

Troubleshooting

"XASE_API_KEY environment variable not set"

Fix:

export XASE_API_KEY="xase_pk_..."

"HTTP 401: Unauthorized"

Causes:

  • Invalid API key
  • Expired API key
  • Wrong tenant

Fix:

  • Verify API key in dashboard
  • Regenerate if expired

"HTTP 403: Access denied"

Causes:

  • Policy expired
  • Usage limit exceeded
  • Lease revoked

Fix:

# Check policy status
python xase_cli.py validate pol_xyz789

# Request new lease if needed
python xase_cli.py execute off_abc123 --hours 1.0

"HTTP 429: Rate limit exceeded"

Fix:

  • Add delays between requests
  • Reduce batch frequency
  • Contact support to increase rate limit

Support


License

MIT ยฉ Xase


Built for AI Labs by the Xase team

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

xase_ai-2.0.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

xase_ai-2.0.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file xase_ai-2.0.1.tar.gz.

File metadata

  • Download URL: xase_ai-2.0.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for xase_ai-2.0.1.tar.gz
Algorithm Hash digest
SHA256 439098aebf4d9c49d84e6acb858db269997e0912dd143f60de3b797517cfd030
MD5 0ff9284ea9184e1ad02aad891159de8f
BLAKE2b-256 e284cf2a4b4a1c11cc529db0240a5aa63cdabe8ac99a8a5e76c09f60da080af3

See more details on using hashes here.

File details

Details for the file xase_ai-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: xase_ai-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for xase_ai-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a78e25fab039e5e3a4b99de322d10f1d247199f730c062f94fd9a409b6979166
MD5 ca1f112f0256e71702afa642d38fe870
BLAKE2b-256 85f0924a5aac08c6e574c05e5ed5695c2c159e82820999d232f75a42c96ceace

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