Lexia CLI
The Lexia CLI is your command-line companion for creating, configuring, and deploying agents — providing developers full control without leaving the terminal.
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
| Command | Description |
|---|---|
lexia init agent <name> | Create a new agent locally |
lexia run | Run your agent locally |
lexia deploy <env> | Deploy to dev/staging/prod |
lexia db | Manage relational DB migrations |
lexia trace | Inspect or export trace logs |
lexia guardrail | Manage moderation rules |
lexia insights | View analytics from the terminal |
lexia observability | Monitor 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.
| Variable | Description |
|---|---|
LEXIA_API_KEY | Authenticates SDK and CLI |
LEXIA_ENV | Current environment name |
LEXIA_DB_URL | Relational database connection |
LEXIA_STORAGE_URL | Storage bucket endpoint |
LEXIA_VECTOR_DB_URL | Vector DB connection |
LEXIA_MEMORY_URL | Redis / 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