Back to Documentation
Installation Guide
Prerequisites
- Node.js 18.0 or higher
- npm or yarn package manager
- A Tora AI account with API key
Install the SDK
npm install @tora/sdk
Or if you prefer yarn:
yarn add @tora/sdk
Initialize the Client
import { ToraClient } from '@tora/sdk';
// Initialize the client
const client = new ToraClient({
apiKey: process.env.TORA_API_KEY,
environment: 'production' // or 'development'
});
// Test the connection
async function testConnection() {
try {
const status = await client.system.status();
console.log('Connection successful:', status);
} catch (error) {
console.error('Connection failed:', error);
}
}
testConnection();
Core Concepts
Agent Security
Tora AI provides a security layer for autonomous AI agents, protecting them from unauthorized access, manipulation, and other threats.
Behavioral Policies
Define rules and constraints for your AI agents to ensure they operate within acceptable parameters and respond appropriately to threats.
Monitoring & Alerts
Real-time monitoring of agent behavior with automated alerts for suspicious activities or policy violations.
Quantum-Resistant Security
Advanced cryptographic techniques designed to withstand attacks from quantum computers, ensuring long-term security.
Quick Start Tutorial
1. Register an Agent
// Register a new agent
const agent = await client.agents.register({
id: 'agent-123',
name: 'Assistant Bot',
capabilities: ['text-generation', 'code-analysis'],
description: 'A helpful assistant that can generate text and analyze code'
});
console.log('Agent registered:', agent.id);
2. Create a Security Policy
// Create a security policy for the agent
const policy = await client.policies.create({
agentId: agent.id,
name: 'Basic Security Policy',
rules: [
{
type: 'rate-limit',
params: {
maxRequests: 100,
timeWindow: '1h'
}
},
{
type: 'content-filter',
params: {
blockedTopics: ['malware', 'hacking'],
sensitivity: 'medium'
}
}
]
});
console.log('Policy created:', policy.id);
3. Monitor Agent Activity
// Set up a webhook to receive agent activity events
await client.webhooks.create({
url: 'https://your-server.com/webhooks/tora',
events: ['agent.activity', 'security.violation'],
secret: 'your-webhook-secret'
});
// Or monitor events programmatically
client.events.subscribe('agent.activity', (event) => {
console.log('Agent activity:', event);
if (event.type === 'suspicious') {
// Take action on suspicious activity
client.agents.restrict({
id: event.agentId,
reason: 'Suspicious activity detected',
duration: '1h'
});
}
});