Python SDK — Policies
Policy CRUD and evaluation in Python.
python
policy = client.policies.create(
name="Block Export",
severity="high",
enabled=True,
rules=[{
"if": {"field": "action", "operator": "equals", "value": "export"},
"then": {"action": "block", "message": "Blocked."},
}],
)
policies = client.policies.list(status="active")
client.policies.enable(policy_id)
client.policies.disable(policy_id) # sync only
result = client.policies.evaluate(
input={"action": "export", "agent": "data-agent"},
)The async client does not include enable/disable methods. Use client.policy as an alias for client.policies on the sync client.