Agent CD/CI

Lexia's CD/CI (Continuous Deployment & Continuous Integration) pipeline automates how agents are tested, built, and deployed — ensuring smooth updates across environments.

Placeholder Image: Diagram showing Lexia agent workflow — Code → Build → Test → Deploy → Monitor


1. Overview

Lexia provides a built-in CD/CI mechanism for deploying agents safely and consistently.
It integrates directly with the Lexia CLI, enabling you to:

  • Validate code and schema changes
  • Deploy new agent versions to dev/staging/prod
  • Automate testing and rollback
  • Track deployment history through Tracing

2. Deployment Environments

Each workspace supports three isolated environments:

EnvironmentPurposeExample Command
devLocal or internal testinglexia deploy dev
stagingPre-production validationlexia deploy staging
prodLive production environmentlexia deploy prod

Image: Diagram of dev → staging → prod flow between workspaces


3. Deployment Workflow

A standard Lexia CD/CI pipeline consists of:

  1. Code Commit — push changes to repository
  2. Build Phase — package agent and dependencies
  3. Validation — run syntax, security, and schema checks
  4. Deploy — send agent image/config to Lexia cloud
  5. Verify — automatic smoke test after deployment

Example pipeline config (,[object Object],):

pipeline:
  build:
    - command: pip install -r requirements.txt
  validate:
    - command: lexia lint
  deploy:
    - command: lexia deploy staging

4. Environment Variables

During build and deploy phases, Lexia automatically injects environment variables:

VariableDescription
LEXIA_ENVCurrent environment (dev, staging, prod)
LEXIA_API_KEYAuth key for deployment
LEXIA_DB_URLDatabase connection string
LEXIA_STORAGE_URLStorage endpoint
LEXIA_VECTOR_DB_URLVector DB endpoint

Image: Environment variable injection flow from Lexia cloud into container build


5. Rollback & Versioning

Every deployment automatically creates a version checkpoint. You can roll back to any previous version:

lexia deploy rollback --to v1.4.2

Each version includes:

  • Commit hash
  • Agent build metadata
  • Environment configuration snapshot

Image: Timeline of deployments with version tags and rollback arrows


6. Testing & Validation

Before deployment, agents can run automated test suites or static checks:

lexia test

These tests validate:

  • Agent startup
  • API connectivity
  • Guardrail compliance
  • DB and Storage access

Results appear in Lexia Tracing with detailed logs.


7. Monitoring Deployments

The Lexia Dashboard shows:

  • Deployment status (success/failure)
  • Build logs
  • Environment variables used
  • Resource usage metrics

For advanced automation, use the API endpoint:

GET /api/v1/deployments?workspace_id=...

Image: Dashboard screenshot showing build logs and deployment summary


8. Integration with GitHub Actions (Optional)

You can integrate Lexia CD/CI with external systems like GitHub Actions or GitLab CI:

name: Deploy to Lexia
on:
  push:
    branches: [ main ]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: pip install lexia
      - run: lexia deploy prod --token ${{{ secrets.LEXIA_TOKEN }}}

Image: Example of GitHub Actions workflow deploying an agent automatically to Lexia