Conversational Process - Return Object
Hello,
I have been having difficulty trying to combine the return of multiple actions in Agent Studio’s Conversational Process Editor.
This could possibly be resolved with a final return object that combines the output of the two objects so they are interpreted by the reasoning agent in a single combined manner instead of it taking liberty in which fields/actions to output.
Another solution could be having a static message box instead of content activity where I can directly map out the fields from both of the actions to my custom message that I want consistently outputted.
This is for a “People Lookup” plugin which combines mw.get_user_by_email and our own GET_direct_reports_from_servicenow.
I have tried extreme prompting to get a more consistent output and have found that by providing an example in the final step, Content Activity, I have received better results but very often the reasoning agent takes liberty in choosing which data to show the user.
For mw.get_user_by_email I have,
display_instructions: "'If asked Who is this person, your task is to list all specified fields for a user from the {{mw_user}} slot in a bulleted list. Also, always include the direct reports fetched using AS_GET_get_direct_reports_from_servicenow. If a field does not exist or is empty/null for the user, still display the field with a blank value for consistency. Example Output: Here are all available fields for ***** ****: ... Include direct reports such as: - ****** ****** (******.******@***.com) - ... If the user only requests a single field like MyID, respond with just that field, but ensure the direct reports are still fetched concurrently.'"
instructions_for_message: "'If the user asks Who is this person, always display the full list of specified user fields including direct reports. If a single field such as MyID is requested, display only that specified field.'"
instructions_for_model: "'If the question is Who is this person, show the full user fields and their direct reports. If the question specifies a single field like MyID, return only that field from {{mw_user}}.'"For GET_direct_reports_from_servicenow I have,
display_instructions: "'Your task is to list the direct reports found in {direct_reports} for the user stored in the {{mw_user}} slot. If this action is invoked, it should always run as part of the response to ensure complete information is provided. If empty, respond with: No direct reports found.'"
instructions_for_message: "'If the user asks for their direct reports, always display the full list of specified direct report fields. If they request Who is this person, show the full user fields including direct reports.'"
instructions_for_model: "'If the question is Who is this person, show the full user fields including direct reports; if the request is only for direct reports, list those accordingly.'"
For the Content Activity I have,
Your task is to always list the full list of the following fields for a user stored in the {{mw_user}} slot when asked "Who is this person?" Also include a list of their direct reports found in {direct_reports}. List the specified fields and their values in a bulleted list.
If a field does not exist or is empty/null for the user, still display the field with a blank value for consistency. Do not shorten or summarize the output for the user. Strictly stick to the example output. If the response is shortened or summarized, prompt the user to say, “If you would like to see the full output of fields and direct reports, say Show More.”
If the user requests a single field (e.g., MyID), respond only with that field. If the user asks "Who are their direct reports?", only list the direct reports from {direct_reports}.
Example Output:
Personal Information
- Full Name: ***** *******
- First Name: *****
- Last Name: *******
- Email: *****.*******@***.***
- Employee ID: ******
- Employee Number: *********
- SAP Badge Number: ********
- MyID: ******
- Phone Number: +1 (***) ***-****
Role & Department
- Role: ******* **********-**** ************ 3
- Department: ********** *********
- Job Family Group: *** - *********** **********
- Business Unit Hierarchy: ********** *********
- Division: ***** *********** ****** - *****
- Management Level: **
- Is Manager: ****
- Employee Type: ********
Location
- Location: **, ******* **** - ** - ****, **-** **
- Timezone: **/*******
- Entity Code: ****
Reporting Structure
- Manager Email: ***.*******@***.***
Sector & Tags
- Sector: *********
- User Tags: *****_****
Direct Reports
- ****** ****** (******.******@***.***)
- **** ***** (****.*****@***.***)
- ***** ***** (*****.*****@***.***)Before providing an example the reasoning agent would almost always summarize and shorten my example based on its own internal weightings and display instructions for short concise answers. With the example it provides the full output 70-80% of the time but more times then not the Direct Reports state “No direct reports found.” even though when I check the logs I see that GET_direct_reports did successfully pull them.
I imagine that these improvements would open the doors for move complicated multi step automations built directly in Agent Studio. Something akin to n8n which provide Split, Merge, Manual Mapping and Structured Output Parser nodes.
Thank you for your help!