How to Integrate Rhesis SDK into Your CI/CD Pipeline
Automate LLM testing in your CI/CD pipeline to catch quality issues before they reach production. This guide shows you how to set up automated test execution, quality gates, and failure detection in your continuous integration workflow.
What You’ll Achieve
- Automated Testing: Run LLM tests on every commit or pull request
- Quality Gates: Block deployments when tests fail
- Early Detection: Catch regressions and quality issues before production
- Test Reports: Get detailed test results in your CI/CD logs
Use Cases
- Chatbot Testing: Validate conversational AI responses
- API Validation: Test LLM-powered API endpoints
- Regression Prevention: Detect when changes break existing behaviors
Prerequisites
Before integrating Rhesis into your CI/CD pipeline, ensure you have:
- Python 3.10+ available in your CI environment
- A Rhesis account at app.rhesis.ai
- An Endpoint configured in Rhesis with your LLM application URL
- A Test Set created with test scenarios to run
- Basic familiarity with GitHub Actions, GitLab CI, or similar tools
This guide uses GitHub Actions as the example, but the principles apply to any CI/CD platform (GitLab CI, Jenkins, CircleCI, etc.).
How It Works
The CI/CD integration follows this workflow:
Setup Steps
Get Your API Credentials
- Log in to app.rhesis.ai
- Navigate to API Tokens
- Generate a new API Token
- Copy the Token (you’ll need it in the next step)
Keep your API Token secure. Never commit it directly to your repository.
Configure CI/CD Secrets
Store your Rhesis credentials as environment variables in your CI/CD platform:
For GitHub Actions:
- Go to your repository Settings → Secrets and variables → Actions
- Click New repository secret
- Add these secrets:
| Secret Name | Value | Description |
|---|---|---|
RHESIS_API_KEY | Your API key | Authentication for Rhesis API |
RHESIS_ENDPOINT_ID | Your endpoint ID | The endpoint to test |
RHESIS_TEST_SET_ID | Your test set ID | Test scenarios to run |
Find your Endpoint ID and Test Set ID in the Rhesis dashboard URL or via the API.
Optional: Set the base URL if using self-hosted Rhesis:
RHESIS_BASE_URL=https://your-rhesis-instance.comCreate the Workflow File
Create .github/workflows/rhesis-tests.yml in your repository:
Create the Test Runner Script
Create .github/scripts/run_rhesis_tests.py:
Test Your Integration
Push your changes and watch the workflow run:
Monitor the workflow in Actions tab of your GitHub repository.
Customization Options
Adjust Timeouts
Modify timeouts based on your test set size:
Set Failure Threshold
Allow a percentage of test failures:
Run on Specific Events
Run tests only on pull requests to main:
Next Steps
You’re ready to automate LLM testing! Your CI/CD pipeline now catches quality issues before production.
- Learn More: Rhesis SDK Documentation
- Advanced Testing: Building Custom Metrics
- Multi-Turn Testing: Penelope Agent Testing
- Get Help: Join our Discord community
Need help with integration? Reach out on Discord or email support@rhesis.ai.