# Installation
Package Installation
bash
1# npm2npm install @solongate/sdk@latest34# yarn5yarn add @solongate/sdk@latest67# pnpm8pnpm add @solongate/sdk@latest
Environment Setup
Create a .env file in your project root:
bash
1# .env2# Get your keys from: https://solongate.com → Dashboard → Projects3# IMPORTANT: Never commit this file to git!45# Live key — connects to api.solongate.com for policy sync + audit logging6SOLONGATE_API_KEY=sg_live_your_key_here78# Test key — offline mode, no API connection (for development)9# SOLONGATE_API_KEY=sg_test_your_key_here
Tip: If you use npx @solongate/proxy@latest init, a .env file is created automatically with placeholder keys.
Basic Usage
typescript
1import { SolonGate } from '@solongate/sdk';23// Initialize — reads SOLONGATE_API_KEY from .env automatically4const gate = new SolonGate({ name: 'my-app' });56// Validate a tool call7const result = await gate.executeToolCall(8 { name: 'file_read', arguments: { path: '/data/doc.txt' } },9 async () => ({ content: [{ type: 'text', text: '...' }] }),10);1112console.log(result); // tool result or policy denial
Package Exports
typescript
1import {2 SolonGateAPI, // Cloud API client3 SolonGate, // Local policy engine4 PolicyEngine, // Policy evaluation5 TrustLevel, // UNTRUSTED | VERIFIED | TRUSTED6 Permission, // READ | WRITE | EXECUTE7 RateLimiter, // Rate limiting8 TokenIssuer, // Capability tokens9 ServerVerifier, // Request verification10} from '@solongate/sdk';