Commands
Complete reference for all CLI commands
All commands support --json for structured output unless noted otherwise. Use levered <command> --help for inline documentation on any command.
Authentication
Manage your session and credentials.
| Command | Description |
|---|---|
levered login [--api-url URL] | Authenticate via browser OAuth. Optionally override the API URL for this session. |
levered logout | Clear stored session tokens for the current environment. |
levered whoami | Print the currently authenticated user and organization. |
Configuration
Read and write CLI settings stored in ~/.levered/config.json.
| Command | Description |
|---|---|
levered config list | Print all configuration key-value pairs. |
levered config get <key> | Print the value of a specific key. |
levered config set <key> <value> | Set a configuration value. |
Optimizations
Create, manage, and inspect optimizations.
List optimizations
levered optimizations list [--limit N] [--include-archived] [--json]List optimizations in the current organization. Returns the most recent optimizations, up to --limit (default 10). Archived optimizations are hidden unless --include-archived is set.
Show optimization details
levered optimizations show <id> [--json]Print full details for a single optimization, including design factors, model configuration, linked metric, and current status.
Create an optimization
levered optimizations create \
--name NAME \
--design-factors JSON \
--reward-metric-id UUID \
[--model-type cmab] \
[--context-factors JSON] \
[--json]Create a new optimization and start training.
| Flag | Required | Description |
|---|---|---|
--name | Yes | Human-readable name for the optimization. |
--design-factors | Yes | JSON array of factors and their levels. |
--reward-metric-id | Yes | UUID of the metric that defines success. |
--model-type | No | Model type. Default: cmab (contextual multi-armed bandit). |
--context-factors | No | JSON array of context factors for personalization (e.g., country, device). |
Example -- create a hero section optimization with two design factors:
levered optimizations create \
--name "Landing Page Hero" \
--design-factors '[
{"name": "headline", "levels": ["Ship faster", "Build better", "Scale up", "Go live today", "Start free"]},
{"name": "cta_text", "levels": ["Get started", "Try it free"]}
]' \
--reward-metric-id 8a3b12c4-5678-4def-abcd-1234567890ab \
--context-factors '[{"name": "country"}, {"name": "device_type"}]' \
--jsonUpdate optimization status
levered optimizations update <id> --status {live|completed|archived}Transition an optimization to a new status. See Optimizations for the status lifecycle.
Archive an optimization
levered optimizations archive <id> [-y]Archive an optimization. Prompts for confirmation unless -y is passed.
View results
levered optimizations results <id> [--json]Print performance results for an optimization, including estimated lift over the baseline, confidence intervals, and factor importance rankings.
List observations
levered optimizations observations <id> [--page N] [--size N] [--json]Paginate through the raw observation data (exposures matched to rewards) for an optimization.
| Flag | Default | Description |
|---|---|---|
--page | 1 | Page number. |
--size | 20 | Number of observations per page. |
Models
Inspect and manage the bandit models behind optimizations.
| Command | Description |
|---|---|
levered models list [--limit N] [--include-archived] [--json] | List models in the organization. |
levered models state <id> [--json] | Print the current model state: variant probability distributions and expected reward per variant. |
levered models delete <id> [-y] | Delete a model. Prompts for confirmation unless -y is passed. |
Warehouse
Inspect and query your data warehouse. Warehouse connections are managed through the dashboard or the API.
| Command | Description |
|---|---|
levered warehouse status [--json] | Show the current warehouse connection status and provider. |
levered warehouse tables [--json] | List all tables in the connected dataset/schema. |
levered warehouse columns <table> [--json] | List column names and types for a table. |
levered warehouse preview <table> [-n N] [--json] | Preview rows from a table. Default: 10 rows. |
levered warehouse query <sql> [-n N] [--json] | Run an arbitrary read-only SQL query. Default limit: 100 rows. |
These commands are especially useful for AI agents that need to discover table schemas before writing metric SQL.
Metrics
Define reward metrics that tell Levered what counts as a successful outcome.
List metrics
levered metrics list [--json]Create a metric
levered metrics create \
--name NAME \
--sql SQL \
--anonymous-id-col COL \
--timestamp-col COL \
[--value-col COL] \
[--reward-type TYPE] \
[--json]| Flag | Required | Description |
|---|---|---|
--name | Yes | Human-readable metric name. |
--sql | Yes | SQL query that returns reward events from your warehouse. |
--anonymous-id-col | Yes | Column in the query result that identifies the user (anonymous ID). |
--timestamp-col | Yes | Column with the event timestamp. |
--value-col | No | Column with a numeric reward value. Omit for binary (conversion) metrics. |
--reward-type | No | Reward type (e.g., bool, numeric). |
Example -- create a sign-up conversion metric:
levered metrics create \
--name "Sign-ups (7d)" \
--sql "SELECT anonymous_id, signed_up_at FROM analytics.sign_ups WHERE signed_up_at >= CURRENT_DATE - 7" \
--anonymous-id-col anonymous_id \
--timestamp-col signed_up_at \
--jsonPreview metric data
levered metrics preview <id> [--limit N] [--json]Run the metric's SQL query and display a sample of matching rows. Useful for verifying the query returns the expected data before linking the metric to an optimization.
Delete a metric
levered metrics delete <id> [-y]Delete a metric. Prompts for confirmation unless -y is passed. Metrics linked to active optimizations cannot be deleted.
Variant Serving
Request a variant assignment for a user outside of the SDK.
levered serve <optimization-id> [--anonymous-id ID] [--context JSON] [--json]| Flag | Description |
|---|---|
--anonymous-id | The user's anonymous ID. If omitted, a random ID is generated. |
--context | JSON object of context factor values for personalized serving (e.g., '{"country": "US", "device_type": "mobile"}'). |
Returns the selected variant -- the set of factor-level assignments -- for the given user and context.
Interactive Dashboard
levered dashboard [--refresh SECONDS]Launch a terminal UI (TUI) that displays live optimization data, including variant distributions, reward rates, and model state. The display refreshes on the interval specified by --refresh (default: 10 seconds).
This is a read-only view. Use it to monitor running optimizations without leaving the terminal.