@tenzro/cloud
v1.0.3
Published
Official TypeScript SDK for Tenzro Cloud - AI-Native Cloud Infrastructure
Downloads
12
Maintainers
Readme
Tenzro Cloud SDK
Official TypeScript SDK for Tenzro Cloud - AI-Native Cloud Infrastructure.
Installation
npm install @tenzro/cloudQuick Start
import { Tenzro } from '@tenzro/cloud';
const client = new Tenzro({
apiKey: process.env.TENZRO_API_KEY!,
});
// AI Inference
const response = await client.ai.infer({
model: 'gemini-3-flash',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.content);Services
| Service | Description |
|---------|-------------|
| client.ai | AI inference |
| client.agents | AI agents |
| client.workflows | Workflow automation |
| client.vec | Vector database |
| client.kev | Key-value store |
| client.data | SQL database |
| client.graph | Graph database |
| client.files | Object storage |
| client.hub | Model registry |
| client.security | Key management |
| client.enclaves | Confidential computing (TEE) |
| client.server | MCP server |
| client.cortex | Tiny models and training |
| client.projects | Project management |
| client.apiKeys | API key management |
AI Inference
Inference Endpoints
// Create reusable endpoint
const endpoint = await client.ai.createEndpoint({
endpointName: 'customer-support',
model: 'gemini-3-flash',
systemPrompt: 'You are a helpful assistant.',
temperature: 0.7,
});
// Run inference
const response = await client.ai.inferWithEndpoint(endpoint.endpointId, {
prompt: 'How do I reset my password?',
});Embeddings
const result = await client.ai.embed({
texts: ['Hello world', 'Machine learning'],
taskType: 'RETRIEVAL_DOCUMENT',
outputDimensionality: 768,
});Agents
const agent = await client.agents.create({
agentName: 'Research Assistant',
endpointId: endpoint.endpointId,
systemPrompt: 'You help users research topics.',
orchestrationPattern: 'SINGLE',
});
await client.agents.activate(agent.agentId);
const result = await client.agents.chat(agent.agentId, {
message: 'Find information about renewable energy',
});Orchestration Patterns
SINGLE- Single agent processingSUPERVISOR- Supervisor delegates to sub-agentsROUTER- Routes to specialized agentsHIERARCHICAL- Multi-level agent hierarchySWARM- Collaborative agent swarmSEQUENTIAL- Chain of agentsPARALLEL- Concurrent execution
Vector Database
const db = await client.vec.createDatabase({
dbName: 'documents',
dimension: 768,
metricType: 'COSINE',
});
await client.vec.insert(db.vecDbId, {
vectors: [{
id: 'doc1',
vector: embedding,
metadata: { title: 'Document 1' },
}],
});
const results = await client.vec.search(db.vecDbId, {
vector: queryEmbedding,
topK: 10,
});SQL Database
const db = await client.data.createDatabase({ dbName: 'myapp' });
await client.data.createTableFromSchema(db.dataDbId, 'users', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
name: { type: 'string', nullable: false },
email: { type: 'string', unique: true },
});
const results = await client.data.from(db.dataDbId, 'users')
.select('id', 'name', 'email')
.where('name', '=', 'John')
.execute();MCP Server
const server = await client.server.create({
deploymentName: 'knowledge-assistant',
endpointId: endpoint.endpointId,
dataSources: [
{ type: 'VEC', id: vecDbId, name: 'knowledge' },
{ type: 'DATA', id: dataDbId, name: 'business' },
],
});
const response = await client.server.chat(server.deploymentId, {
message: 'What products do we have?',
});Security
const key = await client.security.createKey({
keyName: 'data-encryption',
purpose: 'ENCRYPT_DECRYPT',
algorithm: 'AES_256_GCM',
});
const encrypted = await client.security.encrypt({
keyId: key.keyId,
data: 'sensitive information',
});
const decrypted = await client.security.decrypt({
keyId: key.keyId,
data: encrypted.ciphertext,
});Error Handling
import { APIError, AuthenticationError, RateLimitError } from '@tenzro/cloud';
try {
const response = await client.ai.infer({ ... });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Invalid API key');
} else if (error instanceof RateLimitError) {
console.error(`Rate limited. Retry after ${error.retryAfter}s`);
} else if (error instanceof APIError) {
console.error(`API error: ${error.message}`);
}
}Configuration
const client = new Tenzro({
apiKey: 'sk_xxx',
projectId: 'proj_xxx', // Auto-injected into all requests
ai: { // Default AI configuration
model: 'gemini-3-flash',
temperature: 0.7,
},
timeout: 60000,
maxRetries: 2,
});Requirements
- Node.js 22+
- TypeScript 5.0+ (recommended)
Links
License
Apache-2.0 - Tenzro, Inc.
