Give your agent full read/write access to the inbox you already use — a personal Gmail, a shared Outlook mailbox, or any IMAP account. Messages the agent sends come from your address, and replies land in your inbox. The Nylas CLI handles provider auth and returns structured JSON so your agent can drive every operation from shell commands.
If you’d rather the agent have its own dedicated mailbox (so replies don’t clutter your inbox), see Give your agent its own email.
Prerequisites
Section titled “Prerequisites”Make sure the CLI is installed and authenticated against the account you want to share. If not, follow the AI agents quickstart first.
nylas auth whoami --jsonRead email
Section titled “Read email”List recent messages. Always pass --json for structured output and --limit to control token consumption.
nylas email list --limit 5 --jsonList only unread messages:
nylas email list --unread --limit 10 --jsonRead the full content of a specific message:
nylas email read <MESSAGE_ID> --jsonSend email
Section titled “Send email”Send a message on behalf of the connected user. Always pass --yes to skip the confirmation prompt.
nylas email send \ --subject "Weekly status update" \ --body "Here are this week's highlights..." \ --yesSend with CC and scheduled delivery:
nylas email send \ --subject "Meeting notes" \ --body "Attached are the notes from today's sync." \ --schedule "tomorrow 9am" \ --yesSearch email
Section titled “Search email”Search uses the provider’s native search syntax (Gmail search operators, Microsoft KQL), so queries like from: and has:attachment work as expected.
nylas email search "has:attachment subject:invoice" --limit 10 --jsonManage messages
Section titled “Manage messages”# Mark a message as readnylas email mark read <MESSAGE_ID>
# Star/flag a messagenylas email mark starred <MESSAGE_ID>
# Delete a messagenylas email delete <MESSAGE_ID> --yesExample: inbox triage workflow
Section titled “Example: inbox triage workflow”Here’s a realistic pattern for an agent that triages an inbox:
# 1. Get unread messagesnylas email list --unread --limit 20 --json
# 2. Read the full content of a message that looks importantnylas email read <MESSAGE_ID> --json
# 3. (Agent classifies the message using its LLM)
# 4. Reply to urgent messagesnylas email send \ --subject "Re: Server outage" \ --body "Looking into this now. Will update within the hour." \ --yes
# 5. Mark processed messages as readnylas email mark read <MESSAGE_ID>Using MCP instead
Section titled “Using MCP instead”If your agent supports Model Context Protocol (Claude Code, Cursor, Windsurf, VS Code, Codex CLI), you can register the CLI as an MCP server instead of calling commands directly:
nylas mcp install --assistant claude-codeThis gives your agent typed tools for email operations without subprocess calls. See the MCP docs for details.
What’s next
Section titled “What’s next”- Give your agent its own email — give the agent a dedicated
[email protected]mailbox via a Nylas Agent Account - Share your calendar with your agent — manage events and check availability on your connected calendar
- Give your agent call recordings — record meetings and get transcripts
- AI agents quickstart — full CLI setup and command reference
- CLI guides — 85+ step-by-step guides for email, calendar, and more