Install
Import
The SDK ships as a dual CJS/ESM package. Use the following import pattern:Initialize
Options
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | — | Your organization API key from the dashboard |
serverUrl | string | No | https://api.agentrein.com | AgentRein backend URL |
failureMode | 'open' | 'closed' | No | 'open' | open — SDK continues if backend is unreachable. closed — throws AgentReinUnavailableError |
sandbox | boolean | No | false | When true, all actions are simulated — nothing is executed on real connectors. Use with ar_test_ keys during development. |
Environment Variable
Sandbox Mode
Use sandbox mode during development to test your agent logic without executing real actions on GitHub, Stripe, Slack, or any other connector.Setup
-
Go to Dashboard → Settings → API Keys and create a new key with Sandbox enabled.
Your key will have the prefix
ar_test_. - Set your environment variable:
- Use the SDK exactly as you would in production — no code changes needed:
Sandbox sessions appear in your dashboard under the Sandbox filter tab,
clearly marked with a “Simulated” badge. Switch to your
ar_live_ key
when you are ready for production — no other code changes needed.