RunFlow CLI supports multi-tenant profiles, allowing you to save multiple API keys and easily switch between different accounts, clients, or environments.
Why Use Profiles?
Profiles are perfect for:
- Agencies managing multiple client accounts
- Developers working across dev, staging, and production
- Teams switching between different projects
- Consultants handling multiple customer environments
Commands Overview
| Command | Description |
|---|
rf login --profile <name> | Save API key as named profile |
rf switch [profile] | Switch to a different profile |
rf profiles | List all saved profiles |
rf profiles current | Show current active profile |
rf profiles delete <name> | Delete a profile |
Creating Profiles
Save Profile During Login
# Save API key as named profile
rf login --profile acme-corp
# → Enter API key: sk-xxx...
# → Profile 'acme-corp' saved
# Save another profile
rf login --profile tech-startup
# → Enter API key: sk-yyy...
# → Profile 'tech-startup' saved
Non-Interactive Profile Creation
# Create profile with API key directly
rf login --api-key sk-xxx... --profile production
rf login --api-key sk-yyy... --profile development
Switching Between Profiles
Interactive Switch
# Shows menu of all profiles
rf switch
# → Select profile:
# • acme-corp
# • tech-startup
# • production
Direct Switch
# Switch to specific profile
rf switch acme-corp
# ✓ Switched to profile: acme-corp
# Verify current profile
rf profiles current
# Current profile: acme-corp (tenant: tenant_123)
Listing Profiles
# List all saved profiles
rf profiles
# Output:
# Available profiles:
# • default
# • acme-corp (current)
# • tech-startup
# • production
Show Current Profile
rf profiles current
# Output:
# Current profile: acme-corp
# Tenant ID: tenant_abc123
# Tenant Name: ACME Corporation
# API URL: https://api.runflow.ai
Deleting Profiles
# Delete a profile (with confirmation)
rf profiles delete acme-corp
# ? Are you sure you want to delete profile 'acme-corp'? (y/N)
# Delete without confirmation
rf profiles delete acme-corp --yes
# ✓ Profile 'acme-corp' deleted
You cannot delete the currently active profile. Switch to another profile first.
Multi-Tenant Workflow Example
Agency Managing Multiple Clients
# Setup profiles for each client
rf login --profile client-acme --api-key sk-acme...
rf login --profile client-techco --api-key sk-tech...
rf login --profile client-startup --api-key sk-start...
# Work with Client ACME
rf switch client-acme
rf agents list
rf create --name acme-support-bot --template rag-agent --yes
# Switch to different client
rf switch client-techco
rf agents list
rf kb create techco-docs
Developer: Dev, Staging, Production
# Setup environment profiles
rf login --profile dev --api-key sk-dev...
rf login --profile staging --api-key sk-staging...
rf login --profile prod --api-key sk-prod...
# Develop on dev environment
rf switch dev
rf create --name test-agent --template starter --yes
cd test-agent/
rf test
# Test on staging
rf switch staging
rf agents list
# → clone agent from dev
rf test
# Deploy to production
rf switch prod
rf agents deploy
Configuration File
Profiles are stored in ~/.runflowrc:
{
"currentProfile": "acme-corp",
"profiles": {
"default": {
"apiKey": "sk-xxx...",
"apiUrl": "https://api.runflow.ai",
"tenantId": "tenant_123",
"tenantName": "My Company"
},
"acme-corp": {
"apiKey": "sk-yyy...",
"apiUrl": "https://api.runflow.ai",
"tenantId": "tenant_abc",
"tenantName": "ACME Corporation"
},
"tech-startup": {
"apiKey": "sk-zzz...",
"apiUrl": "https://api.runflow.ai",
"tenantId": "tenant_xyz",
"tenantName": "Tech Startup Inc"
}
}
}
The config file is automatically managed by the CLI. You typically don’t need to edit it manually.
Profile Aliases
You can use profile names in any command that requires authentication:
# Override profile for single command
rf agents list --profile production
# Create agent using specific profile
rf create --name test --template starter --profile development
# Login and immediately use
rf login --profile temp --api-key sk-temp...
rf agents list --profile temp
Best Practices
1. Use Descriptive Names
# ✅ Good - clear and descriptive
rf login --profile client-acme-production
rf login --profile internal-dev
rf login --profile staging-us-west
# ❌ Avoid - unclear names
rf login --profile profile1
rf login --profile test
rf login --profile x
2. Separate Environments
# Create separate profiles for each environment
rf login --profile mycompany-dev
rf login --profile mycompany-staging
rf login --profile mycompany-prod
3. Client Naming Convention
For agencies managing multiple clients:
rf login --profile clientname-environment
rf login --profile acme-prod
rf login --profile acme-dev
rf login --profile techco-prod
4. Keep Default Profile Clean
Use the default profile for your primary/personal account:
# Default profile (no name needed)
rf login
# → Saved as 'default'
# Client-specific profiles
rf login --profile client-work
Security Considerations
API keys are stored in plain text in ~/.runflowrc. Ensure this file has proper permissions:
Best Practices:
- Don’t share your
~/.runflowrc file
- Use environment-specific API keys
- Rotate keys regularly
- Delete unused profiles
- Never commit
.runflowrc to git
Troubleshooting
Profile Not Found
rf switch nonexistent
# Error: Profile 'nonexistent' not found
Solution: List available profiles with rf profiles and use an existing one.
Cannot Delete Current Profile
rf profiles delete acme-corp
# Error: Cannot delete the current profile
Solution: Switch to another profile first:
rf switch default
rf profiles delete acme-corp
Lost API Key
If you lose access to a profile’s API key:
# Delete the old profile
rf profiles delete old-profile --yes
# Create new profile with new API key
rf login --profile new-profile --api-key sk-new...
Next Steps