Overview
Thegateway command starts the PicoClaw gateway server, which enables the agent to interact with users through various messaging platforms and channels. The gateway manages incoming messages, scheduled tasks (cron jobs), heartbeat monitoring, device events, and health checks.
Usage
picoclaw g
Flags
Enable debug logging to see detailed information about gateway operations, including:
- Channel connection details
- Message routing
- Agent tool usage
- Service lifecycle events
What the Gateway Does
When started, the gateway:- Initializes the Agent: Loads tools and skills
- Starts Services:
- Cron service for scheduled tasks
- Heartbeat service for periodic checks
- Device monitoring service (if enabled)
- Media cleanup service (if enabled)
- Connects Channels: Establishes connections to configured messaging platforms
- Starts HTTP Server: Provides health endpoints and webhook handlers
- Processes Messages: Routes incoming messages to the agent and sends responses
Startup Output
Supported Channels
The gateway supports multiple messaging platforms:- Telegram: Bot API integration
- Discord: Bot integration
- Slack: App integration
- WhatsApp: Business API and native
- Feishu/Lark: Bot integration
- DingTalk: Bot integration
- WeCom: Enterprise WeChat
- QQ: Bot integration
- LINE: Messaging API
- OneBot: Standard protocol
- MaixCAM: Custom device integration
- Pico: Custom protocol
config.yaml file.
Health Endpoints
The gateway exposes HTTP endpoints for monitoring:/health
Returns gateway health status
/ready
Returns readiness status for load balancers
Services
Cron Service
Executes scheduled tasks defined viapicoclaw cron commands. Tasks run in the background and can optionally deliver results to specified channels.
Heartbeat Service
Periodically checks system health and can trigger agent actions based on configured prompts.Device Service
Monitors USB device events and can trigger workflows when devices are connected/disconnected (e.g., MaixCAM devices).Media Cleanup
Automatically removes old media files based on TTL configuration to prevent disk space issues.Examples
Start Gateway (Standard)
Start Gateway with Debug Logging
Using the Alias
Configuration
The gateway is configured viaconfig.yaml:
Graceful Shutdown
PressCtrl+C to stop the gateway. It will:
- Stop accepting new messages
- Complete in-flight requests (15 second timeout)
- Close channel connections
- Stop all services
- Clean up resources
Tips
- First Run: Ensure you’ve configured at least one channel before starting the gateway
- Port Conflicts: If port 8080 is in use, change
gateway.portin config - Debug Mode: Use
-dflag when troubleshooting channel connections - Health Checks: Set up monitoring to poll
/healthendpoint - Reverse Proxy: Consider using nginx or similar for production deployments
- Firewall: Ensure configured port is accessible if using webhooks
Common Issues
No Channels Enabled
Output:config.yaml
Port Already in Use
Error:Configuration Error
Error:picoclaw onboard first to create configuration
Docker Deployment
Example Docker Compose configuration:Exit Codes
0: Clean shutdown1: Error (configuration, channel, or service failure)
See Also
- picoclaw agent - Direct agent interaction
- picoclaw cron - Manage scheduled tasks
- picoclaw status - Check gateway configuration
- Channels Configuration - Configure messaging platforms