Skip to main content

Terminal Agent

The WatchTower terminal agent runs on each POS device and connects to the platform via bidirectional gRPC streaming. It reports heartbeats, GPS location, and transactions in real-time, and receives commands (block, unblock, config updates) from the platform.

Architecture

┌─────────────────────┐         gRPC (TLS)         ┌──────────────────┐
│   POS Terminal      │ ◄──────────────────────── ► │  WatchTower      │
│                     │                             │  Platform        │
│  ┌───────────────┐  │   Heartbeats (30s)  ──►    │                  │
│  │ Your POS App  │  │   Transactions      ──►    │  Ingestion GW    │
│  │               │  │   Status Changes    ──►    │       │          │
│  │  ┌─────────┐  │  │                             │       ▼          │
│  │  │WatchTower│  │  │   Block Commands   ◄──    │  NATS JetStream  │
│  │  │  SDK     │  │  │   Config Updates   ◄──    │       │          │
│  │  └─────────┘  │  │   Ping/Keepalive   ◄──    │       ▼          │
│  └───────────────┘  │                             │  Rules Engine    │
│                     │                             │  Dashboard       │
└─────────────────────┘                             └──────────────────┘

SDK vs Standalone Agent

SDK (Recommended)Standalone APK
IntegrationEmbedded in your POS appSeparate app installed on terminal
TransactionsReports transactions as they happenCannot access other apps’ transaction data
Block CommandsApp can disable payment flow directlyCannot control other apps
SetupAdd Gradle dependencyInstall APK
Best ForTerminal developers building POS appsMonitoring terminals you don’t control

Available SDKs

LanguagePackageStatus
Kotlin (Android)io.watchtower:agent-sdk✅ Available
Gogithub.com/watchtower-io/agent-go🚧 Coming soon
Pythonpip install watchtower-agent🚧 Coming soon

Key Features

  • Bidirectional gRPC streaming — single persistent connection for all data
  • Automatic reconnection — exponential backoff (1s → 60s) with jitter
  • Offline queue — transactions stored in local SQLite when disconnected, flushed on reconnect
  • GPS tracking — uses Android LocationManager (no Google Play Services required)
  • Remote configuration — heartbeat interval adjustable from the platform
  • Block/Unblock commands — platform can disable terminal transactions in real-time

Authentication

Each terminal authenticates with an agent API key (wt_agent_*). The key is included in the first gRPC message. Generate keys from the WatchTower dashboard under Settings → API Keys.

Data Flow

Agent → Platform (upstream):
  • Heartbeats — GPS coordinates, battery level, signal strength, uptime (every 30s)
  • Transactions — amount, type, status, reference, response code (real-time)
  • Status changes — terminal state transitions
Platform → Agent (downstream):
  • Block command — soft block (agent-enforced) or hard block (processor-level)
  • Unblock command — resume transaction processing
  • Config update — change heartbeat/GPS intervals remotely
  • Ping — keep-alive signal