AI Agent APIs

A REST API to manage AI agent conversations in Pega—start, interact with, retrieve, and close conversations, and react to messages.

Base path: https://{host}/prweb/app/{application}/api/application/v2/ai-agents

Get a conversation (GET)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentId}/conversations/{conversationId}
  • Sample Request: NA
    SAMPLE RESPONSE:
{
  "id": "PXCONV-29096",
  "name": "create a loan application",
  "createdOn": "2026-01-22T01:49:34.848Z",
  "updatedOn": "2026-01-22T01:51:51.291Z",
  "messages": [
    {
      "content": " create a loan application",
      "role": "USER",
      "createdOn": "2026-01-22T01:50:47.924Z",
      "messageID": "MSG-3326",
      "isLiked": null,
      "attachments": [],
      "aiGuidedQuestions": []
    },
    {
      "content": "Hi Ramesh! I'd be happy to help you submit a new loan application. ",
      "role": "ASSISTANT",
      "createdOn": "2026-01-22T01:51:08.780Z",
      "messageID": "MSG-3329",
      "isLiked": null,
      "attachments": [],
      "aiGuidedQuestions": []
    },
    {
      "content": "Your full name John DoE Your contact information : 123-123-1234....",
      "role": "USER",
      "createdOn": "2026-01-22T01:51:43.522Z",
      "messageID": "MSG-3330",
      "isLiked": null,
      "attachments": [],
      "aiGuidedQuestions": []
    },
    {
      "content": "Thank you for providing those details, John. ...",
      "role": "ASSISTANT",
      "createdOn": "2026-01-22T01:51:51.288Z",
      "messageID": "MSG-3333",
      "isLiked": null,
      "attachments": [],
      "aiGuidedQuestions": []
    }
  ]
}

Get the Past History (GET)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentId}/conversations?contextID={contextId}&pageSize={pageSize}&pageIndex={pageIndex}
  • Sample Request: NA
    SAMPLE RESPONSE:
{
  "conversations": [
    {
      "name": "create a loan application",
      "id": "PXCONV-29089",
      "updatedOn": "2026-01-21T19:20:23.601Z",
      "createdOn": "2026-01-21T19:17:36.102Z"
    },
    {
      "name": "Can you please get the details of L-19005",
      "id": "PXCONV-29086",
      "updatedOn": "2026-01-21T17:21:38.107Z",
      "createdOn": "2026-01-21T17:16:33.829Z"
    }
  ]
}

Initiate AI conversation(POST)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentId}/conversations
    Sample Request:
{"executeStarterQuestion":false}

SAMPLE RESPONSE:

{
    "enableTracer": true,
    "aiGuidedQuestions": [],
    "response": "",
    "supportedCapabilities": {
        "stream": {
            "isEnabled": true
        }
    },
    "suggestedPrompts": [],
    "messageID": "",
    "ID": "PXCONV-29013",
    "initialAdditionalInstruction": "",
    "initialInstruction": ""
}

Send a message in a conversation (PATCH)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentId}/conversations/{conversationId}
    Sample Request:
{"request":"create a new loan",
"capabilities":{"stream":{"isEnabled":true}}}

SAMPLE RESPONSE:

message {"content":"I\u0027ll"}
13:52:30.284
message {"content":" help you create a"}
13:52:30.284
message {"content":" loan application."}
13:52:30.284
message {"content":" Let me use the"}
13:52:30.284
message {"content":" Loan"}
13:52:30.284
message {"content":" Application tool to assist"}
13:52:30.284
message {"content":" you with"}
13:52:30.284
message {"content":" this process"}
13:52:30.284
message {"content":"."}

End a conversation(PUT)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentId}/conversations/{conversationId}/close
  • Sample Request: {}
  • SAMPLE RESPONSE: {}

Like a message (PUT)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentName}/conversations/{conversationId}/messages/{messageId}/like
  • Sample Request: {}
  • SAMPLE RESPONSE: {}

Dislike a message (PUT)

  • EndPoint URL: https://{host}/prweb/app/{application}/api/application/v2/ai-agents/{agentName}/conversations/{conversationId}/messages/{messageId}/dislike
  • Sample Request: {}
  • SAMPLE RESPONSE: {}

Pega GenAI Cookbook - Recipes series

Enjoyed this article? See more similar articles in Pega Cookbook - Recipes :fire::fire::fire: series.