Skip to main content

Spritz CLI (spx) - Deploy and manage AI agents

Project description

Spritz CLI (spx)

Command-line interface for deploying and managing Spritz AI agents across dev and production environments.

๐Ÿš€ Installation

Install via pip:

pip install spritz-cli

๐Ÿ“‹ Quick Start

1. Configure Environment

# Configure dev environment
spx configure --profile dev
# Spritz URL: https://app.dev.spritz.activate.bar

# Configure prod environment
spx configure --profile prod
# Spritz URL: https://spritz.activate.bar

2. Login

# Login to dev
spx login --profile dev

# Login to prod
spx login --profile prod

3. Onboard Agents

# Onboard to dev
spx agent-onboarding --profile dev --url https://config.example.com/agents.json

# Onboard to prod
spx agent-onboarding --profile prod --url https://config.example.com/agents.json

# Preview without deploying (dry run)
spx agent-onboarding --profile dev --url https://config.example.com/agents.json --dry-run

๐Ÿ“– Commands

spx configure

Configure Spritz URL for different environments.

spx configure [--profile PROFILE]

Options:

  • --profile - Profile name (default, dev, prod)

Example:

spx configure --profile dev
# Spritz URL [https://app.dev.spritz.activate.bar]: 
# โœ“ Profile 'dev' configured successfully
# Do you want to login now? [Y/n]: y

spx login

Authenticate with Spritz via browser.

spx login [--profile PROFILE]

Options:

  • --profile - Profile to login (default: default)

Example:

spx login --profile prod

# Output:
# โ†’ Opening browser for authentication...
#    Spritz URL: https://spritz.activate.bar
#    Waiting for authentication...
#    Please login in the browser window.
# 
# [Browser opens, user logs in, window closes]
# 
# โ†’ Verifying token...
# โœ“ Authentication successful!
#    Logged in as: pradeep@incaendo.com

How it works:

  1. Opens browser to Spritz dashboard
  2. Extracts token from localStorage automatically
  3. Verifies token with API
  4. Saves token for future use
  5. Browser window closes automatically

spx agent-onboarding

Deploy agents from a configuration URL.

spx agent-onboarding --profile PROFILE --url URL [--dry-run]

Options:

  • --profile - Environment profile (default, dev, prod)
  • --url - URL that returns agent configuration JSON (required)
  • --dry-run - Preview without deploying

Example:

spx agent-onboarding --profile prod --url https://config.example.com/agents.json

# Output:
# Using profile: prod
# Spritz URL: https://spritz.activate.bar
# API URL: https://api.spritz.activate.bar
# 
# โ†’ Loading agent configuration...
#    Fetching from: https://config.example.com/agents.json
# โœ“ Found 3 agent(s) to onboard
# 
# โ†’ Agent configurations:
#   [1] Customer Support Agent (type: chat)
#   [2] Sales Assistant (type: voice)
#   [3] Analytics Bot (type: automation)
# 
# โ†’ Creating agents...
#   โœ“ [1/3] Customer Support Agent onboarded successfully
#     Agent ID: agent_abc123
#   โœ“ [2/3] Sales Assistant onboarded successfully
#     Agent ID: agent_def456
#   โœ“ [3/3] Analytics Bot onboarded successfully
#     Agent ID: agent_ghi789
# 
# ==================================================
# Onboarding complete!
#   Success: 3/3
# 
# โœ“ All agents onboarded successfully!

spx whoami

Show current user information.

spx whoami [--profile PROFILE]

Example:

spx whoami --profile prod

# Output:
# Profile: prod
# Spritz URL: https://spritz.activate.bar
# Email: pradeep@incaendo.com
# Auth0 ID: email|64e8a0485efd44509ed20f06
# Organization ID: 64a54a30899afb66425722fc
# Last Login: 2025-10-13T09:20:00.988Z

spx list-profiles

List all configured profiles.

spx list-profiles

Example:

spx list-profiles

# Output:
# Configured profiles:
#   - default (https://spritz.activate.bar) โœ“ logged in
#   - dev (https://app.dev.spritz.activate.bar) โœ“ logged in
#   - prod (https://spritz.activate.bar) โœ— not logged in

spx validate

Validate profile configuration.

spx validate [--profile PROFILE]

Example:

spx validate --profile prod

# Output:
# โœ“ Profile 'prod' is valid
#   Spritz URL: https://spritz.activate.bar
#   Token: ****************************************...tQuDQ
#   User: pradeep@incaendo.com
#   Organization: 64a54a30899afb66425722fc

๐ŸŒ Configuration URL Format

The --url parameter should point to a JSON endpoint that returns agent configuration(s).

Single Agent

{
  "name": "Customer Support Agent",
  "type": "chat",
  "agentType": "conversational",
  "description": "Handles customer inquiries",
  "config": {
    "model": "gpt-4",
    "temperature": 0.7
  },
  "prompts": {
    "system": "You are a helpful assistant."
  }
}

Multiple Agents

[
  {
    "name": "Support Agent",
    "type": "chat",
    "config": {...}
  },
  {
    "name": "Sales Agent",
    "type": "voice",
    "config": {...}
  }
]

๐Ÿ“‚ Configuration Storage

CLI stores configuration in ~/.spx/:

