🤖Agents
ZBrain's robust API simplifies agent management, enabling seamless operations for your enterprise AI solutions. With endpoints designed for tasks like retrieving, updating, deploying, and testing agents, this guide provides the essential details to streamline your workflow and maximize efficiency. Whether you're fetching templates, managing agent records, or generating reports, ZBrain's APIs ensure smooth integration and powerful capabilities.
Get Agent Templates
To retrieve a list of agent templates, send a GET request to the specified URL with optional query parameters for the category, skip, limit, sorting key, and sorting order. Ensure that the necessary headers are included as required by your service.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-templates
Request Method: GET
Query Strings (optional):
category: <<Specify the category of the templates to filter>>
skip: <<Specify how many templates to skip in the list>>
limit: <<Enter the number of templates to return>>
sortingKey: <<Key for sorting the templates, e.g., name, addedOn etc.>>
sortingOrder: <<Specify sorting order (1 or -1)>>
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request Query Parameters:
Sample Response:
Get a List of Agents
To retrieve a list of agents associated with a specific tenant, send a GET request to the specified URL with the required query parameters. You can also include optional query parameters such as order, sortKey, skip, and limit for better control over the results.
Request URL: https://app.zbrain.ai:3012/v2/api/workers
Request Method: GET
Query Parameters:
Optional Query Parameters:
order: <<Order of the results (e.g., ascending/descending)>>
sortKey: <<Key to sort the agents (e.g., name, date)>>
skip: <<Number of agents to skip for pagination>>
limit: <<Number of agents to retrieve per request>>
Sample Request Query Parameters:
Sample Response:
Update an Agent
To update an agent, send a PUT request to the specified endpoint with the required agent ID in the URL and the body containing the fields you want to update (e.g., description, name, etc.).
Request URL: https://app.zbrain.ai:3012/v2/api/workers/:id
Request Method: PUT
Request Payload:
Replace :id
in the URL with the specific agent _id
you wish to update.
Optional Body Parameters (can update multiple fields):
description: <<Description of the agent>>
name: <<Name of the agent>>
categories: <<Categories for the agent>>
sourceType: <<Source type (e.g., FILE)>>
Sample Request Body Payload:
Sample Response:
Delete an Agent
To delete an agent, send a DELETE request to the specified endpoint with the required query parameter and the agent's _id in the URL path.
Request URL: https://app.zbrain.ai:3012/api/workers/:id
Request Method: DELETE
Query Parameters:
In Params:
Replace :id with the worker’s _id to specify which agent to delete.
Sample Request:
Request URL: https://app.zbrain.ai:3012/api/workers/66da9e9e085b54c7268c48e0
Sample Response:
Test an Agent
To test an agent by uploading a file or content, send a POST request to the specified endpoint with the necessary parameters.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-trigger
Request Method: POST
Request Payload:
Required Body Parameters:
workerId: <<ID of the worker to be tested>>
file: <<The file or content to be uploaded for testing the agent>>
Sample Request Body Payload:
Sample Response:
Get Agent Record
To retrieve the agent records using a worker's record ID, send a GET request to the specified endpoint, including the required parameters.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-records/:id
Request Method: GET
Required Parameters
Replace :id in the URL with the specific agent record _id.
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request:
Sample Response:
Get Agent Details with its Records
To retrieve the agent details and its associated records using the agent ID, send a GET request to the specified URL with the required parameters.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-records/:id
Request Method: GET
Required Parameters
Replace :id in the URL with the specific agent's _id.
Optional Parameters
skip: (Number) Skip number of records
limit: (Number) Limit number of records
sortKey: (String) Sort the results by a specific key
order: (String) Ascending/Descending order
searchQuery: (String) Query to search records by name or description
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request Query Parameters:
Sample Response:
Get Report of an Agent
To retrieve the report of an agent by using its ID, send a GET request with the necessary query parameters.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-reports/:id
Request Method: GET
Required Parameters
Replace :id in the URL with the specific agent's _id.
Optional Parameters
skip: (Number) Number of records to skip
limit: (Number) Number of records to limit
sortingKey: (String) Key to sort the results by
sortingOrder: (String) Sort order (1 or -1)
searchQuery: (String) Search filter for records by name or description
startDate: (String) Start date for the report filter (format: YYYY-MM-DD)
endDate: (String) End date for the report filter (format: YYYY-MM-DD)
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request Query Parameters:
Sample Response:
Get All Categories of Agent Template
To retrieve the list of all categories for agent templates, send a GET request with the necessary query parameters.
Request URL: https://app.zbrain.ai:3012/v2/api/worker-template-categories
Request Method: GET
Query Parameters:
Optional:
skip: (Number) Number of records to skip
limit: (Number) Number of records to limit
sortingKey: (String) Key to sort the results by
sortingOrder: (String) Sort order (1 or -1)
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request Query Parameters:
Sample Response:
Get Agent Template Details
To retrieve the details of an agent template, send a GET request with the required query parameters.
Request: https://app.zbrain.ai:3012/v2/api/worker-template
Request Method: GET
Query Parameters:
Required (at least one of the following):
id: (String) The ID of the agent template.
route: (String) The route of the agent template.
Request Headers:
"Authorization": "Bearer <your_access_token>"
"Content-Type": "application/json"
Sample Request Query Parameters:
or
Sample Response:
Last updated