Skip to content

How to build an event-triggered agent with Tray Helix

The most useful agents start before anyone asks. Wake the agent when a deal closes, a ticket lands or a deadline nears.

Last reviewed November 2026

App, built with Tray Helix

The short answer

On Tray Helix, an agent can start from an event in three ways. A system that can send a webhook calls the app's API route with a Helix API token. Any app event Tray can trigger on, such as a closed deal in Salesforce, starts a Tray workflow that calls the same route. And a scheduled function in the app wakes the agent on a timetable. However it starts, the agent runs with the same tools, approvals and logs.

onboarding-agent.helix-app.ai

Onboarding Agent

Closed won: Northwind Logistics

Event from Salesforce via Tray workflow · 16:40

Trigger
Opportunity stage changed to Closed Won
Proposed project
Onboarding, Enterprise template, CSM: Ana Silva
Proposed kickoff
Tuesday 10:00, invite to 4 contacts
Tool waiting
create_onboarding_project, needs approval

Agent run

  • 16:40 Workflow called the agent route with the deal Tray workflow
  • 16:40 Read the deal, contacts and products Agent
  • 16:41 Paused: create_onboarding_project needs approval Agent
A sketch of a run that started on its own. The event, the reads and the waiting write are all under one run.

What matters here

  • A Tray Helix agent can start from a webhook or app route, from any app event through a Tray workflow trigger, or on a schedule.
  • An event-triggered agent calls the same API route as every other caller, with a named Helix API token you can revoke.
  • A Tray workflow trigger lets an agent react to events in any app Tray connects to, not only the ones with webhooks.
  • Writes still wait for approval, so an agent that starts on its own still asks before it changes anything.
  • Each run is logged under the event that started it, so you can trace any action back to its cause.

Who this is for

You have an agent, or a job for one, that should start when something happens in another system. You don't want a person to notice the event and press a button.

How it works in practice

From an event in another system to a proposal waiting for a person.

  1. 1

    Something happens

    A deal closes, a ticket is created, an alert fires or a date arrives.

  2. 2

    The agent is woken

    A webhook calls the app's route, a Tray workflow trigger calls it for any app event, or a scheduled function runs.

  3. 3

    It reads what it needs

    The event carries the ID, and the agent's read tools fetch the rest.

  4. 4

    It proposes the work

    Writes are tools marked for approval, so the run pauses and the owner gets a notice.

  5. 5

    A person approves

    The run picks up where it left off and does the work.

What an event-triggered agent is made of

A route, the triggers that call it, and the agent you already have.

An event route

An API route on the app that takes an event type and an ID, and starts the agent. Called with a Helix API token.

Triggers

Webhooks from systems that can send them, Tray workflow triggers for any app event, and scheduled functions.

The agent

Read tools run on their own. Write tools are marked for approval.

An event log

Each event, the run it started and the outcome, so nothing fires twice unnoticed.

The prompts

Paste these into Claude Code, Codex or Cursor in order. Each one leaves you with something that runs, so you can stop after any step.

These prompts start from a Helix project, which is what handles sign-in, credentials and hosting. Start with Helix.

1

An event route

One door for every trigger.

Claude Code, Codex or Cursor

In my Helix app, add an API route that starts the agent from an event.

It takes an event type and a record ID. Store each event with when it arrived, its source, and the run it started. Ignore an event with the same type and ID that arrived in the last ten minutes, so a retry does not start a second run.

Then run the agent and return the run ID with its status: done, or waiting for approval.

2

The onboarding agent

What to do when a deal closes.

Claude Code, Codex or Cursor

Add an agent that prepares customer onboarding when a deal closes.

Give it these tools:

- get_deal: read the opportunity, its products and contacts.

- pick_template: choose the onboarding template for the products sold.

- create_onboarding_project: create the project and its tasks.

- propose_kickoff: draft a kickoff invite. It must not send anything.

Mark create_onboarding_project as needing approval every time. When a proposal is waiting, post the customer success owner in Slack with a link.

3

Add a schedule

For work that runs on a timetable.

Claude Code, Codex or Cursor

Add a scheduled function that runs every weekday at 8:00. It finds onboarding projects with a kickoff date in the next two days and no confirmed time, and runs the agent to propose a time.

4

Connect it to real systems

Your events, your tools.

Claude Code, Codex or Cursor

Now connect it to the systems we actually run.

Anything in angle brackets is a placeholder. Swap it for whatever we use.

<Salesforce>. A Tray workflow triggers when an opportunity moves to Closed Won and calls this app's event route with a Helix API token.

<Asana>. Create the onboarding project after approval.

<Slack>. Post waiting proposals to the owner.

Only write through create_onboarding_project.

Give the workflow its own named Helix API token, so you can revoke that caller without touching the others.
5

Ship it

A URL, and the triggers pointed at it.

Claude Code, Codex or Cursor

Deploy my app.

Your assistant runs helix deploy and the app comes back as a URL. Point the workflow and any webhooks at the event route.

What it connects to

Three ways in, one agent.

Named systems are the ones most teams actually run, not a list of the only ones that work. Swap in whatever you use.

Running it for real

The build gets you an agent that starts itself. Running it means every caller is named, writes still wait, and each run traces to its event.

  1. 1

    Deploy the app and its agent together

    One command, or Deploy from CI on every merge, takes the app to a live URL. The agent ships with its app, so you can roll back any deployment.

  2. 2

    A named token for each trigger

    Each caller uses a Helix API token: a named API user you can revoke, with every call logged.

  3. 3

    Approval, even unattended

    An agent that starts on its own still pauses before any write, and the approver sees the tool and the exact input.

  4. 4

    Every run traced to its event

    Runs are logged under the event that started them, and Tray streams the logs to your SIEM.

  5. 5

    Know what events cost

    AI usage shows per app, so a noisy trigger shows up as cost before it shows up as a problem.

Questions people ask

Can a Tray Helix agent start from an event?

Yes. A webhook or app route, any app event through a Tray workflow trigger, or a scheduled function in the app can start it. The agent runs with the same tools, approvals and logs however it starts.

What if the system has no webhooks?

Use a Tray workflow trigger. Tray connects to 12,000+ apps, databases, APIs, and services, so the workflow can react to the event and call the agent's route with a Helix API token.

Does an agent that starts on its own still ask for approval?

Yes. Writes are tools marked for approval, so the run pauses and the owner gets a notice, however the run started.

How do I stop the same event starting two runs?

Store each event and ignore a repeat of the same type and ID within a short window. The prompts above build that into the event route.

Build it, then run it properly

Helix is the governed runtime for AI-built apps and agents. Deploy what you build, put SSO in front of it, connect it to your systems with managed credentials, and give it a named owner.