Docs / Contact / sdks/nano-agent/cli
Nano Agent: CLI Client
The tendrl binary is a command-line client for the Nano Agent socket. Use it for debugging, install verification, cron jobs, and quick manual tests without writing socket code or piping JSON through nc.
It ships in the same the platform's tool downloads as tendrl-agent (e.g. tendrl-linux-amd64, tendrl-darwin-arm64, tendrl-windows-amd64.exe).
The CLI talks to the local Unix socket only. Authentication is handled by the running tendrl-agent process.
Install
The nano-agent installer puts both binaries on your PATH — tendrl-agent and this tendrl CLI — with checksums verified. One command on any platform:
macOS / Linux
curl -fsSL https://app.tendrl.com/api/public/tools/nano-agent/v1/latest/install.sh | sh
Windows
powershell -c "irm https://app.tendrl.com/api/public/tools/nano-agent/v1/latest/install.ps1 | iex"
Already installed the agent that way? Then you have the CLI too. Direct per-platform downloads are listed at /api/public/tools/nano-agent/v1/meta (e.g. tendrl-darwin-arm64).
From Source
git clone https://github.com/tendrl-inc-labs/nano-agent.git
cd nano-agent
go build -o tendrl ./cmd/tendrl
Quick Start
Make sure tendrl-agent is running, then:
# Verify the socket is reachable
tendrl ping
# Publish sensor data
tendrl publish -data '{"temperature": 22.5, "humidity": 65}' -tags sensor
# Check for incoming commands
tendrl check -limit 5
Commands
Global Flags
| Flag | Default | Description |
|---|---|---|
-socket |
platform default | Override agent socket path |
-version |
— | Print version and exit |
Default socket paths:
| Platform | Path |
|---|---|
| Linux/macOS | /var/lib/tendrl/tendrl_agent.sock |
| Windows | C:\ProgramData\tendrl\tendrl_agent.sock |
ping
Check that the agent socket accepts connections.
tendrl ping
Exits 0 on success. Useful in install scripts and health checks.
publish
Send a publish message. Queued and batched by default unless -wait is set.
tendrl publish -data '{"temperature": 22.5}' -tags sensor,environment
tendrl publish -data '{"command": "reboot"}' -dest control-panel-01
tendrl publish -data '{"status": "ok"}' -wait
| Flag | Description |
|---|---|
-data |
JSON payload, or @file.json to read from a file |
-tags |
Comma-separated routing tags (max 10) |
-dest |
Target entity name |
-entity |
Entity identifier |
-wait |
Wait for server response instead of async batching |
check
Poll for incoming messages (msg_check).
tendrl check
tendrl check -limit 10
Prints a JSON array of messages. Prints nothing when no messages are pending (agent returns 204).
heartbeat
Send a heartbeat with system metrics (heartbeat).
tendrl heartbeat -data '{"mem_free": 1024.0, "mem_total": 4096.0, "disk_free": 50000.0, "disk_size": 100000.0}'
If -data is omitted, sends an empty object.
state
Manage the entity state table.
tendrl state read
tendrl state new -data '{"firmware": "1.2.0", "mode": "active"}'
tendrl state update -data '{"mode": "standby"}'
state new and state update accept -wait to block for a server response.
Output and Exit Codes
- Successful JSON responses are pretty-printed to stdout
- Agent errors (
{"status":"error","message":"..."}) are printed to stderr with exit code 1 publishwithout-waitexits 0 immediately after the message is queued
Shell Script Example
#!/bin/bash
set -euo pipefail
tendrl ping
while true; do
CPU=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}')
MEM=$(free -m | awk 'NR==2{printf "%.1f", $3*100/$2}')
tendrl publish -data "{\"cpu\":$CPU,\"memory\":$MEM}" -tags system,metrics
sleep 60
done
When to Use the CLI vs Raw Socket
Use tendrl CLI |
Use raw socket / SDK |
|---|---|
| Debugging and manual testing | Production application code |
Install verification (tendrl ping) |
High-throughput embedded loops |
| Cron jobs and shell scripts | Languages without a Tendrl SDK |
Windows (no nc -U) |
Custom connection pooling |
For the full socket protocol, see API Reference. For language-specific SDKs with agent mode, see Python, Go, or JavaScript.
Tendrl