Skip to content
Platform

Agent Invoke API

Endpoint: POST /api/agent/{agent_uuid}/invoke/

Description

This endpoint allows users to invoke an agent to perform specific actions based on the input text and context provided.

Parameters

  • Path Parameter:
  • agent_uuid (string, required): A unique identifier for the agent you wish to invoke.

  • Request Body (application/json, required):

  • text (string): The input text to be processed by the agent.
  • payload (object): Additional context information to assist the agent in generating responses. This can be parsed by the agent to tailor responses accordingly.

Example Request Body 1:

{
  "text": "example text",
  "payload": {}
}

Example Request Body 2 (New Example with Payload Data):

Agent's prompt:

You are {name} and you are {age} years old. Tell that to the user. API call with payload

{
  "text": "",
  "payload": {"name": "John", "age": 48}
}

Response

  • Status Code: 200 OK
  • Content-Type: application/json

Response Body:

  • answer (string): The agent's response to the input text.
  • duration (string): The time taken to process the request.
  • token (string): A token generated for the session or action.

Example Response Body 1:

{
  "answer": "response from agent",
  "duration": "100ms",
  "token": "xyz123"
}

Example Response Body 2:

{
  "answer": "Hello! I'm John, and I'm 48 years old. How can I assist you today?",
  "duration": "1.15 seconds"
}