When AI Agents Run
When AI Agents Run
An agent runs when something starts it. You can always start one yourself with Run on the Agents list. Everything else is set up as a trigger under When it runs in the agent's settings (open the agent in the Workbench, then About this agent), or by turning on Can be run from chat.
Adding a trigger
Save the agent first — a trigger has to belong to something. Then in When it runs press Add a trigger and choose:
- On a schedule
- When a condition is met
- When an automation asks
Every trigger has a name (What is this trigger called?), a Turn this trigger on switch, and What it hands the agent — named values its steps can use. Press Save this trigger. Saved triggers show Last fired and Next, and have Fire now to start a run from that trigger immediately.
On a schedule
Under How often choose Every hour, Every 15 minutes, Every day, at a time, Every weekday, at a time, Every week, on a day, or A cron expression I type (five fields). Set At what time, On which day where relevant, and the Timezone the time is in. The schedule is read back to you as a sentence with its next run times so you can check it.
When a condition is met
A condition trigger watches some data and runs the agent when a rule about it becomes true.
- Under What should it watch? choose A saved SQL query, A lookup table, A Plex data source (and which credential to read it with), or A script.
- Press See what it sees now. DataMagik reads the source, shows the first ten rows, and fills in the fields you can compare.
- Build the rule under Run the agent when with Add a rule and Add a group — for example How many rows came back greater than 0, or Any row — Status is Late. Comparisons include is, is not, greater than, at least, less than, at most, contains, is one of, is present and matches pattern. The preview tells you whether the rule is TRUE or FALSE right now.
The condition is checked about every 30 seconds. It runs the agent once when it becomes true, and again only after it has been false — so a condition that stays true does not start a run every 30 seconds. Only the first 200 rows of the source are read, and a read that takes longer than 25 seconds is abandoned.
When an automation asks (an automation button)
This lets a button in the DataMagik browser extension — or any automation — hand what it saw to an agent.
- In the agent's When it runs, add a When an automation asks trigger and save it.
- Choose Which automation and press Create the automation action. The automation editor opens in a new tab with the action already set up.
- Or, in the automation editor yourself: add an action, set its type to 🤖 Run an AI Agent, and pick the agent's trigger from the Agent trigger dropdown. Each entry reads Agent name — trigger name, and triggers that are switched off are marked (Disabled). If the list is empty, the company has no automation triggers yet — add one to an agent first, then reopen the action.
When the action runs, the agent is given what the button saw: the selected rows, answers to the automation's questions, its parameters, and the Plex screen and URL. The action returns straight away with "The agent was started. It runs on its own; open AI Agents → Runs to watch it." The automation does not wait for the agent, and the agent failing later does not change the automation's result. The agent's card under Automations that ask this agent lists every automation action that starts it.
From the AI Assistant chat (@)
Turn on Can be run from chat under Name & purpose. In the
AI Assistant chat — in DataMagik or in the browser extension's chat panel — type
@ to see Agents you can run and pick one. Sending the message then runs the agent instead
of asking the assistant. If the agent needs values, a small form asks for them before Run agent.
A card follows the run's progress with Open the run, and the result joins the conversation so you can
ask follow-up questions about it.
An agent appears in the @ list only when it is turned on, has a saved version, has
Can be run from chat on, and the person is allowed to see it.
Other ways agents start
Some ready-made agents start from events rather than triggers you configure — for example when an EDI document fails or needs review, when an EDI acknowledgement passes its deadline, when an operator badges onto a workcenter Plex does not list them as approved for, or when a Shop Floor escalation step hands an issue to an agent. Their row on the Agents list says what starts them.
Every run, whatever started it, is recorded under Runs — see AI Agent Approvals, Safety & Monitoring.