Reloop CLI for AI Agents
How to use the Reloop CLI in AI agent workflows.
The Reloop CLI is purpose-built for AI agent workflows — every command supports machine-readable JSON output, deterministic exit codes, and stdin piping. See the full CLI reference for all available commands.
Agent Skills
Install the CLI agent skill so your agent knows how to use the Reloop CLI effectively:
npx skills add reloop/reloop-cli
Non-interactive mode
Every CLI command supports --json for machine-readable output:
- Output: JSON to stdout, no progress indicators
- Exit codes:
0for success,1for errors - Errors: Always include
messageandcodefields
{
"error": {
"message": "No API key found",
"code": "auth_error"
}
}
Piping from stdin
Use - as the value of any file flag to read from stdin:
echo "Your order has shipped." | reloop emails send \
--from "Acme <onboarding@example.com>" \
--to delivered@example.com \
--subject "Order update" \
--text-file -
This also works with --html-file - and --file - for batch commands.
Batch sending
Use emails batch to send up to 100 emails in a single request:
cat emails.json | reloop emails batch --file -
Safe retries
Use --idempotency-key to safely retry failed sends without risking duplicates:
reloop emails send \
--from "Acme <onboarding@example.com>" \
--to delivered@example.com \
--subject "Welcome" \
--text "Hello!" \
--idempotency-key "welcome-user-123"
Idempotency keys are supported on both emails send and emails batch commands.
Scheduling
Use --scheduled-at to schedule emails for future delivery:
reloop emails send \
--from "Acme <onboarding@example.com>" \
--to delivered@example.com \
--subject "Your trial ends soon" \
--text "Your free trial expires in 3 days." \
--scheduled-at "tomorrow at 9am ET"
You can cancel or reschedule with:
reloop emails cancel <id>
reloop emails update <id> --scheduled-at <datetime>
Reading inbound emails
The emails receiving listen command starts a long-running process that watches for new inbound emails:
reloop emails receiving listen --json
To fetch a specific received email:
reloop emails receiving get <email-id>
Make sure you have a verified domain with receiving enabled.
Closing the loop with webhooks
The webhooks listen command subscribes to webhook events and streams them to your terminal:
reloop webhooks listen \
--url https://hostname.tailnet-name.ts.net \
--events email.delivered email.bounced email.received
Press Ctrl+C to stop listening. The webhook is automatically removed when you disconnect.
To forward webhooks to a local development server, use --forward-to:
reloop webhooks listen \
--url https://hostname.tailnet-name.ts.net \
--forward-to http://localhost:4321/api/webhook
If you prefer to set up webhooks manually, use reloop webhooks create.
Was this page helpful?