Class AgentRequest
java.lang.Object
com.veeva.vault.vapil.api.request.VaultRequest<AgentRequest>
com.veeva.vault.vapil.api.request.AgentRequest
The Agent API allows you to retrieve agents
- Vault API Coverage:
- https://general.veevavault.dev/ai-agents/api/
-
Field Summary
Fields inherited from class com.veeva.vault.vapil.api.request.VaultRequest
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_REFERENCE_ID, HTTP_HEADER_VAULT_CLIENT_ID, referenceId, requestClientId, vaultClient -
Method Summary
Modifier and TypeMethodDescriptioncancelAgentActionExecution(String executionId) Cancel Agent Action ExecutionExecute Agent ActionretrieveAgent(String agentName) Retrieve AgentretrieveAgentAction(String agentName, String actionName) Retrieve Agent ActionRetrieve Agent Action Execution StatusRetrieve All Agent ActionsRetrieve All AgentssetBinaryFile(String filename, byte[] binaryContent) Specify source data in an input filesetExecutionId(String executionId) Specify the execution ID of the agent action execution.setExternalId(String externalId) Specify the external ID of the agent action execution.setInputPath(String inputPath) Specify source data in an input filesetRequestString(String requestString) Specify source data in an input string, such as a JSON requestMethods inherited from class com.veeva.vault.vapil.api.request.VaultRequest
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setHeaderClientId, setHeaderReferenceId, setVaultClient
-
Method Details
-
retrieveAllAgents
Retrieve All AgentsRetrieve all of the agents in the authenticated Vault. Includes both System and custom agents.
- Returns:
- AgentBulkResponse
- Vault API Endpoint:
GET /api/{version}/services/ai/agents- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/retrieve-agents/
- Example Request:
AgentBulkResponse response = vaultClient.newRequest(AgentRequest.class) .retrieveAllAgents();- Example Response:
for (AgentBulkResponse.Agent agent : response.getAgents()) { System.out.println("-------- Agent --------"); System.out.println("Name = " + agent.getName()); System.out.println("Label = " + agent.getLabel()); System.out.println("Url = " + agent.getUrl()); }
-
retrieveAgent
Retrieve AgentRetrieve details of the specified agent, including all of the agent’s actions.
- Parameters:
agentName- The name of the agent to retrieve. For example, promomats_document_chat__v.- Returns:
- AgentResponse
- Vault API Endpoint:
GET /api/{version}/services/ai/agents/{agent_name}- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/retrieve-agent/
- Example Request:
AgentResponse response = vaultClient.newRequest(AgentRequest.class) .retrieveAgent(AGENT_NAME);- Example Response:
Agent agent = response.getAgent(); System.out.println("Name = " + agent.getName()); System.out.println("Label = " + agent.getLabel()); System.out.println("Status = " + agent.getStatus()); System.out.println("Agent Class = " + agent.getAgentClass()); for (AgentAction action : agent.getActions()) { System.out.println("Action Name = " + action.getName()); System.out.println("Action Label = " + action.getLabel()); System.out.println("Action Url = " + action.getUrl()); }
-
retrieveAllAgentActions
Retrieve All Agent ActionsRetrieves all agent actions in the currently authenticated Vault.
- Returns:
- AgentActionBulkResponse
- Vault API Endpoint:
GET /api/{version}/services/ai/agent_actions- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/retrieve-agent-actions/
- Example Request:
AgentActionBulkResponse response = vaultClient.newRequest(AgentRequest.class) .retrieveAllAgentActions();- Example Response:
for (AgentActionBulkResponse.Agent agent : response.getAgents()) { System.out.println("-------- Agent --------"); System.out.println("Agent Name = " + agent.getAgentName()); System.out.println("Agent Label = " + agent.getAgentLabel()); for (AgentActionBulkResponse.Agent.AgentAction action : agent.getActions()) { System.out.println("-------- Action --------"); System.out.println("Action Name = " + action.getName()); System.out.println("Action Label = " + action.getLabel()); } }
-
retrieveAgentAction
Retrieve Agent ActionRetrieve the details of a specific agent action.
- Parameters:
agentName- The name of the agent to retrieve. For example, promomats_document_chat__v.actionName- The name of the action to retrieve. For example, spelling_grammar__v.- Returns:
- AgentActionResponse
- Vault API Endpoint:
GET /api/{version}/services/ai/agent_action/{agent_name}/{action_name}- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/retrieve-agent-action/
- Example Request:
AgentActionResponse response = vaultClient.newRequest(AgentRequest.class) .retrieveAgentAction("quick_check__v", "spelling_grammar__v");- Example Response:
AgentAction action = response.getAgentAction(); System.out.println("Name = " + action.getName()); System.out.println("Label = " + action.getLabel()); System.out.println("Active = " + action.getActive()); System.out.println("Source = " + action.getSource()); System.out.println("Description = " + action.getDescription()); System.out.println("Support Chat = " + action.getSupportChat()); System.out.println("Tool Evaluation = " + action.getToolEvaluation());
-
executeAgentAction
Execute Agent ActionExecute the specified agent action. The authenticated user must have permission to execute the action.
- Returns:
- AgentActionExecutionResponse
- Vault API Endpoint:
POST /api/{version}/services/ai/agent_actions/actions/execute- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/execute-agent-action/
- Example Request:
Example 1 - Input File AgentActionExecutionResponse response = vaultClient.newRequest(AgentRequest.class) .setInputPath(inputFilePath) .executeAgentAction(); Example 2 - JSON String AgentActionExecutionResponse response = vaultClient.newRequest(AgentRequest.class) .setRequestString(jsonString) .executeAgentAction(); Example 3 - Binary File AgentActionExecutionResponse response = vaultClient.newRequest(AgentRequest.class) .setBinaryFile(file.getName(), Files.readAllBytes(file.toPath())) .executeAgentAction();- Example Response:
AgentActionExecutionResponse.ActionResponse actionResponse = response.getActionResponse(); System.out.println("Action Status = " + actionResponse.getActionStatus()); System.out.println("Execution ID = " + actionResponse.getExecutionId());
-
cancelAgentActionExecution
Cancel Agent Action ExecutionRequest the cancellation of an in-progress agent action.
- Parameters:
executionId- The execution ID of the agent action to cancel- Returns:
- AgentActionCancelResponse
- Vault API Endpoint:
POST /api/{version}/services/ai/agent_actions/actions/cancel- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/cancel-agent-action-execution/
- Example Request:
AgentActionCancelResponse response = vaultClient.newRequest(AgentRequest.class) .cancelAgentActionExecution("VAB000000001003");- Example Response:
System.out.println("Response Status = " + response.getResponseStatus()); System.out.println("Action Status = " + response.getData().getActionStatus()); System.out.println("Execution ID = " + response.getData().getExecutionId());
-
retrieveAgentActionExecutionStatus
Retrieve Agent Action Execution StatusRetrieve the status of an executed agent action. Requires at least one query parameter, execution_id or external_id, to identify the action.
- Returns:
- AgentActionExecutionStatusResponse
- Vault API Endpoint:
GET /api/{version}/services/ai/agent_actions/status- Vault API Help Link:
- https://general.veevavault.dev/ai-agents/api/retrieve-agent-action-execution-status/
- Example Request:
AgentActionExecutionStatusResponse response = vaultClient.newRequest(AgentRequest.class) .setExecutionId("VAB000000001003") .retrieveAgentActionExecutionStatus();- Example Response:
AgentActionExecutionStatusResponse.ActionResponse actionResponse = response.getActionResponse(); System.out.println("Action Status = " + actionResponse.getActionStatus()); System.out.println("Execution ID = " + actionResponse.getExecutionId()); System.out.println("Agent Action = " + actionResponse.getAgentAction()); for (AgentActionExecutionStatusResponse.ActionResponse.ActionOutput output : actionResponse.getActionOutputs()) { System.out.println("-------- Output --------"); System.out.println("Output Type = " + output.getType()); System.out.println("Output Value = " + output.getValue()); }
-
setBinaryFile
Specify source data in an input file- Parameters:
filename- file name (no path)binaryContent- byte array of the file content- Returns:
- The Request
-
setInputPath
Specify source data in an input file- Parameters:
inputPath- Absolute path to the file for the request- Returns:
- The Request
-
setRequestString
Specify source data in an input string, such as a JSON request- Parameters:
requestString- The source request as a string- Returns:
- The Request
-
setExecutionId
Specify the execution ID of the agent action execution.- Parameters:
executionId- The execution ID- Returns:
- The Request
-
setExternalId
Specify the external ID of the agent action execution.- Parameters:
externalId- The external ID- Returns:
- The Request
-