Class: SuperAGI::Agent

Inherits:
Object
  • Object
show all
Includes:
AgentValidation
Defined in:
lib/superagi/agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Agent

Returns a new instance of Agent.



5
6
7
# File 'lib/superagi/agent.rb', line 5

def initialize(client:)
  @client = client
end

Instance Method Details

#create(parameters:) ⇒ Object



9
10
11
12
# File 'lib/superagi/agent.rb', line 9

def create(parameters:)
  parameters = valid_parameters(method: :create, parameters: parameters)
  @client.json_post(path: "/agent", parameters: parameters)
end

#pause(id:) ⇒ Object



23
24
25
# File 'lib/superagi/agent.rb', line 23

def pause(id:)
  @client.json_post(path: "/agent/#{id}/pause", parameters: {})
end

#resources(parameters:) ⇒ Object



35
36
37
38
# File 'lib/superagi/agent.rb', line 35

def resources(parameters:)
  parameters = valid_parameters(method: :resources, parameters: parameters)
  @client.json_post(path: "/agent/resources/output", parameters: parameters)
end

#resume(id:) ⇒ Object



27
28
29
# File 'lib/superagi/agent.rb', line 27

def resume(id:)
  @client.json_post(path: "/agent/#{id}/resume", parameters: {})
end

#run(id:) ⇒ Object



19
20
21
# File 'lib/superagi/agent.rb', line 19

def run(id:)
  @client.json_post(path: "/agent/#{id}/run", parameters: {})
end

#status(id:) ⇒ Object



31
32
33
# File 'lib/superagi/agent.rb', line 31

def status(id:)
  @client.json_post(path: "/agent/#{id}/run-status", parameters: {})
end

#update(id:, parameters:) ⇒ Object



14
15
16
17
# File 'lib/superagi/agent.rb', line 14

def update(id:, parameters:)
  parameters = valid_parameters(method: :update, parameters: parameters)
  @client.json_put(path: "/agent/#{id}", parameters: parameters)
end