This guide documents the API standards required for custom agents to integrate with the DuploCloud Service Desk. By following these standards, your Agent can leverage Service Desk features like terminal command execution, browser interactions, and file operations.
Agent API Requirements
All custom Agents must expose a chat endpoint:
POST /api/sendMessage
This endpoint handles message exchanges between your Agent and Service Desk, supporting contextual information and specialized response types.
Request Format
Request from ServiceDesk to Agent
The Service Desk sends a flat array of messages where the last message is the current user request. All previous messages provide conversation context.
{
"messages": [
{
"role": "user" | "assistant",
"content": "Message text content",
"platform_context": {
// only for user messages
},
"data": {
// Structured data exchanges
},
"timestamp": "2025-05-20T18:00:46.123456Z"
}
// ... more messages
]
}
Field Descriptions
messages (array, required)
Flat array of all conversation messages
Last element is the current message
Follows OpenAI/Anthropic conversation format
role (string, required)
"user": Message from user to agent
"assistant": Message from agent to user
content (string, required)
Human-readable message text
Empty string for pure approval/rejection messages
platform_context (object, only for user messages)
Environment-specific configuration and credentials
Structured data for commands, URLs, and other actions
Contains cmds, executed_cmds, and url_configs arrays
timestamp (string, optional)
formatted timestamp
Response Format
Response from Agent to ServiceDesk
{
"role": "assistant",
"content": "Agent's text response to the user",
"data": {
"cmds": [],
"executed_cmds": [],
"url_configs": []
}
}
Capability-Specific Formats
Terminal Commands
Agents can provide terminal commands for user approval and execution through a human-in-the-loop workflow.
Command Proposal (Agent → User)
{
"role": "assistant",
"content": "I'll check the pod status in your namespace.",
"data": {
"cmds": [
{
"command": "kubectl get pods -n duploservices-andy",
"execute": false,
"files": [
{
"file_path": "config/app.yaml",
"file_content": "apiVersion: v1\nkind: ConfigMap..."
}
]
}
]
}
}
Command Fields
command (string, required)
The shell command to execute
execute (boolean, required)
false: Command proposed by agent, awaiting approval
true: Command approved by user
files (array, optional)
Files to create before command execution
Each file object contains:
file_path: Relative path where file should be created
file_content: Content of the file
rejection_reason (string, optional in user response)
User's reason for rejecting a command (when execute=false)
Terminal Command Workflow
1. Agent Proposes Commands
Agent suggests commands with execute: false:
{
"role": "assistant",
"content": "Let me check your pod status and recent events.",
"data": {
"cmds": [
{
"command": "kubectl get pods -n duploservices-andy",
"execute": false
},
{
"command": "kubectl get events -n duploservices-andy --sort-by=.metadata.creationTimestamp",
"execute": false
}
]
}
}
2. User Approves/Rejects Commands
When the user responds, they send back commands with updated execute status:
{
"role": "user",
"content": "", // Empty for pure approval
"data": {
"cmds": [
{
"command": "kubectl get pods -n duploservices-andy",
"execute": true // Approved
},
{
"command": "kubectl get events -n duploservices-andy --sort-by=.metadata.creationTimestamp",
"execute": false, // Rejected
"rejection_reason": "Too much output, let's focus on pods first" //Optional Field may or may not be provided by the user
}
]
}
}
3. User can send Executed Commands to the agent
In the next request, the user can also share commands and outputs executed by him on his own in a shared user terminal to the agent:
{
"role": "user",
"content": "I ran my own commands, analyze them",
"data": {
"executed_cmds": [
{
"command": "kubectl get pods -n duploservices-andy",
"output": "NAME READY STATUS RESTARTS AGE\napp-69fb74d9d4-j2l6x 1/1 Running 0 22h"
}
]
}
}
4. Agent Analyzes and Responds
The agent can share the commands it executed to the user via the executed_cmds array.
{
"content": "All pods are running successfully. The app pod has been stable for 22 hours.",
"data": {
"executed_cmds": [
{
"command": "kubectl get pods -n duploservices-andy",
"output": "NAME READY STATUS RESTARTS AGE\napp-69fb74d9d4-j2l6x 1/1 Running 0 22h"
}
],
"cmds": [
{
"command": "kubectl logs app-69fb74d9d4-j2l6x --tail=50",
"execute": false
}
]
}
}
User-Initiated Commands
Users can run their own terminal commands between agent messages. These appear in the next user message:
{
"role": "user",
"content": "I checked the logs myself and found errors",
"data": {
"executed_cmds": [
{
"command": "kubectl logs app-69fb74d9d4-j2l6x | grep ERROR",
"output": "ERROR: Database connection timeout\nERROR: Failed to fetch user data"
}
]
}
}
File Operations with Commands
For commands requiring file creation (e.g., Helm charts, configurations):