Class: Insika::Tools::A2ARemote

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/insika/tools/a2a_remote.rb

Overview

Delegates to a remote A2A agent. A NORMAL Tool Registry tool — the agent's allowlist governs who may delegate. Lazy require of the gem: it does NOT enter lib/insika.rb; it is loaded in the registration block (wiring) on the 1st instance. One instance per remote agent (its own name/description).

Instance Method Summary collapse

Constructor Details

#initialize(client:, url:, tool_name:, description:, event_stream: nil) ⇒ A2ARemote

Returns a new instance of A2ARemote.



14
15
16
17
18
19
20
21
# File 'lib/insika/tools/a2a_remote.rb', line 14

def initialize(client:, url:, tool_name:, description:, event_stream: nil)
  @client = client
  @url = url
  @tool_name = tool_name
  @description = description
  @event_stream = event_stream
  super()
end

Instance Method Details

#descriptionObject



26
# File 'lib/insika/tools/a2a_remote.rb', line 26

def description = @description

#execute(message:) ⇒ Object



28
29
30
31
32
# File 'lib/insika/tools/a2a_remote.rb', line 28

def execute(message:)
  result = @client.call(@url, message.to_s)
  emit(result)
  result[:error] ? { error: result[:error] } : result[:text]
end

#nameObject

name/description per INSTANCE (RubyLLM derives them from the class; we override — otherwise the model would see "insika--tools--a2a_remote" for every remote).



25
# File 'lib/insika/tools/a2a_remote.rb', line 25

def name = @tool_name