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 templatenpx create-tenzro-app my-app --template ragnpx create-tenzro-app my-app --template chatbotnpx create-tenzro-app my-app --template multi-agentnpx create-tenzro-app my-app --template next-app
Available Templates
| Template | Description |
|---|---|
default | Basic Tenzro project with a single agent |
rag | Retrieval-Augmented Generation with vector search |
chatbot | Conversational AI chatbot with memory |
multi-agent | Hierarchical multi-agent orchestration |
next-app | Full-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# orpnpm 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.tsimport { 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 toolsmcpServers: [], // MCP server IDs to connect});
Define Tools
// tools/calculator.tsimport { 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.tsimport { 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.tsimport { 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 servertenzro dev# Start with specific porttenzro dev --port 3200# Start without hot reloadtenzro dev --no-hot
Building
# Build for productiontenzro build# Build specific componentstenzro build --agentstenzro build --workflows
Deployment
# Deploy to Tenzro Cloudtenzro deploy# Deploy specific componentstenzro deploy --agentstenzro deploy --serverstenzro deploy --workflows# Deploy with environmenttenzro deploy --env production
Agent Commands
# Chat with an agent interactivelytenzro agent chat assistant# Execute agent with inputtenzro agent run assistant "Process order #123"# List agentstenzro agent list# Get agent infotenzro agent info assistant
Workflow Commands
# Run a workflowtenzro workflow run content-pipeline --input '{"topic": "AI"}'# List workflowstenzro workflow list# Get workflow statustenzro workflow status content-pipeline
Server Commands
# List MCP serverstenzro server list# Start a servertenzro server start database-server# Stop a servertenzro server stop database-server# Get server logstenzro server logs database-server
Environment Variables
Create a .env file with your configuration:
# RequiredTENZRO_API_KEY=your_api_key_hereTENZRO_PROJECT_ID=your_project_id_here# OptionalTENZRO_API_URL=https://api.cloud.tenzro.com# For Next.js apps (client-side)NEXT_PUBLIC_TENZRO_API_KEY=your_api_key_hereNEXT_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.tsximport { TenzroProvider } from '@tenzro/react';export default function RootLayout({ children }) {return (<html><body><TenzroProviderapiKey={process.env.NEXT_PUBLIC_TENZRO_API_KEY!}projectId={process.env.NEXT_PUBLIC_TENZRO_PROJECT_ID}>{children}</TenzroProvider></body></html>);}// app/api/chat/route.tsimport { 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 devto test before deploying - Version control: Commit tenzro.config.ts and agent definitions