~/.spx/
โ”œโ”€โ”€ config          # Profile URLs
โ”œโ”€โ”€ credentials     # Auth tokens (chmod 600)
โ””โ”€โ”€ user.json       # User data

config

[profile default]
spritz_url = https://spritz.activate.bar

[profile dev]
spritz_url = https://app.dev.spritz.activate.bar

[profile prod]
spritz_url = https://spritz.activate.bar

credentials

[default]
token = eyJhbGciOiJSUzI1NiIs...

[dev]
token = eyJhbGciOiJSUzI1NiIs...

[prod]
token = eyJhbGciOiJSUzI1NiIs...

๐Ÿ”„ Complete Workflow

Development Workflow

# 1. Configure dev
spx configure --profile dev
# Spritz URL: https://app.dev.spritz.activate.bar
# Do you want to login now? [Y/n]: y
# โœ“ Authentication successful!

# 2. Deploy to dev
spx agent-onboarding \
  --profile dev \
  --url https://config-dev.example.com/agents.json

# 3. Test agents in dev environment
# ... test your agents ...

# 4. Deploy to prod
spx agent-onboarding \
  --profile prod \
  --url https://config-prod.example.com/agents.json

Multi-Environment Management

# Check all profiles
spx list-profiles

# Validate specific profile
spx validate --profile dev

# Check who's logged in
spx whoami --profile dev
spx whoami --profile prod

# Re-login if token expired
spx login --profile prod

๐Ÿ” Authentication Flow

  1. CLI opens browser โ†’ https://spritz.activate.bar/?cli_callback=http://localhost:8765/token
  2. Spritz dashboard checks localStorage โ†’ Extracts token from persist:auth
  3. Token sent to CLI โ†’ POST to localhost:8765/token
  4. CLI verifies token โ†’ Calls /verifyToken API
  5. Token saved โ†’ Stored in ~/.spx/credentials
  6. Browser closes โ†’ Automatically after 2 seconds

User sees:

  • โณ "Checking for authentication token..."
  • โœ“ "Authentication successful! You can close this window."
  • [Window closes automatically]

โšก Auto Re-authentication

CLI automatically handles expired tokens:

spx agent-onboarding --profile prod --url https://config.example.com/agents

# If token expired:
# โš  Token expired or invalid. Re-authenticating...
# โ†’ Opening browser for authentication...
# [Browser opens, authenticates, closes]
# โ†’ Verifying token...
# โœ“ Authentication successful!
# โ†’ Creating agents...

๐ŸŽฏ Use Cases

Deploy to Multiple Environments

# Deploy same config to dev and prod
for env in dev prod; do
  spx agent-onboarding \
    --profile $env \
    --url https://config.example.com/agents.json
done

Preview Before Deploy

# Check what will be deployed
spx agent-onboarding \
  --profile prod \
  --url https://config.example.com/agents.json \
  --dry-run

# If looks good, deploy
spx agent-onboarding \
  --profile prod \
  --url https://config.example.com/agents.json

CI/CD Integration

#!/bin/bash
# deploy.sh

PROFILE=$1
CONFIG_URL=$2

echo "Deploying to $PROFILE..."

# Validate profile
spx validate --profile $PROFILE || exit 1

# Deploy agents
spx agent-onboarding \
  --profile $PROFILE \
  --url $CONFIG_URL

echo "Deployment complete!"

Usage:

./deploy.sh dev https://config-dev.example.com/agents.json
./deploy.sh prod https://config-prod.example.com/agents.json

๐Ÿ› Troubleshooting

"Profile not found"

# Configure the profile first
spx configure --profile prod

"Token expired"

# Re-login
spx login --profile prod

"Browser doesn't close automatically"

Close it manually after seeing success message.

"Cannot connect to localhost:8765"

Check if port is available:

lsof -i :8765

Reset everything

rm -rf ~/.spx
spx configure

๐Ÿ“ Requirements

  • Python 3.7+
  • Browser with localStorage support
  • Internet connection
  • Access to Spritz dashboard

๐Ÿค Support

For issues and questions:

๐Ÿ’ป Development

The codebase is organized into a modular structure for better maintainability.

  • Entry Point: spritz.py
  • Package: src/
    • Commands: src/commands/
    • Core: config.py, auth.py, utils.py

For detailed information about the code architecture, see CODE_STRUCTURE.md.

๐Ÿ“„ License

MIT License - see LICENSE file for details

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

spx_cli-1.0.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

spx_cli-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file spx_cli-1.0.0.tar.gz.

File metadata

  • Download URL: spx_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for spx_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5cc82bff25a0b4660453be4f6ddbc99bb8ba6b87c5e75f1914f79f89282d580b
MD5 9b9222e9f1e274897baf28100e4fad12
BLAKE2b-256 d66b6e6ae2d36d128d5bfdaa8ab44fa0b92c3c820234acfde678f51e163c2231

See more details on using hashes here.

File details

Details for the file spx_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: spx_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for spx_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2663ff51401937f72bb8dda610701738d67a9383fea31676c7bd90c5dcb1aa6c
MD5 ddeab25e3c7a140c875db62b943aebfb
BLAKE2b-256 398b72a556eaedfa1de1bc2cb72a42e462ad133093d555ef36424325369c70ca

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