Class: Kreator::Tools::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/kreator/tools/agent.rb

Constant Summary collapse

DEFAULT_MAX_OUTPUT_BYTES =
20_000
DEFAULT_WAIT_TIMEOUT =
1

Instance Method Summary collapse

Instance Method Details

#call(args:, context:, signal:) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/kreator/tools/agent.rb', line 49

def call(args:, context:, signal:)
  context.ensure_not_cancelled!(signal)

  case args.fetch("action")
  when "start"
    start_agent(args, context, signal)
  when "capture"
    capture_agent(args, signal)
  when "wait"
    wait_for_agent(args, signal)
  when "stop"
    stop_agent(args, context, signal)
  when "list"
    list_agents(args, signal)
  end
end

#descriptionObject



21
22
23
# File 'lib/kreator/tools/agent.rb', line 21

def description
  "Start, inspect, wait for, or stop a headless Kreator child agent in a detached tmux session."
end

#nameObject



17
18
19
# File 'lib/kreator/tools/agent.rb', line 17

def name
  "agent"
end

#schemaObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/kreator/tools/agent.rb', line 25

def schema
  {
    "type" => "object",
    "additionalProperties" => false,
    "required" => ["action"],
    "properties" => {
      "action" => { "type" => "string", "enum" => %w[start capture wait stop list] },
      "prompt" => { "type" => "string", "minLength" => 1 },
      "id" => { "type" => "string", "minLength" => 1 },
      "name" => { "type" => "string", "minLength" => 1 },
      "provider" => { "type" => "string", "minLength" => 1 },
      "model" => { "type" => "string", "minLength" => 1 },
      "tools" => {
        "type" => "array",
        "items" => { "type" => "string", "minLength" => 1 }
      },
      "no_tools" => { "type" => "boolean" },
      "session" => { "type" => "boolean" },
      "timeout_seconds" => { "type" => "integer", "minimum" => 1 },
      "max_output_bytes" => { "type" => "integer", "minimum" => 1 }
    }
  }
end