Skip to Content

How can my coding agent create an alert rule in Rius?

Your coding agent creates an alert rule in Rius by calling the create_alert_rule tool on the Rius MCP server. You ask in plain words, such as “Alert me when the checkout agent starts erroring”, and the agent fills in the rule name, thresholds, window and filters. The tool works for admins on an OAuth session, or for an API key minted with the alerts:manage scope. It is one of the tools covered in Monitor AI agents in production.

How it works

The agent first calls describe_alert_catalog, which lists the filter fields, the metrics with the aggregations each one supports, the comparison operators and the allowed window. It then calls create_alert_rule with these main parameters:

  • name: what to call the rule, 1 to 120 characters. Required.
  • rules: the thresholds, each with a metric, an aggregation, an operator (lt, lte, gt, gte or eq) and a value. Required, with 1 to 10 entries and each metric and aggregation pair used once.
  • window_minutes: the rolling window every threshold is measured over, from 5 to 1440. The default is 15.
  • filters: optional narrowing by field, operator and values. Filters are ANDed, and leaving them out watches the whole workspace.
  • channel_ids: where firings are delivered, taken from list_alert_channels.
  • enabled: whether detection starts at once. The default is true.
  • workspace: a workspace name or ID. It defaults to your default workspace.

The rule fires when every threshold holds at the same time, over the same window, for the traffic left after the filters. There is no OR, so for alternatives the agent creates a second rule. Pass filter values exactly as the data spells them. For example, span_kind is LLM, not llm, and a lowercased value saves a rule that never fires.

The built-in rules (Consistent Error Pattern, Swallowed Error and Tool Loop) cannot be created this way. The agent changes those with update_alert_rule.

For permissions, an OAuth session needs an admin, because the alert-management tools are admin-only. A headless agent needs an API key minted with alerts:manage. An admin mints it with the Connect an agent button on the console’s MCP page. Passing channel_ids also needs the channels:manage scope. Without the right scope the tool replies that the key isn’t allowed and changes nothing.

Set it up

  1. Connect your coding agent to the Rius MCP server. In Claude Code, run this line, then complete the browser sign-in the first time a session uses the server. If you already use the Rius plugin, it registers the server as rius, so skip this step. See MCP for Codex, Cursor and headless keys.
claude mcp add --transport http rius https://mcp.eu.console.rius-glassflow.com/mcp

For a headless agent that uses a key-based server next to the plugin, give it its own name, such as rius-key.

  1. Ask the agent to look at what you can alert on, for example “What can I alert on?”. It calls describe_alert_catalog. To see the services you can filter to, it passes field set to service.

  2. Describe the rule in plain words. For “Alert me when the checkout agent starts erroring”, the agent sends:

{ "name": "create_alert_rule", "arguments": { "name": "checkout errors", "filters": [{"field": "service", "operator": "eq", "values": ["checkout"]}], "rules": [{"metric": "errors", "aggregation": "count", "operator": "gte", "value": 5}] } }
  1. For a cost rule, ask “Tell me if p95 cost per trace goes over two dollars.” The agent widens the window:
{ "name": "create_alert_rule", "arguments": { "name": "cost spike", "window_minutes": 60, "rules": [{"metric": "cost", "aggregation": "p95", "operator": "gt", "value": 2.0}] } }
  1. To get notified, ask the agent to attach a channel. It reads the channel ids with list_alert_channels and passes them as channel_ids. If you leave channel_ids out, firings show in the console but nobody is notified.

The tool reference lists every argument.

What you get

  • A custom rule in your workspace, created from a plain-language request, that starts detecting at once unless you set enabled to false.
  • A reply in Markdown, like every Rius MCP tool, which your client renders for you.
  • A way to find the rule again. list_alert_rules returns a ref for each rule, and update_alert_rule and delete_alert_rule take it.
  • Firings that show in the console, and reach your webhook, email or Slack channel when you pass channel_ids.
  • Safe changes later. Ask the agent to set enabled to false to stop a rule and keep its firing history. delete_alert_rule is irreversible, so it takes two calls: one to preview and one with a confirmation phrase.

When something else fits

  • If you prefer to build a rule yourself, use the console’s alert pages. The MCP route suits a rule you can describe in a sentence.
  • If your key has no alerts:manage scope, or you are not an admin, ask an admin to create the rule or to mint a key with that scope.

Still stuck? Get help

Last updated on