Class: A2A::Server::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_a2a/server/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_card:, executor:, storage: Storage::Memory.new, push_sender: nil, push_config_store: nil, host: "localhost", port: 9292) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/simple_a2a/server/base.rb', line 8

def initialize(
  agent_card:,
  executor:,
  storage:           Storage::Memory.new,
  push_sender:       nil,
  push_config_store: nil,
  host:              "localhost",
  port:              9292
)
  @agent_card        = agent_card
  @executor          = executor
  @storage           = storage
  @push_sender       = push_sender
  @push_config_store = push_config_store
  @host              = host
  @port              = port
end

Instance Attribute Details

#agent_cardObject (readonly)

Returns the value of attribute agent_card.



6
7
8
# File 'lib/simple_a2a/server/base.rb', line 6

def agent_card
  @agent_card
end

#executorObject (readonly)

Returns the value of attribute executor.



6
7
8
# File 'lib/simple_a2a/server/base.rb', line 6

def executor
  @executor
end

#push_senderObject (readonly)

Returns the value of attribute push_sender.



6
7
8
# File 'lib/simple_a2a/server/base.rb', line 6

def push_sender
  @push_sender
end

#storageObject (readonly)

Returns the value of attribute storage.



6
7
8
# File 'lib/simple_a2a/server/base.rb', line 6

def storage
  @storage
end

Instance Method Details

#rack_appObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/simple_a2a/server/base.rb', line 26

def rack_app
  klass = Class.new(App)
  klass.configure(
    agent_card:         @agent_card,
    storage:            @storage,
    executor:           @executor,
    broadcast_registry: BroadcastRegistry.new,
    push_sender:        @push_sender,
    push_config_store:  @push_config_store
  )
  klass.freeze.app
end

#runObject



39
40
41
42
# File 'lib/simple_a2a/server/base.rb', line 39

def run
  app = rack_app
  FalconRunner.new(app, host: @host, port: @port).run
end