Decide when an onboarding agent nudges a stalled account

Agent buildEasy10 min

Your task

New customers stall during onboarding because nobody notices they are stuck on step 3 of 8. An agent tracks each account's checklist and decides who to nudge, without ever spamming a customer.

Write decide_onboarding_nudge(days_since_progress, ignored_nudges, days_since_last_nudge, agent_silenced): the rule your agent follows for each account, each day.

  • days_since_progress (int): days since the account last completed a step.
  • ignored_nudges (int): nudges sent so far that got no response.
  • days_since_last_nudge (int): days since the last nudge, or -1 if there has never been one.
  • agent_silenced (bool): the account's owner has muted the agent for this account.

It returns one of the values in the rules below. Apply them in order. The first one that matches decides:

  1. agent_silenced: "silenced".
  2. ignored_nudges of 2 or more: "escalate_human".
  3. days_since_progress below 3: "wait", because the account is not stalled.
  4. days_since_last_nudge from 0 to 6: "wait". At most one nudge a week, and -1 means there is no cooldown.
  5. ignored_nudges of 0: "nudge_internal", a message to your own account owner.
  6. Otherwise: "queue_customer_email", a template email waiting for a person's approval.

Examples

decide_onboarding_nudge(days_since_progress: int, ignored_nudges: int, days_since_last_nudge: int, agent_silenced: bool) -> str
Example 1
Inputdecide_onboarding_nudge(5, 0, -1, False)
Output"nudge_internal"
Example 2
Inputdecide_onboarding_nudge(5, 1, 9, False)
Output"queue_customer_email"
Example 3
Inputdecide_onboarding_nudge(1, 0, -1, False)
Output"wait"