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:

  1. Submit a question
  2. Receive a requestId
  3. 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 TypeDefault
Per day100 calls
Per minute10 calls
Per second2 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)

  1. List agents

  2. Ask question → get requestId

  3. Poll status API

  4. Retrieve final response


List Agents

Returns all available agents.

Request

GET /pubapi/v1/ai/agents/list

Query Parameters

ParameterTypeRequiredDefaultDescription
sortBystringNonameField to sort results by. Valid values: name, createdOn
sortOrderstringNoascSort 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.

FieldTypeDescription
agentIdstringUnique identifier for the agent
namestringAgent name
descriptionstringDescription of the agent's functionality
statusstringCurrent status. Values: DRAFT, ACTIVE
subTypestringAgent sub-type (e.g., TRANSLATION_AGENT, USER_DEFINED)
categorystringAgent category. Values: TASK, QUESTION, GENERIC
instructionstringCore instructions provided to the agent
createdBystringName 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

ParameterTypeRequiredDescription
agentIdstringYesUnique identifier of the agent

Request Body

FieldTypeRequiredDescription
questionstringYesThe question to ask the agent. Maximum 35,000 characters
instructionsstringNoOptional system prompt to guide the agent's response
conversationIdstringNoConversation identifier for multi-turn context. Omit for the first question
chatHistoryobjectNoPrevious conversation messages. Contains a messages array with role and content fields
entryIdsarrayNoArray of file entry IDs to provide as context
selectedItemsobjectNoPre-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.

FieldTypeDescription
requestIdstringUnique identifier for this execution request
conversationIdstringUnique 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

ParameterTypeRequiredDescription
agentIdstringYesUnique identifier of the agent
requestIdstringYesUnique 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

FieldTypeDescription
statusstringExecution status. Values: PENDING, RUNNING, COMPLETED, FAILED
responseTextstringThe agent's answer. Present only when status is COMPLETED
citationsarrayOptional references used to generate the answer. Each object contains previewUrl and type fields. Present only when status is COMPLETED
lastUpdatedstringISO 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

StatusError CodeDescriptionResolution
400QUESTION_MANDATORYThe question field is missing from the request bodyInclude a question field in your request
400QUESTION_TOO_LONGThe question exceeds 35,000 charactersShorten your question to 35,000 characters or fewer
403AGENTS_FEATURE_NOT_ENABLEDThe Agents feature is not enabled for this domainContact your Egnyte administrator to enable the Agents feature
404NOT_FOUNDThe specified agent ID does not existVerify the agentId using the List Agents endpoint
429Rate LimitedToo many requests within the allowed time windowImplement exponential backoff and check the Retry-After header
500INTERNAL_SERVER_ERRORAn unexpected server error occurredRetry 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"
  • 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