Skip to main content
The Trusys Command-Line Interface (CLI) provides a powerful way to interact with the Trusys platform directly from your terminal. Use the CLI to manage projects, run security and evaluation tests, and automate workflows.

Installation

To install Trusys, use the following command:
npx trusys@latest

Verify Installation

To ensure trusys is installed correctly, run:
npx trusys@latest --version

Login

Authenticate with your API Key
npx trusys auth login --api-key <your_api_key>
# OR
npx trusys auth login -k <your_api_key>
Replace <your_api_key> with the API key from your workspace. Learn how to create an API Key

Functional Evaluation

  • Run Evaluation with Custom Application and Prompt Library
    npx trusys eval --run \
    --application <applicationName> \
    --library <library> \
    --output <filename.extension> \
    --cache
    
  • If using custom application
    npx trusys eval --run \
    --application <applicationName> \
    --applicationPath <path_to_custom_provider> \
    --library <library> \
    --output <filename.extension> \
    --cache
    

CLI Options Explained

  • --applicationPath
    Path to the local custom provider file (JavaScript or Python) that you have implemented.
  • --output
    Specify an output file for evaluation results.
    Supported formats (based on file extension):
    .txt, .json, .html, .yaml, .csv
  • --cache
    Enables response caching to improve performance by reusing successful API responses.
    Failed or error responses are not cached, allowing retries and debugging.
  • --noCache
    Explicitly disables caching for the evaluation run.
  • --local
    Runs the evaluation entirely locally without uploading results to the Trusys platform.

Security Evaluation

  • Run Red Team Security Evaluation
    npx trusys redteam run \
    --securityConfig <configName> \
    --output <filename.extension> \
    --cache
    
  • If using custom application
    npx trusys redteam run \
    --securityConfig <configName> \
    --applicationPath <path_to_custom_provider> \
    --output <filename.extension> \
    --cache
    

CLI Options Explained

  • --applicationPath
    Path to the local custom provider file used to invoke the AI application.
  • --output
    Specify the output file for security evaluation results.
  • --cache
    Enables caching of successful responses to speed up security test execution.
  • --noCache
    Disables caching to ensure every security probe is executed fresh.
  • --local
    Runs the security evaluation fully locally.

Exit Code

The Trusys CLI returns specific exit codes to help you integrate testing into your CI/CD pipelines and automation workflows. You can access the exit code using the $LASTEXITCODE variable (PowerShell/Windows) or $? (Unix/Linux/Mac). Exit Code Values The CLI returns the following exit codes:
  • 0 โ€“ All test cases passed successfully with no failures.
  • 100 โ€“ At least one test case failed. This indicates that your application did not meet the expected evaluation criteria for one or more test cases.
  • 1 โ€“ An error occurred during execution. This could be due to configuration issues, authentication failures, network errors, or other operational problems unrelated to test case failures.