Lexia CLI

The Lexia CLI is your command-line companion for creating, configuring, and deploying agents — providing developers full control without leaving the terminal.

Placeholder Image: Terminal screenshot showing Lexia CLI login and deploy commands


1. Overview

The Lexia Command-Line Interface (CLI) streamlines developer workflows by integrating local projects with the Lexia cloud environment.

You can use it to:

  • Initialize and configure agents
  • Deploy code to dev/staging/prod
  • Manage databases, guardrails, and tracing
  • Run and debug agents locally

2. Installation

macOS / Linux

npm install -g @lexia/cli

Windows (PowerShell)

npm install -g @lexia/cli

Check version:

lexia --version

Image: Example of successful Lexia CLI installation output


3. Authentication

Log in using your workspace token from the Lexia dashboard:

lexia login

You can authenticate non-interactively by exporting an API token:

export LEXIA_TOKEN=<your_api_token>

Once logged in, your session credentials are stored securely in:

~/.lexia/config.json

4. Commands

Common Commands

CommandDescription
lexia init agent <name>Create a new agent locally
lexia runRun your agent locally
lexia deploy <env>Deploy to dev/staging/prod
lexia dbManage relational DB migrations
lexia traceInspect or export trace logs
lexia guardrailManage moderation rules
lexia insightsView analytics from the terminal
lexia observabilityMonitor logs and uptime

Examples

Initialize a new Python agent

lexia init agent support-bot --python

Deploy to production

lexia deploy prod

Check trace logs for the last 24 hours

lexia trace list --since 24h

Image: CLI flow diagram showing init → run → deploy → monitor cycle


5. Configuration File

Each project includes a lexia.yaml configuration file.

Example:

agent:
  name: support-bot
  runtime: python
  entrypoint: agent.py
deploy:
  environments:
    dev:
      db: postgresql://localhost:5432/devdb
      vector_db: qdrant://localhost:6333
      memory: redis://localhost:6379

This file defines runtime parameters, environments, and connections.


6. Environment Variables

The CLI automatically injects Lexia environment variables during execution.

VariableDescription
LEXIA_API_KEYAuthenticates SDK and CLI
LEXIA_ENVCurrent environment name
LEXIA_DB_URLRelational database connection
LEXIA_STORAGE_URLStorage bucket endpoint
LEXIA_VECTOR_DB_URLVector DB connection
LEXIA_MEMORY_URLRedis / in-memory cache

7. Debugging & Logs

View logs from local runs or cloud environments:

lexia logs tail

Verbose mode:

lexia run --debug

Log output is color-coded and timestamped for easy troubleshooting.

Image: Example CLI debug session showing live logs and colored output


8. Updating the CLI

Keep your CLI up to date:

npm update -g @lexia/cli

Or check for updates:

lexia upgrade