Docs
Routes
Agent.routes

Agent Routes

routes.agent_routes.create_agent()

Creates a new agent in the database along with any associated files. If files already exist, they are linked to the new agent rather than duplicated.

URL:

  • POST /agent/db/create
  • Parameters:
    • name (str) – The name of the new agent.
    • files (list of FileStorage) – A list of files to be uploaded.
    • description (str) – A description of the agent, for management purposes.
    • instructions (str) – Instructions defining the agent’s behavior and presentation.
    • model (str) – The OpenAI model to use for the agent.
  • Returns: The created agent object along with a status message or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Agent created successfully.
  • 400 Bad Request: Invalid request payload or an error occurred.

Notes

  • Assistant session must be established before calling this method.
  • upload_files and upload_agent_metadata methods are used to handle file and metadata uploading.

routes.agent_routes.delete_agent_route()

Deletes a specified agent from the database based on the agent’s ID.

URL:

  • POST /agent/db/delete
  • Parameters: agent_id (str) – The ID of the agent to be deleted.
  • Returns: A message indicating the deletion status and details of the deleted agent or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Agent deleted successfully.
  • 400 Bad Request: Invalid request payload or an error occurred.

Notes

  • Calls delete_agent method to remove the agent from the database.

routes.agent_routes.get_all_agents()

Retrieves all agents from the database. Requires an established assistant session.

URL:

  • GET /agent/db/get_all
  • Returns: A list of retrieved agents or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: All agents retrieved successfully.
  • 400 Bad Request: An error occurred.
  • 401 Unauthorized: No assistant session was established.

Notes

  • Calls retrieve_all_agents to fetch all agents from the database.

routes.agent_routes.update_agent_route()

Updates an existing agent in the database, including uploading new files without duplicating existing ones.

URL:

  • POST /agent/db/update
  • Parameters:
    • agent_id (str) – The ID of the agent to be updated.
    • name (str) – The new name of the agent.
    • description (str) – The new description of the agent.
    • instructions (str) – The new instructions for the agent.
    • model (str) – The new OpenAI model to use for the agent.
    • files (list of FileStorage) – New files to be uploaded.
    • file_ids (list of str) – Updated list of file IDs associated with the agent.
  • Returns: A message indicating the update status of the agent along with updated agent details or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Agent updated successfully.
  • 400 Bad Request: Invalid request payload or an error occurred.
  • 401 Unauthorized: No assistant session was established.

Notes

  • Calls update_agent to update agent details and upload_files for new file uploads.