Skip to main content
1

Install the SDK

npm install agentrein
2

Get Your API Key

Log in to Dashboard, go to Settings, and copy your API key.
3

Initialize the Client

import { AgentRein } from 'agentrein';
import { Octokit } from '@octokit/rest'; // Developer's own standard SDK

const agentrein = new AgentRein({ apiKey: 'YOUR_API_KEY' });
const octokit = new Octokit({ auth: 'GITHUB_TOKEN' });
4

Create a Session

const session = await agentrein.newSession({
  agentId: 'onboarding-agent',
  intent: 'Create a GitHub issue and notify the team on Slack',
});
5

Wrap Your Existing Clients

const agentOctokit = agentrein.wrap(octokit, session, { connector: 'github' });
const agentSlack   = agentrein.wrap(slackClient, session, { connector: 'slack' });

const issue = await agentOctokit.issues.create({
    owner: 'my-org',
    repo: 'my-repo',
    title: 'Onboarding task',
});

await agentSlack.chat.postMessage({
    channel: '#onboarding',
    text: `Issue created: ${issue.data.html_url}`,
});
6

Complete the Session

await agentrein.completeSession(session);

Plan Tiers & API Keys

AgentRein has four plan tiers: FREE, PRO, TEAM, and ENTERPRISE. Your API key works across all plans, but certain features require a minimum plan:
FeatureFREEPROTEAM
Session Rollback
API Key Management
Connector Credentials
Approval Gates (HITL)
Intent Drift Detection
If you call a PRO or TEAM feature on a FREE plan, the backend returns a 403 with a clear error message. Upgrade at Dashboard → Settings → Billing.
To get your API key: Dashboard → API Keys → Create New Key.

Testing & Sandbox

To test your agent without executing real actions, create a Sandbox API key in Dashboard → Settings → API Keys. Sandbox keys have the prefix ar_test_ and simulate all connector calls — nothing is written to GitHub, Stripe, or Slack. Switch between sandbox and production by changing one environment variable:
# Development
AGENTREIN_API_KEY=ar_test_your_key_here

# Production
AGENTREIN_API_KEY=ar_live_your_key_here
See Sandbox Mode for full details.