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
    

  • Here the applicationPath switch should point to the local path of the custom provider file that you have written.
  • After the run, you’ll receive a link to view results online. Log in with your registered email to access the test summary.
  • You can specify an output file when running evaluations. The file format is determined by the extension you provide. Currently supported extensions: .txt, .json, .html, .yaml, .csv . The generated output file will be automatically saved to your local environment.
  • Caching is disabled by default. Use the --cache flag to enable response caching during your application’s evaluations, improving performance by reusing successful API responses while excluding error responses to support retries and debugging.

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
    

  • Here the applicationPath switch should point to the local path of the custom provider file that you have written.
  • After the run, you’ll receive a link to view results online. Log in with your registered email to access the test summary.
  • You can specify an output file when running evaluations. The file format is determined by the extension you provide. Currently supported extensions: .txt, .json, .html, .yaml, .csv . The generated output file will be automatically saved to your local environment.
  • Caching is disabled by default. Use the --cache flag to enable response caching during your application’s evaluations, improving performance by reusing successful API responses while excluding error responses to support retries and debugging.

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.