A powerful Node.js SDK for interacting with the Oblien Sandbox API. Build, run, and manage isolated development environments programmatically with full file system access, Git integration, and real-time capabilities.
Perfect for AI agents, automated workflows, and secure code execution.
π Full Documentation
npm install agent-sandboximport { OblienClient } from 'agent-sandbox';
// 1. Authenticate with your Oblien account
const client = new OblienClient({
clientId: process.env.OBLIEN_CLIENT_ID,
clientSecret: process.env.OBLIEN_CLIENT_SECRET
});
// 2. Create a sandbox - returns ready-to-use client!
const sandbox = await client.createSandbox({
name: 'my-dev-sandbox'
});
// 3. Start using it immediately
await sandbox.files.list({ dirPath: '/opt/app' });
await sandbox.files.create({
fullPath: '/opt/app/index.js',
content: 'console.log("Hello World!");'
});
await sandbox.git.clone({
url: 'https://github.com/user/repo',
targetDir: '/opt/app'
});Get your API credentials: oblien.com/dashboard/api
| Feature | Description | Documentation |
|---|---|---|
| π Authentication | Two-tier auth with client credentials and sandbox tokens | Docs |
| π¦ Sandbox Management | Create, start, stop, and manage sandbox instances | Docs |
| ποΈ File Operations | Complete CRUD operations for files and directories | Docs |
| π Git Integration | Full Git workflow support (clone, commit, push, branches) | Docs |
| π Search | Fast search across file contents and names | Docs |
| π» Terminal | Execute commands with real-time streaming | Docs |
| πΈ Snapshots | Create checkpoints and restore environment states | Docs |
| π Browser Automation | Screenshots, page content, network monitoring | Docs |
| ποΈ Database Management | Full SQLite database operations, schema, and queries | Docs |
| π WebSocket | Real-time file watching and terminal streaming | Docs |
| πͺ TypeScript | Full type definitions included | - |
// List files
const files = await sandbox.files.list({
dirPath: '/opt/app',
recursive: true
});
// Read file
const content = await sandbox.files.get({
filePath: '/opt/app/index.js'
});
// Create file
await sandbox.files.create({
fullPath: '/opt/app/hello.js',
content: 'console.log("Hello!");'
});β Full File Operations Guide
// Clone repository
await sandbox.git.clone({
url: 'https://github.com/user/repo',
targetDir: '/opt/app'
});
// Make changes and commit
await sandbox.git.add({ repoPath: '/opt/app', files: ['.'] });
await sandbox.git.commit({
repoPath: '/opt/app',
message: 'Update code',
author: { name: 'AI Agent', email: 'ai@example.com' }
});
// Push changes
await sandbox.git.push({ repoPath: '/opt/app' });β Full Git Integration Guide
// Create interactive terminal
const terminal = await sandbox.terminal.create({
cols: 120,
rows: 30,
cwd: '/opt/app',
onData: (data) => console.log(data),
onExit: (code) => console.log('Exit:', code)
});
// Execute commands
terminal.write('npm install\n');
terminal.write('npm test\n');// Watch for file changes
await sandbox.watcher.start({
ignorePatterns: ['node_modules', '.git'],
onChange: (path) => console.log('Changed:', path),
onAdd: (path) => console.log('Added:', path),
onUnlink: (path) => console.log('Deleted:', path)
});// Take screenshot
const screenshot = await sandbox.browser.screenshot({
url: 'https://example.com',
width: 1920,
height: 1080,
fullPage: true
});
// Get page content
const content = await sandbox.browser.getPageContent({
url: 'https://example.com',
waitFor: 1000
});β Full Browser Automation Guide
// Create a database
await sandbox.database.createDatabase({ name: 'myapp' });
// Create a table
await sandbox.database.createTable({
database: 'myapp',
tableName: 'users',
columns: [
{ name: 'id', type: 'INTEGER', primaryKey: true, autoIncrement: true },
{ name: 'name', type: 'TEXT', notNull: true },
{ name: 'email', type: 'TEXT', unique: true }
]
});
// Insert data
await sandbox.database.insertRow({
database: 'myapp',
table: 'users',
data: { name: 'John Doe', email: 'john@example.com' }
});
// Query data
const result = await sandbox.database.getTableData({
database: 'myapp',
table: 'users',
limit: 10,
sortBy: 'id',
sortOrder: 'desc'
});
// Execute custom query
await sandbox.database.executeQuery({
database: 'myapp',
query: 'SELECT * FROM users WHERE name LIKE ?',
params: ['%John%']
});
// Export to JSON
const jsonData = await sandbox.database.exportTableToJSON('myapp', 'users');β Full Database Management Guide
// By sandbox ID
const sandbox = await client.sandbox('sandbox_abc123');
// Or with direct token
import { SandboxClient } from 'agent-sandbox';
const sandbox = new SandboxClient({
token: 'your_sandbox_token'
});Full TypeScript definitions included:
import {
SandboxClient,
FileListOptions,
TableCreateOptions
} from 'agent-sandbox';
const options: FileListOptions = {
dirPath: '/opt/app',
recursive: true
};
const files = await sandbox.files.list(options);
// Database operations with full type safety
const tableOptions: TableCreateOptions = {
database: 'myapp',
tableName: 'users',
columns: [
{ name: 'id', type: 'INTEGER', primaryKey: true }
]
};
await sandbox.database.createTable(tableOptions);try {
const files = await sandbox.files.list({ dirPath: '/opt/app' });
} catch (error) {
console.error('Error:', error.message);
}| Resource | Link |
|---|---|
| π Complete Documentation | oblien.com/docs/sandbox |
| π Quick Start Guide | oblien.com/docs/sandbox/quick-start |
| π Authentication | oblien.com/docs/sandbox/authentication |
| ποΈ File Operations | oblien.com/docs/sandbox/file-operations |
| π Git Integration | oblien.com/docs/sandbox/git-clone |
| π» Terminal | oblien.com/docs/sandbox/terminal |
| πΈ Snapshots | oblien.com/docs/sandbox/snapshots |
| π Browser Automation | oblien.com/docs/sandbox/browser |
| ποΈ Database Management | oblien.com/docs/sandbox/database |
| π WebSocket & Real-time | oblien.com/docs/sandbox/websocket |
- π§ Email: support@oblien.com
- π¬ Discord: discord.gg/oblien
- π Issues: GitHub Issues
MIT Β© Oblien
Made with β€οΈ by Oblien