Tweet |
Introduction
When preparing for the Credera Winter '26 release webinar, the release notes for this feature gave me significant pause for thought. Not because it was an awesome change that I'd been waiting ages for, nor that it was something out of left field that I couldn't wait to try. Instead it was because I didn't understand how it worked. The release notes talked about custom agent actions returning specific fields, so did that mean it was the action itself that returned complex data types? There was only one way to find out.
Giving it a Go
Once I'd waited for my Agentforce developer edition to be upgraded to Winter '26 I was able to try out this new functionality. In order to understand how much effort I had to put in around my actions, I started off putting in zero effort. Masterful inactivity has always served me well!
The first thing I tried was a simple screen flow, with the first element an AI Agent Action, as this was the key to defining structured output.
First crack out of the box and I have a winner! Without even having to create a custom action, Copilot for Salesforce is available as an AI Agent Action. Clicking into this showed that the new Structured Output functionality was available with this action.
After a few false starts (the AI Agent Action wouldn't accept collections of
records etc) I had a simple flow that would take in an account Id, retrieve
the opportunities associated with the account, convert them to a simple JSON
structure and ask the AI Agent to calculate the total amount of the
opportunities. For my AI Agent Action, I give a relatively simple prompt
grounded with the opportunity information.
and for my structured output, I specified a single field - the total amount.
Conclusion
Did that mean it was the action itself that returned complex data types?
It did indeed - there was no need for me to create anything outside of the action for the results to be stored in, I just defined the field and used natural language to explain what should be stored in there. The platform created an Apex class to store the information and populated it from the LLM output.
No comments:
Post a Comment