Automation
06 / 10

The CLI is a pipe, not a REPL

Every command is a single shot — in, out, exit code. That makes it composable: chain it, cron it, or treat it as a prettier curl.

Machine-readable output

vectr agent "top 5 tokens by market cap" --json | jq '.response'

The JSON is the raw job result — status, response, richData. A job that produced a transaction surfaces it in richData, which a script can detect and act on.

Exit codes

  • 0
    Meaning
    Command succeeded — including an empty token list
    Script response
    Consume the output
  • 1
    Meaning
    Failed job, API error, or missing login
    Script response
    Read stderr — the error message is on it

A cron pattern

# crontab — write the native price to a log every hour
0 * * * * vectr price >> ~/vectr-price.log 2>&1

Cron jobs run without your shell environment — use absolute paths if the binary isn't on cron's PATH, and keep the API key read-only if the script only reads.

When to skip the CLI

The CLI formats for humans; the API underneath is the real scripting surface. If a script needs more than one endpoint, structured errors, or streaming, call the API directly — https://api.vectr.bot — rather than parsing table output. SSE streams in particular have no CLI equivalent: use API → SSE streams.

Automation that moves funds needs a different trust model

vectr agent never signs — a script can queue transactions all day and they all wait for a human. For execution that must be autonomous, the answer is a read-write API key scoped with recipient and IP allowlists — see API → Authentication.