AIEmployeeRelayRpc
This RPC class relays AI employee requests to a remote workforce service through ServiceMeshService, and it also exposes an internal callback that lets remote agents publish responses back into the local event system. Public methods primarily forward agent interaction, configuration, history, and attachment-related requests to a configured target service.
Endpoints
POST /api/rpc (Method: AIEmployeeRelayRpc.sendMessage)
Description: Relays a message to a remote AI Employee.
Request Body:
{ "method": "AIEmployeeRelayRpc.sendMessage", "params": { "agentName": "string", "message": "string", "attachments": [], "streaming": false } }Parameters:
Name Type Required Description agentNameStringYes The target agent name to relay the message to. messageStringYes The message content to send. attachmentsArrayNo Optional attachment payloads. The schema accepts any array values. streamingBooleanNo Optional flag forwarded to the remote service. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.interactUser response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.sendMessage", "params": { "agentName": "example-agent", "message": "Hello" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.cancelProcessing)
Description: Relays a cancellation request.
Request Body:
{ "method": "AIEmployeeRelayRpc.cancelProcessing", "params": { "agentName": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name whose processing should be cancelled. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.cancelProcessing response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.cancelProcessing", "params": { "agentName": "example-agent" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.getAgentConfig)
Description: Relays a config request.
Request Body:
{ "method": "AIEmployeeRelayRpc.getAgentConfig", "params": { "agentName": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name whose configuration should be retrieved. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.getAgentConfig response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.getAgentConfig", "params": { "agentName": "example-agent" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.getChatHistory)
Description: Relays a history request.
Request Body:
{ "method": "AIEmployeeRelayRpc.getChatHistory", "params": { "agentName": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name whose chat history should be retrieved. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.getChatHistory response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.getChatHistory", "params": { "agentName": "example-agent" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.clearChatHistory)
Description: Relays a clear history request.
Request Body:
{ "method": "AIEmployeeRelayRpc.clearChatHistory", "params": { "agentName": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name whose chat history should be cleared. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.clearChatHistory response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.clearChatHistory", "params": { "agentName": "example-agent" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.getAttachmentUploadKey)
Description: Relays an upload key request.
Request Body:
{ "method": "AIEmployeeRelayRpc.getAttachmentUploadKey", "params": { "agentName": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name for which an upload key is requested. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.getAttachmentUploadKey response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.getAttachmentUploadKey", "params": { "agentName": "example-agent" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.finalizeAttachments)
Description: Relays a finalize attachment request.
Request Body:
{ "method": "AIEmployeeRelayRpc.finalizeAttachments", "params": { "agentName": "string", "uploadKey": "string" } }Parameters:
Name Type Required Description agentNameStringYes The target agent name whose attachments should be finalized. uploadKeyStringYes The upload key associated with the attachment upload. Response:
{ "success": true, "data": { "/* remote WorkforceRpc.finalizeAttachments response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.finalizeAttachments", "params": { "agentName": "example-agent", "uploadKey": "upload-key-value" } }'
POST /api/rpc (Method: AIEmployeeRelayRpc.getAttachmentDownloadKey)
Description: Relays a download key request.
Request Body:
{ "method": "AIEmployeeRelayRpc.getAttachmentDownloadKey", "params": {} }Parameters:
This method does not declare any parameters.
Response:
{ "success": true, "data": { "/* remote WorkforceRpc.getAttachmentDownloadKey response */": true } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "AIEmployeeRelayRpc.getAttachmentDownloadKey", "params": {} }'
Internal Callback
The following method is marked systemOnly: true and is not part of the public API surface. It is used as a callback path for remote agents to return responses to the local application and triggers an internal event named aiEmployeeResponse:<conversationId>.
handleAgentResponse
This internal callback receives a conversation response from a remote agent and forwards it into the local event system. It is excluded from public API documentation because the RPC metadata marks it as system-only.
Request Body:
{ "method": "AIEmployeeRelayRpc.handleAgentResponse", "params": { "conversationId": "string", "messageContent": null, "action": null } }Parameters:
Name Type Required Description conversationIdStringYes The conversation identifier used to build the local event name. messageContentStringNo Optional message content from the remote agent. The schema allows null.actionStringNo Optional action label from the remote agent. The schema allows null.Response:
{ "success": true, "data": { "success": true } }
Notes
This RPC requires ServiceMeshService to be enabled at runtime. If that service is disabled or unavailable, the relay methods throw an error stating that relaying to the AI Employee