Agent Tools

This guide will get you all set up and ready to use Superagent Agent Tools.


GET/v1/agent-tools

List all Agent Tools

This endpoint allows you to retrieve a list of all your agent tools

MyAgentTools.swift

do {
  let myAgentTools = try await superagent.listAgentTools()
  print("tool: \(myAgentTools)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

You can access the response key value pairs by requesting a specific key. For example myAgentTools["user"] for the tool Id

Response

[
  {
    "user": {},
    "agent": {},
    "agentId": "",
    "tool": {},
    "toolId": ""
  }
]

GET/v1/agent-tools/{agentToolId}

Get Agent Tool

This endpoint allows you to retrieve a specific agent tools

Require attributes

  • Name
    agentToolId
    Type
    String
    Description

    The id of an AgentTool

MyAgentTool.swift

do {
  let myAgentTool = try await superagent.getAgentTools(agentToolId: "1hj2g13kh1g23")
  print("tool: \(myAgentTool)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

You can access the response key value pairs by requesting a specific key. For example myAgentTool["id"] for the tool Id

Response

{
"id": "clhjk4hab00016iewrghkbs28",
"agent": {},
"agentId": "clhnyae1t00016i2ixo0027c2",
"tool": {},
"toolId": "clhnyae1t00016i2ixo0027c5"
}

POST/v1/agent-tools

Add Tool to Agent

This endpoint allows you to add a tool to an Agent

Require attributes

  • Name
    agentId
    Type
    String
    Description

    The id of an Agent

  • Name
    toolId
    Type
    String
    Description

    The id of a Tool

MyAgentTools.swift

do {
  let myAgentTool = try await superagent.addToolToAgent(agentId: "agentId", toolId: "toolId")
  print("tool: \(myAgentTool)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

You can access the response key value pairs by requesting a specific key. For example myAgentTool["user"] for the tool Id

Response

{
  "user": {},
  "agent": {},
  "agentId": "",
  "tool": {},
  "toolId": ""
}

DEL/v1/tools{toolId}

Delete tool

This endpoint allows you to delete a Tool from an Agent. The delet function returns a simple true or false boolean value that represents the success.

Require attributes

  • Name
    agentToolId
    Type
    string
    Description

    The id of an Agent Tool.

MyAgentTools.swift

do {
  let response = try await superagent.deleteAgentTool(agentToolId: "mytoolId")
  print("tool: \(response)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}