The rf create command provides an interactive way to create new agents from pre-built templates. It handles everything: creating the agent on the server, initializing the repository, cloning locally, and installing dependencies.
Basic Usage
# Interactive mode (recommended)
rf create
This will guide you through:
- Entering the agent name
- Choosing a template
- Creating the agent on the server
- Cloning the repository locally
- Installing dependencies
Non-Interactive Mode
Perfect for scripts, CI/CD pipelines, and AI tools (Cursor, Copilot):
# Minimal command
rf create --name my-agent --template starter
# With auto-install (skip dependency prompt)
rf create --name my-agent --template rag-agent --yes
# Short form
rf create -n my-agent -t starter -y
Options
| Option | Alias | Description | Example |
|---|
--name <name> | -n | Agent name (non-interactive) | --name support-bot |
--template <id> | -t | Template ID or name (non-interactive) | --template starter |
--yes | -y | Auto-install dependencies without prompting | --yes |
Available Templates
starter
Minimal setup, perfect for beginners
A simple agent with basic configuration. Best for:
- Learning RunFlow basics
- Quick prototyping
- Custom implementations from scratch
rf create --name my-first-agent --template starter --yes
rag-agent
Agent with knowledge base integration
Pre-configured with RAG (Retrieval Augmented Generation) capabilities. Best for:
- Customer support bots
- Documentation assistants
- Knowledge-based Q&A systems
rf create --name support-bot --template rag-agent --yes
webhook-handler
Process webhooks and integrations
Specialized template for handling external webhooks. Best for:
- Integration workflows
- Event-driven automation
- Third-party service connections
rf create --name webhook-processor --template webhook-handler --yes
What Gets Created?
When you run rf create, the following happens:
-
Server-side Agent Creation
- Agent is created in your RunFlow account
- Git repository is initialized
- Template files are added
-
Local Repository Clone
- Repository is cloned to
./agent-name/
- All template files are downloaded
-
Project Configuration
.runflow/rf.json is created with agent metadata
- Contains:
agentId, agentName, tenantId
-
Dependencies Installation (if confirmed)
npm install is run automatically
- Or skipped if
--yes flag is used
Complete Workflow Example
# 1. Create agent from template
rf create
# → Enter name: "support-bot"
# → Select template: "rag-agent"
# → Install dependencies: Yes
# 2. Navigate to agent folder
cd support-bot/
# 3. Review the structure
ls -la
# .runflow/rf.json - Project configuration
# src/ - Agent source code
# package.json - Dependencies
# README.md - Template documentation
# 4. Set up knowledge base
rf kb create support-docs
rf kb upload support-docs ./docs/faq.pdf
# 5. Test locally
rf test
# 6. Make your changes
# ... edit src/index.ts ...
# 7. Deploy to production
rf agents deploy
The non-interactive mode is designed for seamless integration with AI coding assistants:
# Cursor / Copilot can execute this directly
rf create --name customer-support --template rag-agent --yes
Why it’s AI-friendly:
- No user interaction required
- All parameters via flags
- Automatic dependency installation with
--yes
- Predictable output
- Exit codes for success/failure
Automation & Scripts
Use in bash scripts or CI/CD pipelines:
#!/bin/bash
# Create multiple agents programmatically
agents=("support-bot" "sales-assistant" "feedback-analyzer")
for agent in "${agents[@]}"; do
rf create --name "$agent" --template rag-agent --yes
cd "$agent"
rf kb create "$agent-knowledge"
cd ..
done
Project Structure
After creation, your agent folder will contain:
my-agent/
├── .runflow/
│ └── rf.json # Agent configuration
├── src/
│ └── index.ts # Main agent code
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
└── README.md # Template documentation
.runflow/rf.json
This file contains essential metadata:
{
"agentId": "agent_uuid",
"agentName": "my-agent",
"tenantId": "tenant_123"
}
Don’t delete .runflow/rf.json - it’s required for rf test and rf agents deploy to work!
Common Options Combination
# Quick setup for development
rf create -n dev-agent -t starter -y
# Production RAG agent
rf create -n prod-support -t rag-agent -y
# Webhook handler without dependencies (install later)
rf create -n webhook-handler -t webhook-handler
# → Skip dependency installation when prompted
Troubleshooting
Template Not Found
rf create --name test --template invalid-template
# Error: Template 'invalid-template' not found
Solution: Use one of the available templates: starter, rag-agent, webhook-handler
Agent Name Already Exists
rf create --name existing-agent --template starter
# Error: Agent 'existing-agent' already exists
Solution: Choose a different name or delete the existing agent first with rf agents delete
Dependencies Installation Failed
If dependency installation fails:
# Navigate to agent folder
cd my-agent/
# Manually install dependencies
npm install
# Or use yarn/pnpm
yarn install
pnpm install
Next Steps