Command

nylas agent rule create

Create a rule for an Agent Account policy.

Written by Qasim Muhammad Staff SRE

What does nylas agent rule create do?

The nylas agent rule create command adds a rule that can block, archive, mark, or otherwise control messages for Agent Account workflows. Use --condition for field/operator/value matching, --action for the rule action, and optional flags such as --priority, --trigger, or --match-operator to place the rule in the right policy path.

Usage

nylas agent rule create --condition FIELD,OPERATOR,VALUE --action ACTION [--json]

Flags

FlagDescription
--jsonOutput as JSON
--no-colorDisable color output
--verbose(-v)Enable verbose output
--configCustom config file path
--help(-h)Show help for the command
--limitLimit results (most list commands)
--yes(-y)Skip confirmations
--conditionRule condition in field,operator,value form
--actionRule action such as block, archive, or mark_as_read
--priorityRule priority
--triggerTrigger direction such as inbound or outbound
--match-operatorHow multiple conditions are combined
--dataInline JSON rule data
--data-filePath to a JSON file containing rule data
--descriptionRule description
--disabledCreate the rule in a disabled state
--enabledCreate the rule in an enabled state
--nameRule name

Examples

Block a sender domain

nylas agent rule create \
  --condition from.domain,is,example.com \
  --action block \
  --priority 10 \
  --json

Create from JSON

nylas agent rule create --data-file rule.json --json

Example output

✓ Rule created (rule_abc123)
  Name:      Block Example
  Trigger:   inbound
  Condition: from.domain is example.com
  Action:    block

Attached to the default agent workspace.

Troubleshooting

Unknown action

Use documented action names such as block, archive, mark_as_read, or mark_as_starred. Check the Agent Accounts docs before adding a custom action.

Rule created but not applied

Rules attach to the agent's default workspace automatically. To group the rule under a custom policy, include its ID in the policy body (nylas agent policy create --data) or attach rule IDs to the workspace with nylas workspace update --rules-ids.

Recommended guides

Run nylas agent rule create --help for full help output.