rf test command starts a local development server with a web interface for testing your agents. Features live reload, real-time monitoring, and zero configuration.
Basic Usage
Features
- ⚡ Zero configuration - Auto-detects agent from
.runflow/rf.json - 🔄 Live reload - Automatically restarts on file changes
- 🌐 Web portal with real-time monitoring
- 🚀 Auto browser - Opens automatically at
http://localhost:PORT - 📊 Traces storage - Saved locally in
.runflow/traces.json - 🎯 Smart ports - Auto-selects available port (3000-4000)
Options
| Option | Description | Example |
|---|---|---|
-p, --port <port> | Specify port number | rf test --port 4500 |
--no-browser | Don’t open browser automatically | rf test --no-browser |
Examples
Start Test Server
Specify Port
http://localhost:4500/agents/your-agent/test-monitor
Without Browser
http://localhost:PORT/agents/your-agent/test-monitor
How It Works
- Auto-detection: The CLI reads
.runflow/rf.jsonin the current directory to identify the agent - Port Selection: Automatically finds an available port between 3000-4000
- Web Server: Starts a local server with full observability features
- Browser: Opens the test monitor interface automatically (unless
--no-browseris used) - File Watcher: Monitors your code for changes
- Live Reload: Automatically restarts on file save
- Real-time Monitoring: See execution traces, costs, and performance metrics in real-time
- Local Storage: All traces are saved to
.runflow/traces.jsonfor analysis
Live Reload
The test server automatically detects file changes and reloads:- All
.tsand.jsfiles insrc/ package.json.runflow/rf.json
No need to restart the server! Just save your files and test.
Web Interface Features
The local web portal provides:- 📊 Real-time execution monitoring
- 💰 Cost tracking (tokens and costs per execution)
- ⏱️ Performance metrics (duration, latency)
- 🔍 Trace inspection (full execution details)
- 🧪 Interactive testing (send test messages)
- 📝 Execution history (stored locally)
- 🔄 Live reload status (shows when code changes)
Testing Workflow
Development Best Practices
Rapid Iteration
Testing with Knowledge Base
Debugging
The web interface shows detailed traces:Local Traces
All execution traces are saved to.runflow/traces.json in a structured format:
- Analyze execution patterns
- Debug issues offline
- Track performance over time
- Compare different executions
Troubleshooting
Port Already in Use
If you see a port conflict error:Agent Not Detected
Make sure you’re in the agent directory with.runflow/rf.json:
rf agents clone first.
Browser Doesn’t Open
If the browser doesn’t open automatically:Live Reload Not Working
If changes aren’t detected:- Check file location - Only files in
src/are watched - Save file properly - Ensure file is actually saved
- Check console - Look for reload messages
- Restart server - Press Ctrl+C and run
rf testagain
Dependencies Not Installed
API Key Missing
Traces Not Saving
If traces aren’t saved to.runflow/traces.json:
- Check permissions - Ensure write access to
.runflow/ - Check disk space - Ensure sufficient space
- Check file -
cat .runflow/traces.json
Advanced Usage
Custom Port
Multiple Agents
CI/CD Testing
Performance Tips
Fast Iteration
- Keep server running - don’t restart
- Use live reload - save and test
- Monitor console for reload status
- Check traces for bottlenecks
Debugging Slow Responses
The web interface shows timing breakdown:Next Steps
Agents
Deploy your tested agent
Knowledge Base
Test with knowledge base
Prompts
Test prompt changes
Observability
Learn about observability features