Skip to content

chimera.security

chimera.security classifies tool-call risk and decides whether to ask the user before executing.

For the tutorial, see Add Security Policies.

from chimera.security import (
SecurityRisk,
RiskClassifier,
SecurityAnalyzer,
LLMSecurityAnalyzer,
RuleBasedSecurityAnalyzer,
CompositeSecurityAnalyzer,
ConfirmationPolicy,
NeverConfirm,
AlwaysConfirm,
ConfirmAboveThreshold,
)
SecurityRiskValueMeaning
UNKNOWN0Could not classify. Treated as HIGH for safety.
LOW1Read-only, harmless.
MEDIUM2Writes, installs, network to known endpoints.
HIGH3Destructive ops (rm -rf, DROP TABLE, force push), credential access.
ClassModuleSpeed
RuleBasedSecurityAnalyzerchimera.security.analyzerFast, free; pattern matches against known-dangerous strings.
LLMSecurityAnalyzerchimera.security.analyzerSmarter; sends the call to a Provider for classification.
CompositeSecurityAnalyzerchimera.security.analyzerRuns the rule-based check first; falls through to the LLM only when uncertain.

Every analyzer implements analyze(tool_call) -> SecurityRisk.

ClassModuleBehaviour
NeverConfirm()chimera.security.policyNever ask, regardless of risk.
AlwaysConfirm()chimera.security.policyAlways ask.
ConfirmAboveThreshold(SecurityRisk.MEDIUM, confirm_unknown=True)chimera.security.policyAsk for risks at or above the threshold; UNKNOWN triggers confirmation by default.