class SecurityRisk
Bases:str, Enum
Security risk levels for actions.
Based on OpenHands security risk levels but adapted for agent-sdk.
Integer values allow for easy comparison and ordering.
Properties
UNKNOWNLOWMEDIUMHIGHdescription: str Get a human-readable description of the risk level.visualize: Text Return Rich Text representation of this risk level.
Methods
get_color() -> str source Get the color for displaying this risk level in Rich text. is_riskier() -> bool source Check if this risk level is riskier than another. Risk levels follow the natural ordering: LOW is less risky than MEDIUM, which is less risky than HIGH. UNKNOWN is not comparable to any other level. To make this act like a standard well-ordered domain, we reflexively consider risk levels to be riskier than themselves. That is: for risk_level in list(SecurityRisk): assert risk_level.is_riskier(risk_level)More concretely:
assert SecurityRisk.HIGH.is_riskier(SecurityRisk.HIGH) assert SecurityRisk.MEDIUM.is_riskier(SecurityRisk.MEDIUM) assert SecurityRisk.LOW.is_riskier(SecurityRisk.LOW) This can be disabled by setting thereflexive parameter to False.
Parameters:
otherSecurityRisk – The other risk level to compare against.reflexivebool – Whether the relationship is reflexive.
-
ValueError– If either risk level is UNKNOWN.NoneNone

