Docs / Contact / sdks/nano-agent/configuration

Nano Agent: Configuration

The Nano Agent is configured via command-line flags and environment variables.

Flags & Environment Variables

Flag Env Variable Default Description
-apiKey TENDRL_KEY Entity API key (required)
-appURL TENDRL_APP_URL https://app.tendrl.com/api API base URL
-socket TENDRL_SOCKET platform default Unix socket path; override for local/dev use (the system default needs root to create)
-minBatchSize 10 Minimum messages per batch
-maxBatchSize 200 Maximum messages per batch
-maxQueue 1000 Maximum queued messages before backpressure
-targetCPU 70.0 Target CPU % for dynamic batch sizing
-targetMem 80.0 Target memory % for dynamic batch sizing
-flushInterval 250ms Maximum time between flushes

Examples

bash

# Default settings
./tendrl-agent -apiKey=YOUR_KEY

# High-throughput edge device
./tendrl-agent -apiKey=YOUR_KEY -maxBatchSize=500 -maxQueue=5000

# Low-resource device
./tendrl-agent -apiKey=YOUR_KEY -maxBatchSize=50 -maxQueue=200 -targetCPU=50

Socket Security

Access to the Unix socket is restricted by group membership on all platforms.

Linux / macOS

The agent runs as user/group tendrl. The socket directory (/var/lib/tendrl) and socket file are owned by the tendrl group with restricted permissions (770 directory, 660 socket). Only root or members of the tendrl group can connect.

bash

# Create the group (if not done during install)
sudo groupadd tendrl

# Add your application user
sudo usermod -aG tendrl your-app-user

# Verify
groups your-app-user

Windows

The agent creates a local tendrl group and sets an ACL on C:\ProgramData\tendrl so only group members (and administrators) can access the socket.

powershell

# Add a user (elevated prompt)
net localgroup tendrl YourUser /add

# Verify ACL
icacls "C:\ProgramData\tendrl"

Running as a Service

systemd (Linux)

Create /etc/systemd/system/tendrl-agent.service:

ini

[Unit]
Description=Tendrl Nano Agent
After=network.target

[Service]
Type=simple
Environment=TENDRL_KEY=your_api_key
ExecStart=/usr/local/bin/tendrl-agent
Restart=always
User=tendrl
Group=tendrl

[Install]
WantedBy=multi-user.target
bash

sudo cp tendrl-agent.service /etc/systemd/system/
sudo systemctl enable --now tendrl-agent

launchd (macOS)

Create ~/Library/LaunchAgents/com.tendrl.agent.plist:

xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.tendrl.agent</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/tendrl-agent</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>TENDRL_KEY</key>
        <string>your_api_key</string>
    </dict>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
bash

launchctl load ~/Library/LaunchAgents/com.tendrl.agent.plist

Windows (NSSM)

powershell

nssm install TendrlAgent "C:\Program Files\Tendrl\tendrl-agent.exe"
nssm set TendrlAgent Environment "TENDRL_KEY=your_api_key"
nssm start TendrlAgent

Logging

Linux: Logs to systemd journal:

bash

journalctl -u tendrl-agent -f       # Follow logs
journalctl -u tendrl-agent -p err   # Errors only

Windows: Check Event Viewer under Applications, or run the agent in console mode.

macOS: Check Console.app or run in foreground for direct output.

Troubleshooting

Permission Denied (Unix/Linux)

bash

# Check socket permissions
ls -l /var/lib/tendrl/tendrl_agent.sock

# Fix ownership
sudo chown :tendrl /var/lib/tendrl/tendrl_agent.sock
sudo chmod 660 /var/lib/tendrl/tendrl_agent.sock

# Add your user to the group
sudo usermod -aG tendrl $(whoami)
# Log out and back in for group changes to take effect

AF_UNIX Not Available (Windows)

powershell

# Verify Windows version (need 1803+)
winver

# Check AF_UNIX driver
sc query afunix

Connection Refused

bash

# Check if agent is running
systemctl status tendrl-agent    # Linux
launchctl list | grep tendrl     # macOS

# Check socket exists
ls -l /var/lib/tendrl/tendrl_agent.sock

Queue Full

The agent returns {"status":"error","message":"Queue full, try again later"} when the message queue is at capacity. Solutions: