CLI and create-tenzro-app

Command-line tools for building, deploying, and managing Tenzro applications. Includes the CLI for development and create-tenzro-app for scaffolding.

create-tenzro-app

Scaffold new Tenzro projects with pre-configured templates:

npx create-tenzro-app my-app
# Or with specific template
npx create-tenzro-app my-app --template rag
npx create-tenzro-app my-app --template chatbot
npx create-tenzro-app my-app --template multi-agent
npx create-tenzro-app my-app --template next-app

Available Templates

TemplateDescription
defaultBasic Tenzro project with a single agent
ragRetrieval-Augmented Generation with vector search
chatbotConversational AI chatbot with memory
multi-agentHierarchical multi-agent orchestration
next-appFull-stack Next.js app with Tenzro integration

Options

npx create-tenzro-app [name] [options]
Options:
-t, --template <template> Project template (default: "default")
--typescript Use TypeScript (default: true)
--no-git Skip git initialization
--no-install Skip installing dependencies
-V, --version Display version
-h, --help Display help

Project Structure

my-app/
├── agents/ # Agent definitions
│ └── assistant.ts
├── tools/ # Custom tool definitions
├── workflows/ # Workflow definitions
├── app/ # Application code
│ └── index.ts
├── memory/ # Memory storage configs
├── tenzro.config.ts # Tenzro configuration
├── package.json
├── tsconfig.json
└── .env.example

@tenzro/cli

The CLI package provides programmatic APIs and commands for development:

npm install @tenzro/cli
# or
pnpm add @tenzro/cli

Configuration

Create a tenzro.config.ts file in your project root:

import { defineConfig } from '@tenzro/cli/config';
export default defineConfig({
name: 'my-app',
version: '0.1.0',
api: {
baseUrl: process.env.TENZRO_API_URL || 'https://api.cloud.tenzro.com',
},
ai: {
defaultProvider: 'google',
defaultModel: 'gemini-2.5-flash',
},
dev: {
port: 3100,
watch: true,
hot: true,
},
memory: {
kev: {
sessions: {
name: 'sessions',
description: 'User session storage',
},
},
},
});

Define Agents

// agents/assistant.ts
import { defineAgent } from '@tenzro/cli';
export default defineAgent({
name: 'assistant',
description: 'A helpful AI assistant',
provider: 'google',
model: 'gemini-2.5-flash',
systemPrompt: `You are a helpful AI assistant.
Be concise, accurate, and helpful in your responses.`,
orchestrationPattern: 'SINGLE',
tools: ['search', 'calculator'], // Reference defined tools
mcpServers: [], // MCP server IDs to connect
});

Define Tools

// tools/calculator.ts
import { defineTool } from '@tenzro/cli';
export default defineTool({
name: 'calculator',
description: 'Perform mathematical calculations',
inputSchema: {
type: 'object',
properties: {
expression: {
type: 'string',
description: 'Mathematical expression to evaluate',
},
},
required: ['expression'],
},
handler: async ({ expression }) => {
try {
// Safe evaluation (use a proper math library in production)
const result = eval(expression);
return { result };
} catch (error) {
return { error: 'Invalid expression' };
}
},
});

Define Workflows

// workflows/content-pipeline.ts
import { defineWorkflow } from '@tenzro/cli';
export default defineWorkflow({
name: 'content-pipeline',
description: 'Generate and publish content',
triggerType: 'webhook',
nodes: [
{
id: 'research',
type: 'agent',
agent: 'researcher',
prompt: 'Research the topic: {{input.topic}}',
},
{
id: 'write',
type: 'agent',
agent: 'writer',
prompt: 'Write content based on: {{research.output}}',
},
{
id: 'publish',
type: 'http',
method: 'POST',
url: '{{env.CMS_API_URL}}/posts',
body: {
title: '{{input.title}}',
content: '{{write.output}}',
},
},
],
edges: [
{ from: 'input', to: 'research' },
{ from: 'research', to: 'write' },
{ from: 'write', to: 'publish' },
],
});

Define MCP Servers

// servers/database.ts
import { defineMCP } from '@tenzro/cli';
export default defineMCP({
name: 'database-server',
description: 'Access to application database',
dataSource: {
type: 'data',
id: process.env.DATABASE_ID,
},
tools: [
{
name: 'query_users',
description: 'Query user data',
inputSchema: {
type: 'object',
properties: {
filter: { type: 'object' },
limit: { type: 'number', default: 10 },
},
},
},
],
publicAccess: false,
minInstances: 1,
maxInstances: 5,
});

CLI Commands

Development

# Start development server
tenzro dev
# Start with specific port
tenzro dev --port 3200
# Start without hot reload
tenzro dev --no-hot

Building

# Build for production
tenzro build
# Build specific components
tenzro build --agents
tenzro build --workflows

Deployment

# Deploy to Tenzro Cloud
tenzro deploy
# Deploy specific components
tenzro deploy --agents
tenzro deploy --servers
tenzro deploy --workflows
# Deploy with environment
tenzro deploy --env production

Agent Commands

# Chat with an agent interactively
tenzro agent chat assistant
# Execute agent with input
tenzro agent run assistant "Process order #123"
# List agents
tenzro agent list
# Get agent info
tenzro agent info assistant

Workflow Commands

# Run a workflow
tenzro workflow run content-pipeline --input '{"topic": "AI"}'
# List workflows
tenzro workflow list
# Get workflow status
tenzro workflow status content-pipeline

Server Commands

# List MCP servers
tenzro server list
# Start a server
tenzro server start database-server
# Stop a server
tenzro server stop database-server
# Get server logs
tenzro server logs database-server

Environment Variables

Create a .env file with your configuration:

# Required
TENZRO_API_KEY=your_api_key_here
TENZRO_PROJECT_ID=your_project_id_here
# Optional
TENZRO_API_URL=https://api.cloud.tenzro.com
# For Next.js apps (client-side)
NEXT_PUBLIC_TENZRO_API_KEY=your_api_key_here
NEXT_PUBLIC_TENZRO_PROJECT_ID=your_project_id_here

TypeScript Types

import type {
AgentDefinition,
ToolDefinition,
WorkflowDefinition,
MCPServerConfig,
TenzroConfig,
AIProvider,
AIModel,
OrchestrationPattern,
TriggerType,
} from '@tenzro/cli';

Next.js Integration

The next-app template includes full Next.js integration:

// app/layout.tsx
import { TenzroProvider } from '@tenzro/react';
export default function RootLayout({ children }) {
return (
<html>
<body>
<TenzroProvider
apiKey={process.env.NEXT_PUBLIC_TENZRO_API_KEY!}
projectId={process.env.NEXT_PUBLIC_TENZRO_PROJECT_ID}
>
{children}
</TenzroProvider>
</body>
</html>
);
}
// app/api/chat/route.ts
import { Tenzro } from 'tenzro';
const tenzro = new Tenzro({
apiKey: process.env.TENZRO_API_KEY!,
});
export async function POST(request: Request) {
const { message, agentId } = await request.json();
const response = await tenzro.agents.chat(agentId, {
message,
});
return Response.json(response);
}

Best Practices

  • Environment variables: Keep API keys in .env files, never commit them
  • Type safety: Use TypeScript for full type inference
  • Modular agents: Define agents in separate files for maintainability
  • Test locally: Use tenzro dev to test before deploying
  • Version control: Commit tenzro.config.ts and agent definitions