Copy from nomotic import GovernanceRuntime
from nomotic.dimensions import ResourceLimits
from nomotic.runtime import RuntimeConfig
from nomotic.trust import TrustConfig
runtime = GovernanceRuntime(config=RuntimeConfig(
# Tighter thresholds: less ambiguity
allow_threshold=0.75,
deny_threshold=0.35,
# Trust has moderate influence
trust_influence=0.15,
# Conservative trust calibration
trust_config=TrustConfig(
success_increment=0.005, # Slower trust building
violation_decrement=0.08, # Harsher penalties (16:1 ratio)
interrupt_decrement=0.05, # Interrupts are serious
baseline_trust=0.3, # Start with less trust
min_trust=0.01, # Near-zero floor
max_trust=0.90, # Can't reach full trust
),
max_history_per_agent=5000,
))
# Scope: agents can only do what they're explicitly allowed to do
scope = runtime.registry.get("scope_compliance")
scope.configure_agent_scope("order-agent", {"read_order", "update_status", "query_inventory"})
scope.configure_agent_scope("comms-agent", {"send_email", "send_sms", "read_template"})
# Isolation: agents can only access their own resources
isolation = runtime.registry.get("isolation_integrity")
isolation.set_boundaries("order-agent", {"db_orders", "db_inventory"})
isolation.set_boundaries("comms-agent", {"db_templates", "email_service", "sms_service"})
# Resource limits
resources = runtime.registry.get("resource_boundaries")
resources._limits = ResourceLimits(
max_actions_per_minute=30,
max_concurrent_actions=5,
max_cost_per_action=50.0,
max_total_cost=5000.0,
)
# Temporal: deployments only during business hours, 30-min cooldown
temporal = runtime.registry.get("temporal_compliance")
temporal.set_time_window("deploy", start_hour=9, end_hour=17)
temporal.set_min_interval("deploy", seconds=1800)
# Human override for sensitive actions
human = runtime.registry.get("human_override")
human.require_human_for("delete_account", "refund_payment", "deploy")
# Sensitive targets
stakeholder = runtime.registry.get("stakeholder_impact")
stakeholder.mark_sensitive("payment_gateway", "user_pii", "production_db")
# Ethical rules
ethics = runtime.registry.get("ethical_alignment")
ethics.add_rule(lambda a, c: (
a.parameters.get("amount", 0) <= 10000,
"Transactions over $10,000 require manual processing"
))
ethics.add_rule(lambda a, c: (
"test" not in a.target.lower() or a.action_type == "read",
"Non-read actions on test resources are blocked in production"
))