Examples
Working examples are available in the sdk-examples directory of the Shiplight examples repository.
Getting Started
1. Clone the Examples Repository
bash
git clone https://github.com/ShiplightAI/examples.git
cd examples/sdk-examples2. Install Dependencies
bash
npm install
npx playwright install chromium3. Configure Environment
bash
cp .env.example .envEdit .env with your keys:
bash
# Use the key matching the model in the example, or a Shiplight proxy token
GOOGLE_API_KEY=your-google-api-key
# ANTHROPIC_API_KEY=your-anthropic-api-key
# OPENAI_API_KEY=your-openai-api-key
# SHIPLIGHT_API_TOKEN=your-shiplight-api-token4. Run Examples
bash
npm run quickstartAvailable Examples
| Example | Description | Run |
|---|---|---|
quickStart.ts | Basic SDK usage - login, assert, extract | npm run quickstart |
basicUsage.ts | Core features - act, assert, evaluate, extract | npm run basic |
loginExample.ts | Smart login with 2FA support | npm run login |
selfHealingExample.ts | Self-healing with step() | npm run self-healing |
customActions.ts | Extend agent with custom actions | npm run custom-actions |
variablesExample.ts | Variable management | npm run variables |
fileOperationsExample.ts | File upload | npm run file-upload |
extractionExample.ts | Data extraction patterns | npm run extraction |
Test Site
Login and commerce examples use the Sauce Labs demo site (public):
- Username:
standard_user - Password:
secret_sauce
Other examples also use public pages such as example.com, Wikipedia, and a public file-upload test page. They make live LLM calls and access external sites, so results depend on provider and site availability.