How do I alert on run duration for a single agent?
Rius lets you alert on run duration for a single agent with a custom alert that has an Agent filter and a rule on the Duration metric. The filter limits the alert to spans that carry that agent’s identity. The rule then compares Duration, aggregated per trace, against a threshold you set in milliseconds. For example, p95(Duration) > 30000 over a 15 minute window fires when the slowest 5% of that agent’s runs take longer than 30 seconds.
How it works
A custom alert is one or more rules, combined with AND, evaluated over one shared rolling window. Filters apply first and select which spans feed the rules. Aggregation happens after that.
- The Agent filter. It matches the agent identity Rius derives, as each span carries it. Every span with that value is selected, not only the root span. This is why the Agent filter measures whole runs.
- Duration is per trace. Numeric metrics use per-trace semantics.
avg(Duration)is the average duration per trace in the window, not a total across the workspace. Duration offers avg, min, max, p50, p95 and p99, and the unit is milliseconds. - Some metrics are per call. Time to first token, Context usage and LLM calls are measured per LLM call, so their aggregations run over calls, not traces. Duration is not one of them.
- Narrower filters change what Duration covers. If you add a Step, Model, Span kind or Operation filter, Duration runs, per trace, from the earliest matched span’s start to the latest matched span’s end. It no longer covers the whole run. For run duration, filter by Agent, or by Service, and leave those four filters out.
The window can be anywhere from 5 minutes to 24 hours. An alert takes up to 10 filters with up to 50 values each, and up to 10 rules.
Set it up
- Open the custom alert builder and add a filter on Agent. Pick the agent from the suggested values, which come from your workspace’s live data. Use
=for one agent. Useinif the same agent appears under several names you want to cover together. - Add a rule on Duration. Choose an aggregation that fits what you want to catch. Use
avgfor a general slowdown, orp95orp99for the slow tail of runs. Choose a comparison and enter the threshold in milliseconds, so 30 seconds is 30000. - Set the window. A window of 15 minutes reacts quickly. A longer window smooths out a few slow runs. All rules in the alert share this one window.
- Check the plain-language preview in the builder. It states exactly when the alert fires, and that sentence becomes the alert’s description on its details page.
- Attach channels so the firing reaches you. Webhook, email and Slack are available.
The alert you build reads like this:
FILTERS Agent = checkout-agent
RULES p95(Duration) > 30000
WINDOW 15 minutesRules combine with AND only, with no OR and no nesting. If you want to alert on slow runs or on errors, create a second alert for the second condition. For example, a second rule count(Errors) > 10 in the same alert would require both conditions to hold at once.
The full list of filters, metrics and limits is on the Custom alerts page.
What you get
- An alert that watches only the agent you named, so a slow agent does not hide behind the rest of your workspace.
- A run duration reading per trace, aggregated the way you chose: average, percentile, minimum or maximum.
- A details page with the generated description, the editable rule, the attached channels and the firings. Each firing records the observed value of every rule against its threshold, so you can see which condition tripped.
- An alert you can delete when you no longer need it. Deleting removes its firing history after an explicit confirmation.
Agent-scoped Duration is one use of the custom alert builder. The overview of all alert types is on the Alerts page.
When something else fits
- To watch several agents at once, filter on Service instead of Agent. Service matches the
service.namefrom your instrumentation and also measures whole runs. - To time one step, such as a single tool, add a Step or Span kind filter. Keep in mind that Duration then covers only the matched spans, from the earliest start to the latest end, not the whole run.
- If you want a summary of duration and time to first token rather than a trigger, the usage and cost views show the same metrics without an alert.