Working with triggered alerts¶
In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class.
Searching open alerts¶
Select OPEN to include alerts that have been acknowledged but are still open because their recovery condition has not been met.
from dataikuapi import AgentFilter
result = client.search_triggered_alerts(
agent_filter=AgentFilter().with_platform_ids("production"),
states=["OPEN"],
severities=["CRITICAL"],
limit=100,
)
for alert in result.alerts:
print(alert.id, alert.get_details())
print("More alerts matched:", result.has_more)
When states is omitted or empty, the search returns only active, unacknowledged alerts. To retrieve both open and closed alerts, use states=["OPEN", "CLOSED"]. as_objects=False returns dictionaries instead of handles.
The search returns at most 100 alerts by default. You can increase this limit to 1000. If has_more is true, use more specific agent, opening-time, severity, or configuration filters. The result does not provide a way to request the next page.
Inspecting evidence and history¶
alert = client.get_triggered_alert("alert-id")
details = alert.get_details()
print(details["loc"])
print(details.get("openingEvidence"))
history = alert.get_history(limit=100)
for entry in history.entries:
print(entry)
print("Older events omitted:", history.has_more)
loc identifies the agent and the alert configuration origin and subject. Opening evidence captures the evaluated metric window or agent review result. AI-generated alerts do not have opening evidence.
The current observedStatus can be HEALTHY, WARNING, CRITICAL, or UNKNOWN. unknownReason explains unavailable observations. The alert’s severity keeps the severity of its last threshold violation, even after the observed status returns to normal.
Acknowledging and closing an alert¶
details = alert.acknowledge()
Acknowledging an already acknowledged alert returns the existing acknowledgement. Depending on its policy, an alert may stay open until recovery.
details = alert.close()
Closing an alert manually does not change its observed status or acknowledgement. For metric and agent review alerts, the configuration must observe a healthy result before it can open another alert for the same agent. If the problem continues or data remains unavailable, no new alert opens.
Requesting evaluation¶
Queue evaluation for one agent or for editable agents matching a filter.
agent = client.get_agent("production", "support-agent")
queued = agent.evaluate_alerts()
queued = client.evaluate_alerts(
agent_filter=AgentFilter().with_platform_ids("production"),
mode="DUE",
)
print("Agents queued:", queued)
This queues asynchronous work; the integer result is a count, not an operation handle or evaluation result. The global call ignores agents the caller cannot edit.
Disabling periodic evaluation still allows manual evaluation requests. Pausing the alert evaluation executor is separate: new manual requests can be rejected before being queued, and new scheduled evaluations are skipped instead of queued. Resume the executor before retrying a rejected request. See Asynchronous operations for executor supervision.
These evaluations cannot be tracked through public platform or agent Operation handles. Instance administrators can follow them under Alerting > Activity > Operations. To investigate evaluation and notification failures, open Alerting > Activity > Logs. See Accessing logs.
DUE processes metric intervals that have not yet been evaluated, up to the configured catch-up limit. FORCE_LATEST evaluates the latest completed eligible interval again. FORCE_CATCH_UP does the same for the configured number of recent intervals.
When an evaluation is forced, affected alerts remain in history but are marked invalid. Replacement alerts have new IDs and do not keep the previous acknowledgements. Missing observations can prevent this update. Agent review alerts evaluate the latest eligible run in every mode.
Reference documentation¶
Classes¶
An Agent Management triggered alert. |
|
|
A bounded triggered-alert search result. |
|
A bounded triggered-alert history result. |
Agent filter accepted by search, metric retrieval and bulk action methods. |
Functions¶
Acknowledges the triggered alert and returns its current details. |
|
|
Manually closes this alert without changing its observed state or acknowledgement. |
|
Queues alert evaluation through the scheduler for editable agents matching a filter, whether or not periodic evaluation is enabled. |
|
Queues alert evaluation through the scheduler for this agent, whether or not periodic evaluation is enabled. |
|
Returns a handle to an agent. |
Returns the triggered alert details, including its opening evidence and actor. |
|
|
Returns the most recent triggered alert history events in chronological order. |
|
Returns a handle to an Agent Management triggered alert. |
|
Searches readable Agent Management triggered alerts matching the supplied filters. |
|
