Overview
Agentic AI can run as a background service (daemon) that:- ✅ Starts automatically on login/boot
- ✅ Restarts on crash
- ✅ Runs the scheduler for automated calls
- ✅ Logs to persistent files
- ✅ Requires no manual intervention
src/agenticai/cli.py:722-1055 (service management commands)
Prerequisites
# Install cloudflared
brew install cloudflared
# Start permanent tunnel
cloudflared tunnel --url http://localhost:8080
Install the Service
Install Agentic AI as a launchd service:-
Creates a launchd plist file at:
- Configures auto-start on login
- Sets up crash recovery
-
Creates log directory:
- Loads the service (but doesn’t start it yet)
src/agenticai/cli.py:828-891
Service Commands
Start the Service
Stop the Service
Restart the Service
Check Service Status
src/agenticai/cli.py:993-1034
View Logs
Follow logs in real-time:src/agenticai/cli.py:1036-1055
Uninstall the Service
- Stops the service
- Removes the plist file
- Preserves logs in
/tmp/agenticai/
src/agenticai/cli.py:893-912
Service Configuration
The service is configured via a launchd plist file.Plist Location
Generated Configuration
src/agenticai/cli.py:728-786
Key Configuration Options
| Option | Description |
|---|---|
RunAtLoad | Start service when loaded (on login) |
KeepAlive | Automatically restart if crashed |
ThrottleInterval | Wait 10 seconds between restart attempts |
StandardOutPath | Log stdout to file |
StandardErrorPath | Log stderr to separate file |
Daemon Mode
Alternatively, run in daemon mode without installing as a service:- Starts the server
- Starts the scheduler
- Shows next scheduled call times
- Runs in foreground (use Ctrl+C to stop)
src/agenticai/cli.py:257-308
Daemon mode is useful for testing, but service mode is recommended for production.
Logs and Monitoring
Log Files
| File | Content |
|---|---|
/tmp/agenticai/agenticai.log | Standard output (INFO logs) |
/tmp/agenticai/agenticai-error.log | Error output (ERROR logs) |
Tail Logs
Standard logs:Log Rotation
For production, set up log rotation:- Keep 7 backups
- Rotate when size exceeds 10MB
- Compress old logs (J flag)
Auto-Start on Boot
The service automatically starts on login by default.Verify Auto-Start
-
Install the service:
- Restart your computer
-
Check service status:
Disable Auto-Start
If you want manual control:Crash Recovery
The service automatically restarts if it crashes.How It Works
src/agenticai/cli.py:767-782
Test Crash Recovery
-
Find the service PID:
-
Kill the process:
- Wait 10 seconds
-
Check status again:
Update Webhook URL
To change the webhook URL:Troubleshooting
Service won't start
Service won't start
Symptoms:
agenticai service start failsSolutions:-
Check if already running:
-
Check for port conflicts:
-
Verify plist exists:
-
Check error logs:
-
Validate plist syntax:
src/agenticai/cli.py:789-820Service starts but crashes immediately
Service starts but crashes immediately
Symptoms: Service shows as running but PID disappearsSolutions:
-
Check error logs:
-
Common issues:
- Missing environment variables in
.env - Invalid Twilio/OpenAI credentials
- Port 8080 already in use
- Config.yaml syntax errors
- Missing environment variables in
-
Test manually first:
-
Verify all services:
Logs not appearing
Logs not appearing
Symptoms:
/tmp/agenticai/ is empty or outdatedSolutions:-
Check log directory exists:
-
Create directory manually:
-
Check permissions:
-
Restart service:
src/agenticai/cli.py:852Service doesn't auto-start on login
Service doesn't auto-start on login
Symptoms: Must manually start service after rebootSolutions:
-
Verify plist is loaded:
-
Reload the plist:
-
Check
RunAtLoadis true: -
Reinstall service:
Advanced: Custom Service Configuration
For advanced users, you can manually edit the plist:Add Environment Variables
Change Log Location
Reload After Changes
Monitoring Service Health
Check Service is Running
List Active Calls
macOS Activity Monitor
- Open Activity Monitor
- Search for “agenticai”
- View CPU, memory usage, and PID
Next Steps
Scheduling Calls
Automate calls with schedules
Making Calls
Trigger outbound calls
Receiving Calls
Handle incoming calls
Telegram Integration
Monitor calls via Telegram