Class: SwarmSDK::Tools::Base

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/swarm_sdk/tools/base.rb

Overview

Base class for all SwarmSDK tools

Provides:

  • Declarative removability control
  • Common tool functionality
  • Standard initialization patterns

Removability

Tools can be marked as non-removable to ensure they're always available:

class Think < Base
removable false
end

Non-removable tools are included even when skills specify a limited toolset.

Examples:

Removable tool (default)

class Read < Base
  # removable true  # Default, can omit
end

Non-removable tool

class Think < Base
  removable false  # Always available
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.removable(value) ⇒ void

This method returns an undefined value.

Mark tool as removable or non-removable

Examples:

Make tool always available

removable false

Parameters:

  • value (Boolean)

    Whether tool can be removed



50
51
52
# File 'lib/swarm_sdk/tools/base.rb', line 50

def removable(value)
  @removable = value
end

.removable?Boolean

Whether this tool can be deactivated by LoadSkill

Non-removable tools are ALWAYS active regardless of skill toolset. Use for essential tools that agents should never lose.

Returns:

  • (Boolean)

    True if removable (default: true)



39
40
41
# File 'lib/swarm_sdk/tools/base.rb', line 39

def removable?
  @removable.nil? ? true : @removable
end

Instance Method Details

#removable?Boolean

Instance method for checking removability

Returns:

  • (Boolean)


58
59
60
# File 'lib/swarm_sdk/tools/base.rb', line 58

def removable?
  self.class.removable?
end