{"slug": "the-cli-first-way-to-manage-agent-accounts", "title": "The CLI-First Way to Manage Agent Accounts", "summary": "Nylas released a CLI-first approach to managing Agent Accounts, hosted mailboxes that applications can own end-to-end. The Nylas CLI enables developers to create, monitor, and tear down email identities entirely from the terminal, with commands for account creation, email operations, and calendar management. The tool supports JSON output for automation and includes features like IMAP/SMTP access and natural-language scheduling.", "body_md": "There's a specific kind of friction in provisioning infrastructure through a web UI: you're building an automated system, but step one is clicking through a dashboard. For email identities that your code creates, monitors, and tears down, the browser is the wrong tool. The Nylas CLI closes that gap — every part of an Agent Account's lifecycle is a terminal command.\n\nAgent Accounts (currently in beta) are hosted mailboxes with real addresses that your application owns end-to-end. They send, receive, and hold calendar events like any human account, and the [quickstart](https://developer.nylas.com/docs/v3/getting-started/agent-accounts/) gets you from API key to working mailbox in under 5 minutes. Here's how to do all of it without leaving the shell.\n\nIf you've never touched the CLI before:\n\n```\nbrew install nylas/nylas-cli/nylas\n# or, without Homebrew:\ncurl -fsSL https://cli.nylas.com/install.sh | bash\n\nnylas init\n```\n\n`nylas init`\n\nopens a browser once for account creation and sign-in — the only step that needs a human. After that, verify with `nylas auth whoami --json`\n\n, which returns your active grant, provider, and status as parseable JSON. If you already have an API key, skip the browser entirely with `nylas init --api-key <NYLAS_API_KEY>`\n\n(add `--region eu`\n\nfor EU data residency).\n\nWant to confirm the binary works before wiring up credentials? `nylas demo email list`\n\nreturns sample data with no authentication at all — useful in provisioning scripts that should fail fast if the install step broke.\n\nWith a domain registered (either your own with MX and TXT records, or a `*.nylas.email`\n\ntrial subdomain for instant testing), creation is one line:\n\n```\nnylas agent account create agent@yourdomain.com\n```\n\nThe CLI prints the new grant ID plus status and connector details. That grant ID is the handle for everything else — messages, calendar, webhooks.\n\nWant a human to supervise the mailbox from Outlook or Apple Mail? Create it with IMAP/SMTP access enabled:\n\n```\nnylas agent account create agent@yourdomain.com --app-password \"MySecureP4ssword!2024\"\n```\n\nThree commands cover the \"what do I have and is it working\" questions:\n\n```\nnylas agent account list --json     # every Agent Account on the application\nnylas agent account get agent@yourdomain.com   # one account, by ID or email\nnylas agent status --json           # connector readiness\n```\n\nAccounts also show up in `nylas auth list`\n\nwith `Provider: Nylas`\n\n, side by side with any OAuth-connected grants. Switch between them with `nylas auth switch`\n\n, and the regular email and calendar commands operate on whichever is active:\n\n```\nnylas email list --limit 5 --json\nnylas email send --to \"you@example.com\" --subject \"Hi\" --body \"From the agent.\" --yes\nnylas calendar events list --days 7 --json\n```\n\nNote the flags. The [autonomous agents guide](https://developer.nylas.com/docs/v3/getting-started/cli-for-agents/) is blunt about this: always pass `--json`\n\nfor parseable output, always pass `--yes`\n\non sends and deletes so nothing blocks on a confirmation prompt, and always pass `--limit`\n\n(start with 5) so list commands don't flood whatever's consuming the output.\n\nOnce an account exists, the everyday email commands go well beyond list-and-send. Search, read a specific message, and even schedule delivery for later:\n\n```\nnylas email search \"meeting agenda\" --limit 5 --json\nnylas email read <MESSAGE_ID> --json\n\nnylas email send \\\n  --to \"alice@example.com\" \\\n  --cc \"bob@example.com\" \\\n  --subject \"Project update\" \\\n  --body \"Status report attached.\" \\\n  --schedule \"tomorrow 9am\" \\\n  --yes\n```\n\nThe calendar side has a similar range — list events, create them with explicit timestamps, or find a slot that works for multiple people:\n\n```\nnylas calendar find-time \\\n  --participants \"alice@example.com,bob@example.com\" \\\n  --duration 30m \\\n  --json\n\nnylas calendar schedule ai \"Find 30 minutes with Alice next week\"\n```\n\nThat last one is natural-language scheduling: you hand it a sentence, it works out the slot. All of these operate on whichever grant is active, so they work identically against an Agent Account and a human's OAuth-connected mailbox.\n\nPolicies and rules — the guardrails that control send limits, spam handling, and inbound filtering — are inspectable the same way:\n\n```\nnylas agent policy list\nnylas agent rule list\n```\n\nAnd webhooks, so your code reacts to inbound mail in real time:\n\n```\nnylas webhook triggers     # see what you can subscribe to\nnylas webhook create \\\n  --url https://youragent.example.com/webhooks/nylas \\\n  --triggers \"message.created,message.updated\"\nnylas webhook list\n```\n\nThese work against any grant, connected or agent-owned.\n\nEphemeral identities only make sense if destruction is as cheap as creation:\n\n```\nnylas agent account delete agent@yourdomain.com --yes\n```\n\nDelete by email or by grant ID; `--yes`\n\nskips the confirmation so it's scriptable.\n\nThe failure modes are predictable enough to script around. The autonomous agents guide ships a troubleshooting table; here's the short version:\n\n| Symptom | Fix |\n|---|---|\n`nylas: command not found` |\nRe-run the install, or use the full path (`/opt/homebrew/bin/nylas` ) |\n`error.type: \"unauthorized\"` |\nRun `nylas dashboard apps apikeys create` to mint a new API key |\n`not_found_error` on a grant |\nRun `nylas auth login` to reconnect |\n`rate_limit_error` |\nBack off and retry |\n| Commands hang | You forgot `--yes` on a send or delete |\n| Empty results |\n`nylas auth list` to check accounts, `nylas auth switch` to change |\n\nErrors come back in the same JSON envelope as the API — a `request_id`\n\nplus an `error`\n\nobject with `type`\n\nand `message`\n\n— so a script can branch on `error.type`\n\ninstead of grepping prose.\n\nThe dashboard is fine for a first look. The CLI wins everywhere else:\n\n`create`\n\ncommand in a setup script is documentation; a sequence of dashboard clicks isn't.`--json`\n\noutput and non-interactive `--yes`\n\nflag exist precisely so an autonomous process never hangs on a prompt.`nylas auth token`\n\nprints the raw API key and `nylas auth whoami --json`\n\ngives you the grant ID — two commands and your `.env`\n\nis populated.There's also an escape hatch in both directions. Everything the CLI does maps to plain API calls (account creation is `POST /v3/connect/custom`\n\nwith `\"provider\": \"nylas\"`\n\n), so you can graduate to SDK code whenever a script outgrows the shell. And if your editor or agent speaks MCP, `nylas mcp install`\n\nregisters 16 email, calendar, and contacts tools so you skip subprocess calls entirely.\n\nNext step: register a trial domain, run `nylas agent account create test@your-application.nylas.email`\n\n, and send yourself a message from it. Total elapsed time should be a coffee refill. Then check `nylas agent status --json`\n\nand see what a healthy connector looks like before you build anything on top.", "url": "https://wpnews.pro/news/the-cli-first-way-to-manage-agent-accounts", "canonical_source": "https://dev.to/qasim157/the-cli-first-way-to-manage-agent-accounts-3hp9", "published_at": "2026-06-15 20:04:30+00:00", "updated_at": "2026-06-15 20:32:52.541054+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-products"], "entities": ["Nylas", "Nylas CLI", "Agent Accounts", "Homebrew"], "alternates": {"html": "https://wpnews.pro/news/the-cli-first-way-to-manage-agent-accounts", "markdown": "https://wpnews.pro/news/the-cli-first-way-to-manage-agent-accounts.md", "text": "https://wpnews.pro/news/the-cli-first-way-to-manage-agent-accounts.txt", "jsonld": "https://wpnews.pro/news/the-cli-first-way-to-manage-agent-accounts.jsonld"}}