Agent Step with Claude Sonnet Vision — Analyzing Uploaded Image Returns Pega System Context Instead of Image Content in Pega Infinity 25

Hello Everyone :waving_hand:

Hope everyone is doing well. I’m reaching out to seek some expert guidance on an image analysis use case using the Pega Gen AI Agent step. Would really appreciate any help or pointers!

Environment

  • Pega Version: Infinity 25

  • AI Model: Pega-Default-Smart (Claude-Sonnet-45)

  • Constraint: Must use only Agent step — no external REST connectors

Requirement

User uploads a PNG image as a case attachment. We need to analyze the image using the Agent step and display the summary on UI.

What We Built

An activity loops through the ImageDoc page list, fetches the Base64 encoded image stream via: D_AttachmentContent[AttachInsKey:.pxAttachmentKey, PopulateAttachStream:true].pyAttachStream and stores it in ImageInputPrompt property (String, max length 1000000).

The Agent step is configured as:

  • Input message: .ImageInputPrompt (contains full Base64 image string — verified no truncation in tracer)

  • Output message: .ImageSummary

  • Model: Claude-Sonnet-45 (vision capable)

Issue

Despite the Base64 string being stored correctly, the Agent always returns a summary describing a Pega system screen (mentioning actual case ID, logged-in user, navigation tabs) instead of analyzing the actual uploaded image. The response mentions “Based on provided pega_context” which confirms the Agent is reading Pega system context rather than processing the image.

What We Have Already Tried

  • Passed Base64 with and without data:image/png;base64, prefix — same result

  • Increased property max length to 1000000 — truncation resolved but issue persists

  • Updated Agent guardrails to ignore Pega context — no change

What is the correct way to pass a Base64 image to the Agent step for actual image analysis?

Any guidance, workarounds or best practices would be greatly appreciated. Thanks in advance for your time and support! :folded_hands:

Hi @TwinkleChawla : Can help to share more details on the need of agent. The use case of document analysis can be implemented using Gen AI connect where you can pass the attachment field with required system and user prompt to analyze and summarize the attachment.

Thanks.

If you’re looking to extract the content from document, please leverage GenAI connect to extract the content from the Image/PDF.

Please note: Pega support Sonnet 45 model as of today. The newer models are supported today in 25.1.

Reference: Experience Next-Level Document Automation with DocAI, Powered by Pega GenAI