Class: ElevenlabsClient::Endpoints::AgentsPlatform::Tools

Inherits:
Object
  • Object
show all
Defined in:
lib/elevenlabs_client/endpoints/agents_platform/tools.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Tools

Returns a new instance of Tools.



7
8
9
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#create(tool_config:) ⇒ Hash

POST /v1/convai/tools Add a new tool to the available tools in the workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/create

Parameters:

  • tool_config (Hash)

    Configuration for the tool

Options Hash (tool_config:):

  • :name (String)

    Required name of the tool

  • :description (String)

    Required description of the tool

  • :api_schema (Hash)

    Required API schema configuration

  • :response_timeout_secs (Integer)

    Optional response timeout (default: 20)

  • :disable_interruptions (Boolean)

    Optional disable interruptions (default: false)

  • :force_pre_tool_speech (Boolean)

    Optional force pre-tool speech (default: false)

  • :assignments (Array<Hash>)

    Optional variable assignments

  • :dynamic_variables (Hash)

    Optional dynamic variables

Returns:

  • (Hash)

    Created tool with ID and configuration



46
47
48
49
50
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 46

def create(tool_config:)
  endpoint = "/v1/convai/tools"
  request_body = { tool_config: tool_config }
  @client.post(endpoint, request_body)
end

#delete(tool_id) ⇒ Hash

DELETE /v1/convai/tools/tool_id Delete tool from the workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/delete

Parameters:

  • tool_id (String)

    ID of the requested tool

Returns:

  • (Hash)

    Empty response on success



79
80
81
82
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 79

def delete(tool_id)
  endpoint = "/v1/convai/tools/#{tool_id}"
  @client.delete(endpoint)
end

#get(tool_id) ⇒ Hash

GET /v1/convai/tools/tool_id Get tool that is available in the workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/get

Parameters:

  • tool_id (String)

    ID of the requested tool

Returns:

  • (Hash)

    Tool configuration and metadata



27
28
29
30
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 27

def get(tool_id)
  endpoint = "/v1/convai/tools/#{tool_id}"
  @client.get(endpoint)
end

#get_dependent_agents(tool_id, **options) ⇒ Hash

GET /v1/convai/tools/tool_id/dependent-agents Get a list of agents depending on this tool Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/dependent-agents

Parameters:

  • tool_id (String)

    ID of the requested tool

  • options (Hash)

    Query parameters

Options Hash (**options):

  • :cursor (String)

    Used for fetching next page

  • :page_size (Integer)

    How many agents to return at maximum (1-100, default: 30)

Returns:

  • (Hash)

    List of dependent agents with pagination info



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 93

def get_dependent_agents(tool_id, **options)
  endpoint = "/v1/convai/tools/#{tool_id}/dependent-agents"
  query_params = options.compact
  
  if query_params.any?
    query_string = URI.encode_www_form(query_params)
    endpoint = "#{endpoint}?#{query_string}"
  end
  
  @client.get(endpoint)
end

#listHash

GET /v1/convai/tools Get all available tools in the workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/list

Returns:

  • (Hash)

    List of tools with their configurations and metadata



16
17
18
19
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 16

def list
  endpoint = "/v1/convai/tools"
  @client.get(endpoint)
end

#update(tool_id, tool_config:) ⇒ Hash

PATCH /v1/convai/tools/tool_id Update tool that is available in the workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/update

Parameters:

  • tool_id (String)

    ID of the requested tool

  • tool_config (Hash)

    Updated configuration for the tool

Options Hash (tool_config:):

  • :name (String)

    Optional updated name of the tool

  • :description (String)

    Optional updated description of the tool

  • :api_schema (Hash)

    Optional updated API schema configuration

  • :response_timeout_secs (Integer)

    Optional response timeout

  • :disable_interruptions (Boolean)

    Optional disable interruptions

  • :force_pre_tool_speech (Boolean)

    Optional force pre-tool speech

  • :assignments (Array<Hash>)

    Optional variable assignments

  • :dynamic_variables (Hash)

    Optional dynamic variables

Returns:

  • (Hash)

    Updated tool configuration and metadata



67
68
69
70
71
# File 'lib/elevenlabs_client/endpoints/agents_platform/tools.rb', line 67

def update(tool_id, tool_config:)
  endpoint = "/v1/convai/tools/#{tool_id}"
  request_body = { tool_config: tool_config }
  @client.patch(endpoint, request_body)
end