The SDK is not yet published to npm. Install via GitHub: npm install github:runtools-ai/runtools-sdk. Some APIs shown in these docs (agents, tools execution, code execution) are not yet implemented in the SDK — see individual page notes.
Introduction
The RunTools SDK provides a type-safe interface for the RunTools platform.
Full TypeScript Support Complete type definitions for all methods and responses
Async Iterators Stream responses with native async/await
Error Handling Typed errors with helpful messages
Tree-Shakeable Import only what you need
Installation
npm install @runtools/sdk
Quick Start
import { RunTools } from '@runtools/sdk' ;
const rt = new RunTools ({
apiKey: process . env . RUNTOOLS_API_KEY
});
// Create a sandbox
const sandbox = await rt . sandboxes . create ({ template: 'nodejs-20' });
// Run commands
await sandbox . exec ( 'npm init -y' );
// Write files
await sandbox . files . write ( '/app.js' , 'console.log("Hello!")' );
// Run an agent
const run = await rt . agents . run ( 'my-bot' , {
message: 'Build a todo app'
});
for await ( const event of run ) {
console . log ( event . type , event . data );
}
Modules
Sandboxes
rt . sandboxes . create () // Create sandbox
rt . sandboxes . get () // Get sandbox
rt . sandboxes . list () // List sandboxes
sandbox . exec () // Execute command
sandbox . files . * // File operations
sandbox . pause () // Pause sandbox
sandbox . resume () // Resume sandbox
sandbox . destroy () // Delete sandbox
Sandboxes Reference Full sandboxes SDK reference
Agents
rt . runtimes . create () // Create runtime
rt . deployments . create () // Create deployment
rt . agents . run () // Run agent
run . pause () // Pause run
run . resume () // Resume run
run . cancel () // Cancel run
Agents Reference Full agents SDK reference
rt . tools . list () // List installed tools
rt . tools . install () // Install tool
rt . tools . configure () // Configure tool
rt . tools . execute () // Execute tool
rt . tools . search () // Search tools
Tools Reference Full tools SDK reference
Templates
rt . templates . create () // Create template
rt . templates . list () // List templates
rt . templates . validate () // Validate config
rt . packages . search () // Search packages
Templates Reference Full templates SDK reference
Code Execution
rt . execute () // Execute code
AIP Hub
hub . sessions . create () // Create session
hub . sessions . list () // List sessions
hub . blocks . create () // Create context block
hub . invoke () // Invoke with context
hub . search () // Semantic search
AIP Reference Full AIP Hub SDK reference
Configuration
const rt = new RunTools ({
apiKey: 'rt_live_xxx' ,
// Optional configuration
baseUrl: 'https://api.runtools.ai' , // Custom API URL
timeout: 30000 , // Request timeout
retries: 3 , // Retry failed requests
});
Error Handling
import { RunToolsError , RateLimitError , NotFoundError } from '@runtools/sdk' ;
try {
await rt . sandboxes . get ( 'invalid-id' );
} catch ( error ) {
if ( error instanceof NotFoundError ) {
console . log ( 'Sandbox not found' );
} else if ( error instanceof RateLimitError ) {
console . log ( 'Rate limited, retry after:' , error . retryAfter );
} else if ( error instanceof RunToolsError ) {
console . log ( 'API error:' , error . message );
}
}
TypeScript Types
import type {
RunTools ,
Sandbox ,
SandboxStatus ,
AgentRun ,
AgentRunEvent ,
Tool ,
Template ,
ExecuteResult ,
// AIP Hub types
AIPHub ,
Session ,
ContextBlock ,
SearchResult ,
} from '@runtools/sdk' ;
Next Steps
Installation Detailed installation guide
Sandboxes Working with sandboxes
Agents Building and running agents
AIP Hub Sessions, context, and search