Class: MandateClaw::DSL::AgentBounds

Inherits:
Object
  • Object
show all
Defined in:
lib/mandate_claw/dsl/agent_bounds.rb

Overview

Defines the capability envelope for an autonomous agent party. The agent is constrained to only the actions listed under may and is explicitly barred from those under must_not.

agent_bounds :ai_agent do
  may       :issue_invoice, :send_reminder
  must_not  :modify_amount, :waive_penalty
  must_log_to :contract_registry
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(party) ⇒ AgentBounds

Returns a new instance of AgentBounds.



18
19
20
21
22
23
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 18

def initialize(party)
  @party             = party
  @permitted_actions = []
  @prohibited_actions = []
  @log_targets       = []
end

Instance Attribute Details

#log_targetsObject (readonly)

Returns the value of attribute log_targets.



16
17
18
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 16

def log_targets
  @log_targets
end

#partyObject (readonly)

Returns the value of attribute party.



16
17
18
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 16

def party
  @party
end

#permitted_actionsObject (readonly)

Returns the value of attribute permitted_actions.



16
17
18
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 16

def permitted_actions
  @permitted_actions
end

#prohibited_actionsObject (readonly)

Returns the value of attribute prohibited_actions.



16
17
18
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 16

def prohibited_actions
  @prohibited_actions
end

Instance Method Details

#may(*actions) ⇒ Object



25
26
27
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 25

def may(*actions)
  @permitted_actions.concat(actions.flatten)
end

#must_log_to(*targets) ⇒ Object



33
34
35
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 33

def must_log_to(*targets)
  @log_targets.concat(targets.flatten)
end

#must_not(*actions) ⇒ Object



29
30
31
# File 'lib/mandate_claw/dsl/agent_bounds.rb', line 29

def must_not(*actions)
  @prohibited_actions.concat(actions.flatten)
end