Agent Documents

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


GET/v1/agent-documents

List all Agent Documents

This endpoint allows you to retrieve a list of all documents which are connected to an Agent.

MyAgentDocuments.swift

do {
  let myAgentDocuments = try await superagent.listAgentDocuments()
  print("document: \(myAgentDocuments)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

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

Response

[
  {
    "id": "clhjk4hab00016iewrghkbs28",
    "agent": {},
    "agentId": "clhnyae1t00016i2ixo0027c2",
    "document": {},
    "documentId": "clhnyae1t00016i2ixo0027c5"
  }
]

GET/v1/agent-documents/{agentDocumentId}

Get Agent Document

This endpoint allows you to retrieve a specific agent documents

Require attributes

  • Name
    agentDocumentId
    Type
    String
    Description

    The id of an AgentDocument

MyAgentDocument.swift

do {
  let myAgentDocument = try await superagent.getAgentDocument(agentDocumentId: "1hj2g13kh1g23")
  print("document: \(myAgentDocument)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

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

Response

{
  "id": "clhjk4hab00016iewrghkbs28",
  "agent": {},
  "agentId": "clhnyae1t00016i2ixo0027c2",
  "document": {},
  "documentId": "clhnyae1t00016i2ixo0027c5"
}

POST/v1/agent-documents

Add Document to Agent

This endpoint allows you to add a document to an Agent

Require attributes

  • Name
    agentId
    Type
    String
    Description

    The id of an Agent

  • Name
    documentId
    Type
    documentId
    Description

    The id of a Document

MyAgentDocuments.swift

do {
  let myAgentDocument = try await superagent.addDocumentToAgent(documentId: "documentId", agentId: "agentId")
  print("document: \(myAgentDocument)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}

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

Response

{
  "id": "clhjk4hab00016iewrghkbs28",
  "agent": {},
  "agentId": "clhnyae1t00016i2ixo0027c2",
  "document": {},
  "documentId": "clhnyae1t00016i2ixo0027c5"
}

DEL/v1/agent-documents{agentDocumentId}

Delete document

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

Require attributes

  • Name
    agentDocumentId
    Type
    string
    Description

    The id of an Agent Document.

MyAgentDocuments.swift

do {
  let response = try await superagent.deleteAgentDocument(agentDocumentId: "mydocumentId")
  print("document: \(response)")
  } catch {
    print("Error when creating agent: \(error)")
    throw error
}