Sha256: bc71cc212a5cf80752586f4eb7b6584e4029460e5f68cdb10a57537b58fe7d28
Contents?: true
Size: 938 Bytes
Versions: 3
Compression:
Stored size: 938 Bytes
Contents
# lib/agent99/agent_discovery.rb module Agent99::AgentDiscovery # Returns the agent's capabilities (to be overridden by subclasses). # # @return [Array<String>] The agent's capabilities # def capabilities [] end ################################################ private # Discovers other agents with a specific capability. # # @param capability [String] The capability to search for # @param how_many [Integer] The number of agents to return # @param all [Boolean] Whether to return all matching agents # @return [Array<Hash>] The discovered agents # @raise [RuntimeError] If no agents are found # def discover_agent(capability:, how_many: 1, all: false) result = @registry_client.discover(capability:) if result.empty? logger.error "No agents found for capability: #{capability}" raise "No agents available" end all ? result : result.sample(how_many) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
agent99-0.0.3 | lib/agent99/agent_discovery.rb |
agent99-0.0.2 | lib/agent99/agent_discovery.rb |
agent99-0.0.1 | lib/agent99/agent_discovery.rb |