Define and manage rules to control agent behaviors and interactions in OVADARE.
from ovadare.policies.policy_manager import Policy, PolicyManager # Define a policy read_policy = Policy( name="ReadOnlyPolicy", rules={ "access_level": "read", "resource_restriction": ["confidential_files"] } ) # Initialize the Policy Manager policy_manager = PolicyManager() # Add the policy policy_manager.add_policy(read_policy) print(f"Policy added: {read_policy.name}")
from ovadare.policies.policy_manager import PolicyManager # Simulate an action action = { "agent_id": "agent_X", "action": "edit_document", "resource": "confidential_files" } # Evaluate the action evaluation_result = policy_manager.evaluate_policies(action) if not evaluation_result.is_compliant: print(f"Conflict detected: {evaluation_result.message}")
from ovadare.policies.policy_manager import Policy # Define a custom policy interaction_policy = Policy( name="InteractionPolicy", rules={ "allowed_agents": ["agent_A", "agent_B"], "interaction_limit": 5 } ) policy_manager.add_policy(interaction_policy)
# Retrieve active policies active_policies = policy_manager.get_all_policies() print("Active policies:", [policy.name for policy in active_policies])