Skip to main content

Agents

The Agents API provides endpoints for interacting with agents in the Playground. This documentation covers the available endpoints, authentication requirements, and request/response formats.

Authentication

All requests to the Agents API require authentication using the x-jeen-assistant-secret header.

x-jeen-assistant-secret: YOUR_JEEN_ASSISTANT_KEY

The secret key can be found in your environment variables as ASSISTANT_SERVICE_SECRET.

Endpoints

Get Agent Answer

This endpoint allows you to get responses from an AI agent based on conversation history and various parameters.

Endpoint: /api/v1/agent/service/agent-answer/:agentId

Method: POST

Content-Type: multipart/form-data

Request Parameters

ParameterTypeDescription
sessionIdstringUnique identifier for the conversation session
messageIndexobjectContains details about the current message including index, question, answer, and timestamp
conversationarrayArray of previous messages in the conversation
inputstringAdditional input data (optional)
tagsarrayArray of tags associated with the conversation
followUpobjectFollow-up context information
similarQuestionsListarrayList of similar questions
botFlowsobjectBot flow configuration
attachmentsobjectContains images and files data
highestGradeSourcearrayArray of highest grade sources

Simple Example

curl --location 'http://localhost:9000/api/v1/agent/service/agent-answer/aXUn5I2AgcuTS48a' \
--header 'x-jeen-assistant-secret: YOUR_JEEN_ASSISTANT_KEY' \
--form 'question="What is the biggest city in the world"'

Complete Example with All Parameters

curl --location 'http://localhost:9000/api/v1/agent/service/agent-answer/aXUn5I2AgcuTS48a' \
--header 'x-jeen-assistant-secret: YOUR_JEEN_ASSISTANT_KEY' \
--form 'sessionId="ec391920-9e14-4b3b-97bc-a8ab10fd1398"' \
--form 'messageIndex="{\"index\":1,\"question\":\"What is the biggest city in the world\",\"answer\":\"\",\"startTime\":1749130877717}"' \
--form 'conversation="[{\"id\":\"08d442e5-e89c-480d-86a3-fd4893165a1c\",\"role\":\"assistant\",\"content\":\"Hi, how can I help you today? \",\"isIgnore\":false,\"additionalLinks\":[],\"sources\":[]},{\"id\":\"ac43bba2-ecf2-409e-aefe-f71a410cca31\",\"role\":\"user\",\"content\":\"What is the biggest city in the world\",\"isIgnore\":false,\"isHaveFiles\":false,\"files\":[],\"isHaveImg\":false,\"images\":[],\"imageUrls\":[]}]"' \
--form 'input="undefined"' \
--form 'tags="[]"' \
--form 'followUp="{}"' \
--form 'similarQuestionsList="[]"' \
--form 'botFlows="{\"isRelevantAnswer\":false}"' \
--form 'attachments="{\"images\":{\"isInputImages\":false,\"content\":[]},\"files\":{\"isInputFiles\":false,\"content\":[]}}"' \
--form 'highestGradeSource="[]"'

Error Handling

The API uses standard HTTP status codes for error responses:

  • 401: Unauthorized (invalid or missing secret key)
  • 400: Bad Request (invalid parameters)
  • 500: Internal Server Error

Security Considerations

  • Always keep your JEEN_ASSITANT_KEY secure and never expose it in client-side code
  • Use HTTPS in production environments
  • Validate all input parameters before sending to the API