Agents
The Agents API enables interaction with custom AI agents in Egnyte. These agents can be configured with instructions, workflows, and domain-specific knowledge.
This API follows an asynchronous execution model:
- Submit a question
- Receive a
requestId - Poll for the final response
When to Use
Use the Agents API when:
- You need multi-step reasoning or workflows
- You want agent-level customization (instructions, behavior)
- You require conversation continuity across queries
Note: File paths in API parameters must be URL-encoded segment by segment. Do not encode forward slashes (/). For example, Shared/example?path/$file.txt should be encoded as Shared/example%3Fpath/%24file.txt.
Base URL
https://{domain}.egnyte.com/pubapi/v1/ai/agents
Authentication
All requests require an OAuth 2.0 Bearer token in the Authorization header:
Authorization: Bearer {access_token}
See Authentication for details on obtaining a token.
Rate Limits
The Agents API enforces stricter rate limits than standard Egnyte APIs. These limits apply per access token:
| Limit Type | Default |
|---|---|
| Per day | 100 calls |
| Per minute | 10 calls |
| Per second | 2 calls |
If your production application will exceed these limits, contact Egnyte to discuss custom arrangements.
Note: These limits are in addition to the general rate limits described in Best Practices.
Execution Flow (Important)
-
List agents
-
Ask question → get requestId
-
Poll status API
-
Retrieve final response
List Agents
Returns all available agents.
Request
GET /pubapi/v1/ai/agents/list
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sortBy | string | No | name | Field to sort results by. Valid values: name, createdOn |
sortOrder | string | No | asc | Sort order. Valid values: asc, desc |
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/ai/agents/list?sortBy=name&sortOrder=asc" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
Returns an array of agent objects.
| Field | Type | Description |
|---|---|---|
agentId | string | Unique identifier for the agent |
name | string | Agent name |
description | string | Description of the agent's functionality |
status | string | Current status. Values: DRAFT, ACTIVE |
subType | string | Agent sub-type (e.g., TRANSLATION_AGENT, USER_DEFINED) |
category | string | Agent category. Values: TASK, QUESTION, GENERIC |
instruction | string | Core instructions provided to the agent |
createdBy | string | Name of the user who created the agent |
Example Response
[
{
"agentId": "f52a1253-0b4c-4b1f-a1a6-9dafdd3f3097",
"name": "llm agent",
"description": "llm details",
"status": "ACTIVE",
"subType": "USER_DEFINED",
"category": "GENERIC",
"instruction": "llm details",
"createdBy": "John Millar"
},
{
"agentId": "bc8223c3-a58d-4fd6-8fc2-072dbc074dc9",
"name": "test agent 1",
"description": "sonar issues",
"status": "ACTIVE",
"subType": "USER_DEFINED",
"category": "GENERIC",
"instruction": "sonar issues only",
"createdBy": "John Millar"
}
]
Ask a Question to an Agent
Submits a question to a specific agent and returns a request ID for polling the response. You can optionally provide file context, conversation history, and custom instructions.
Request
POST /pubapi/v1/ai/agents/{agentId}/ask
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Unique identifier of the agent |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The question to ask the agent. Maximum 35,000 characters |
instructions | string | No | Optional system prompt to guide the agent's response |
conversationId | string | No | Conversation identifier for multi-turn context. Omit for the first question |
chatHistory | object | No | Previous conversation messages. Contains a messages array with role and content fields |
entryIds | array | No | Array of file entry IDs to provide as context |
selectedItems | object | No | Pre-selected files and folders. Contains files and folders arrays |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/agents/{agentId}/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "Perform the data analysis and prepare a report" }'
Example Request with Context
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/agents/{agentId}/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "What are the key findings?", "conversationId": "b5ec8d41-fc7e-4b20-b913-c84614db6a28", "chatHistory": { "messages": [ { "role": "user", "content": "Hello tell me about llm" }, { "role": "assistant", "content": "LLMs are..." } ] }, "entryIds": [ "{entryId}" ], "selectedItems": { "folders": [], "files": [ { "entryId": "{entryId}", "filePath": "/Private/asinghi/The Lucy - Transaction Summary (1).docx" } ] } }'
Response
200 OK
Returns identifiers for polling the agent's response.
| Field | Type | Description |
|---|---|---|
requestId | string | Unique identifier for this execution request |
conversationId | string | Unique identifier for the conversation thread |
Example Response
{
"requestId": "12c02713-7e79-4a9a-8802-908d93feaa9d",
"conversationId": "b5ec8d41-fc7e-4b20-b913-c84614db6a28"
}
400 Bad Request
{
"errorMessage": "Question is mandatory",
"errorCode": "QUESTION_MANDATORY"
}
500 Internal Server Error
{
"errorMessage": "An unexpected error occurred. Please try again later.",
"errorCode": "INTERNAL_SERVER_ERROR"
}
Get Agent Execution Status
Retrieves the status and response of a previously submitted agent question.
Request
GET /pubapi/v1/ai/agents/{agentId}/ask/{requestId}/status
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Unique identifier of the agent |
requestId | string | Yes | Unique identifier of the execution request |
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/ai/agents/{agentId}/ask/{requestId}/status" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
| Field | Type | Description |
|---|---|---|
status | string | Execution status. Values: PENDING, RUNNING, COMPLETED, FAILED |
responseText | string | The agent's answer. Present only when status is COMPLETED |
citations | array | Optional references used to generate the answer. Each object contains previewUrl and type fields. Present only when status is COMPLETED |
lastUpdated | string | ISO 8601 timestamp of the last status update |
Example Response
{
"status": "COMPLETED",
"responseText": "Large Language Models (LLMs) are a type of artificial intelligence program that can recognize and generate text, among other tasks. They are deep learning models trained on immense amounts of data, enabling them to understand and generate natural language and other types of content to perform a wide range of tasks.",
"citations": [
{
"previewUrl": "https://www.cloudflare.com/learning/ai/what-is-large-language-model/",
"type": "WEB_SEARCH"
},
{
"previewUrl": "https://en.wikipedia.org/wiki/Large_language_model",
"type": "WEB_SEARCH"
}
],
"lastUpdated": "2025-09-18T10:24:59Z"
}
Error Codes
| Status | Error Code | Description | Resolution |
|---|---|---|---|
| 400 | QUESTION_MANDATORY | The question field is missing from the request body | Include a question field in your request |
| 400 | QUESTION_TOO_LONG | The question exceeds 35,000 characters | Shorten your question to 35,000 characters or fewer |
| 403 | AGENTS_FEATURE_NOT_ENABLED | The Agents feature is not enabled for this domain | Contact your Egnyte administrator to enable the Agents feature |
| 404 | NOT_FOUND | The specified agent ID does not exist | Verify the agentId using the List Agents endpoint |
| 429 | Rate Limited | Too many requests within the allowed time window | Implement exponential backoff and check the Retry-After header |
| 500 | INTERNAL_SERVER_ERROR | An unexpected server error occurred | Retry the request. If the issue persists, contact Egnyte support |
Code Examples
POST /pubapi/v1/ai/agents/{agentId}/ask
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/agents/{agentId}/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "Perform the data analysis and prepare a report" }'
GET /pubapi/v1/ai/agents/{agentId}/ask/{requestId}/status
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/ai/agents/{agentId}/ask/{requestId}/status" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
GET /pubapi/v1/ai/agents/list?sortBy=createdOn&sortOrder=desc
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/ai/agents/list?sortBy=createdOn&sortOrder=desc" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Related Resources
- AI API — General AI capabilities for content analysis and generation
- Authentication — How to obtain and refresh OAuth tokens
- Best Practices — Rate limiting, error handling, and optimization strategies
- File System API — Access files and folders to use as agent context
