Working with Agents
Rexec Agents allow you to connect your own servers, workstations, or cloud VMs to Rexec, giving you secure terminal access through the web interface while maintaining full control over your infrastructure.What are Agents?
An agent is a lightweight process that runs on your machine and establishes a secure WebSocket connection to Rexec. Once connected, you can:- Access your machine’s terminal through the Rexec web UI
- Use your actual hardware resources (not limited by Rexec tiers)
- Keep your data on your own infrastructure
- Connect multiple machines across different locations
- Maintain existing development environments
Agent Limits by Tier
Free Tier
Free Tier
- Registered Agents: Not available on free tier
- Concurrent Terminals: 0
Pro Tier
Pro Tier
- Registered Agents: Unlimited registrations
- Concurrent Terminals: Unlimited connections
- Session Recording: Included
- Multi-pane Terminals: Supported
Enterprise Tier
Enterprise Tier
- Registered Agents: Unlimited
- Concurrent Terminals: Unlimited
- Advanced Monitoring: System stats and metrics
- Priority Support: Dedicated agent assistance
Installing the Agent
Step 1: Register Your Agent
- Navigate to Account → Agents in the Rexec UI
- Click Register New Agent
- Fill in agent details:
- Name: Descriptive name (e.g., “office-workstation”)
- Description: Optional notes
- Tags: Optional labels for organization
- Click Create Agent
- Save the API token - it won’t be shown again!
Step 2: Download the Agent Binary
- Linux (x64)
- macOS (arm64)
- Windows (x64)
Step 3: Connect Your Agent
Running as a Service
systemd (Linux)
Create/etc/systemd/system/rexec-agent.service:
launchd (macOS)
Create~/Library/LaunchAgents/sh.rexec.agent.plist:
Using Agents from the Web UI
Connecting to an Agent Terminal
- Navigate to the Dashboard
- Find your agent in the container list (marked with a server icon)
- Agent status indicators:
- 🟢 online - Agent is connected and ready
- ⚫ offline - Agent is not connected
- Click Connect to open a terminal session
- Your terminal opens with the agent’s shell
Agent Terminal Features
Available:- Real-time terminal access
- Multi-pane terminal splits (Pro+)
- Session recording (Pro+)
- System stats monitoring
- MFA protection (if enabled)
- Resource limits (uses actual machine resources)
- Role-based tool installation (use your own setup)
- Shell theme customization (uses machine’s shell)
Split Panes with Agents
Create multiple independent shell sessions on the same agent:- In an agent terminal, click the Split button
- Each pane gets its own shell session
- Sessions are labeled as
main,split-{id}, etc. - All panes share the same file system
Managing Agents
Update Agent Info
Check Agent Status
List All Agents
Delete an Agent
System Monitoring
Agents automatically report system metrics:CPU and Memory
- CPU Usage: Current CPU utilization percentage
- Memory: Used vs. total memory
- Load Average: System load (Linux/macOS)
Disk Space
- Disk Usage: Used vs. total disk space
- Mount Points: All mounted filesystems
Network
- Connection Status: Last ping time
- WebSocket Health: Auto-reconnect on disconnect
Security Best Practices
Token Management
Token Management
- Never commit tokens to Git - use environment variables
- Rotate tokens periodically - regenerate API tokens every 90 days
- Use separate tokens per agent - easier to revoke if compromised
- Store securely - use systemd secrets or macOS Keychain
Network Security
Network Security
- Use TLS/WSS - Rexec enforces encrypted WebSocket connections
- Firewall rules - Allow outbound WSS to
rexec.sh:443only - No inbound ports - Agent initiates connection, no ports to expose
- Origin validation - Agent validates server certificates
Access Control
Access Control
- MFA on terminals - Enable MFA for sensitive agents
- Session recording - Audit terminal activity (Pro+)
- Limited permissions - Run agent as non-root user when possible
- Time-based access - Use short-lived tokens for temporary access
Troubleshooting
Agent Won't Connect
Agent Won't Connect
Check Network:Verify Token:Check Logs:Common Issues:
- Invalid token: Token was revoked or agent was deleted
- Network restrictions: Corporate firewall blocking WSS
- Wrong agent ID: Ensure ID matches registration
Agent Shows Offline in UI
Agent Shows Offline in UI
The agent is considered offline if no heartbeat is received for 2 minutes.Possible Causes:
- Agent process stopped
- Network interruption
- Server restart (agent will auto-reconnect)
Terminal Connection Failed
Terminal Connection Failed
If the UI shows the agent as online but terminal connection fails:
- Check agent logs for shell startup errors
- Verify shell is installed (bash, zsh, or sh)
- Test shell manually on the machine:
$SHELL --version - Check permissions - agent user needs shell access
Multiple Sessions Interfering
Multiple Sessions Interfering
If you open multiple terminals to the same agent:
- Main session is shared by default (same shell)
- Split panes create independent sessions
- Use newSession=true in WebSocket connection to get separate shells
Advanced Configuration
Custom Server URL
Connect to a self-hosted Rexec instance:Auto-reconnect Settings
Proxy Configuration
API Reference
Register Agent
WebSocket Terminal Connection
token- Your auth JWT or API tokenid- Stable connection ID (for reconnects)newSession- Create new shell session (default: false)