> ## Documentation Index
> Fetch the complete documentation index at: https://flywheel.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# New Event Trigger

> Start an agent run when a specific user event occurs in your application

<iframe src="http://localhost:3000/doc-comp-previews/agent-node-preview?type=new_event" title="Agent Node Preview" width="100%" height="250px" className="border dark:border-[#1C1C20] rounded-xl" />

## How New Event Trigger Works

When a user performs an action that matches your trigger configuration, the agent immediately starts a run for that user. New Event triggers respond to specific user actions or events that occur in your application and are ideal for real-time, context-aware responses to user behavior.

Unlike workflow event triggers which follow a fixed action sequence, agent event triggers pass the full event and user context to the language model, which then reasons about what tools to call and how to act.

## Configuration

<Columns cols={2}>
  <Card title="Inputs">
    <ParamField path="Trigger Event" type="string" required>
      Select the specific event name that should start an agent run. Examples: `user_signed_up`, `subscription_created`, `purchase_completed`, `trial_started`.
    </ParamField>
  </Card>

  <Card>
    <iframe src="http://localhost:3000/doc-comp-previews/agent-config-preview?type=new_event" title="Agent Config Preview" width="100%" height="420px" className="" />
  </Card>
</Columns>

<Card title="Outputs">
  <ParamField path="event" type="object" required>
    The complete event data that triggered the agent run.

    <Expandable title="Event Properties">
      <ParamField path="event.id" type="string" required>
        Unique database identifier for this event.
      </ParamField>

      <ParamField path="event.event_id" type="string" required>
        Unique external identifier for this event.
      </ParamField>

      <ParamField path="event.event_name" type="string" required>
        The name of the event that triggered the run.
      </ParamField>

      <ParamField path="event.timestamp" type="string" required>
        ISO datetime when the event occurred.
      </ParamField>

      <ParamField path="event.created_at" type="string" required>
        ISO datetime when the event was created in the system.
      </ParamField>

      <ParamField path="event.org_user_id" type="string" required>
        Internal Flywheel user identifier associated with the event.
      </ParamField>

      <ParamField path="event.org_assigned_user_id" type="string">
        Your company's external user identifier, if available.
      </ParamField>

      <ParamField path="event.org_id" type="number" required>
        Organization identifier.
      </ParamField>

      <ParamField path="event.anonymous_id" type="string">
        Anonymous identifier for the user, if available.
      </ParamField>

      <ParamField path="event.event_source" type="string">
        The source of the event (e.g., web, mobile, API).
      </ParamField>

      <ParamField path="event.event_location" type="string">
        The location where the event occurred, if available.
      </ParamField>

      <ParamField path="event.event_type" type="enum">
        The type of event: `track` or `identify`.
      </ParamField>

      <ParamField path="event.schema_id" type="string">
        Schema identifier for the event structure, if applicable.
      </ParamField>

      <ParamField path="event.custom_properties" type="object" required>
        Contains all event-specific data and custom properties specific to your application and event type.
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField path="org_user" type="object" required>
    Comprehensive user information for the user who triggered the event.

    <Expandable title="User Properties">
      <ParamField path="org_user.id" type="string" required>
        Unique user identifier.
      </ParamField>

      <ParamField path="org_user.org_id" type="number" required>
        Organization identifier.
      </ParamField>

      <ParamField path="org_user.org_assigned_user_id" type="string">
        Your company's external user identifier.
      </ParamField>

      <ParamField path="org_user.primary_email" type="string">
        User's primary email address.
      </ParamField>

      <ParamField path="org_user.primary_phone" type="string">
        User's primary phone number.
      </ParamField>

      <ParamField path="org_user.first_name" type="string">
        User's first name.
      </ParamField>

      <ParamField path="org_user.last_name" type="string">
        User's last name.
      </ParamField>

      <ParamField path="org_user.created_at" type="string" required>
        ISO datetime when the user was created.
      </ParamField>

      <ParamField path="org_user.updated_at" type="string" required>
        ISO datetime when the user was last updated.
      </ParamField>

      <ParamField path="org_user.subscription_status" type="enum" required>
        Current subscription status: `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, `paused`, `inactive`.
      </ParamField>

      <ParamField path="org_user.payment_processor" type="enum" required>
        Payment processor used: `stripe` or `paddle`.
      </ParamField>

      <ParamField path="org_user.mrr" type="number">
        Monthly recurring revenue from this user.
      </ParamField>

      <ParamField path="org_user.ltv" type="number">
        Lifetime value of the user.
      </ParamField>

      <ParamField path="org_user.first_payment_date" type="string">
        ISO datetime of user's first payment.
      </ParamField>

      <ParamField path="org_user.next_payment_date" type="string">
        ISO datetime of user's next scheduled payment.
      </ParamField>

      <ParamField path="org_user.cancels_at" type="string">
        ISO datetime when subscription will be cancelled (if applicable).
      </ParamField>

      <ParamField path="org_user.primary_contact_method" type="string">
        User's preferred contact method.
      </ParamField>

      <ParamField path="org_user.contact_info" type="object" required>
        Additional contact information and preferences.
      </ParamField>

      <ParamField path="org_user.csm" type="object" required>
        Customer Success Manager information assigned to this user.
      </ParamField>

      <ParamField path="org_user.custom_properties" type="object" required>
        Custom user properties you've defined.
      </ParamField>
    </Expandable>
  </ParamField>
</Card>

## Use Cases

**New User Onboarding**

```
Event: user_signed_up
Agent behavior: Evaluate user profile, check account fit, send personalized onboarding guidance, assign CSM if enterprise tier
```

**Trial Conversion Outreach**

```
Event: trial_started
Agent behavior: Check activation milestones, search for prior engagement, send contextual onboarding email or Slack message
```

**High-Value Purchase Follow-up**

```
Event: purchase_completed
Agent behavior: Analyze purchase context, generate personalized thank-you email, notify account owner via Slack
```

**Churn Risk Response**

```
Event: subscription_canceled
Agent behavior: Gather cancellation context, check usage patterns via Find Event, create Intercom ticket for retention team
```

## Best Practices

**Choose Stable Event Names**

* Use consistent, predictable event names that match your tracking plan
* Ensure required event properties exist if your tools or prompt rely on them
* Test with realistic payloads before enabling Live mode

**Consider Event Frequency**

* Some events may fire multiple times for the same user
* Use your agent prompt to describe how to handle duplicate or repeated events
* Consider whether the agent should check for recent runs before acting

**Monitor Performance**

* Track trigger activation rates and run completion in the Runs tab
* Review agent reasoning and tool selection for quality
* Iterate on prompts based on real run data
