Class: ComposableAgents::AiAgents::Tools::AskUserTool

Inherits:
Agents::Tool
  • Object
show all
Includes:
Mixins::Logger
Defined in:
lib/composable_agents/ai_agents/tools/ask_user_tool.rb

Overview

Tool that is used to ask the user for some input

Instance Method Summary collapse

Methods included from Mixins::Logger

debug?

Constructor Details

#initialize(agent) ⇒ AskUserTool

Constructor

Parameters:

  • agent (Agent)

    The agent that is using this tool



21
22
23
24
# File 'lib/composable_agents/ai_agents/tools/ask_user_tool.rb', line 21

def initialize(agent)
  super()
  @agent = agent
end

Instance Method Details

#perform(_tool_context, question:) ⇒ String

Perform the tool's action. This is called by ai-agents when the model requires it.

Parameters:

  • _tool_context (Agents::ToolContext)

    The tool context

  • question (String)

    The question asked

Returns:

  • (String)

    The tool's response



32
33
34
# File 'lib/composable_agents/ai_agents/tools/ask_user_tool.rb', line 32

def perform(_tool_context, question:)
  @agent.ask(question)
end