- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
2 hours ago
I’ve seen a lot of questions from folks wondering how they can configure their AI agent to accept an attachment from a user, rather than relying on pre-situated attachments, like I shared earlier with the File Upload Tool.
There’s a few ways to do it, but this might be the easiest way. Let’s go through it here.
Prerequisites
For this tutorial, I’m running the following setup:
- Australia Patch 5 W37 build
- ServiceNow Otto Platform Prime [sn_ai_plat_prm] 2.2.0
- ServiceNow Otto AI Agents [sn_aia] 8.3.4
- Content Understanding (formerly Now Assist in Document Intelligence) [sn_docintel_gen_ai] 7.0.5
Virtual Agent Topic Configuration
You’ll need to first configure a VA Topic to provide the user a place to upload their attachment.
Login as a System Administrator, and go to Conversational Interfaces > Virtual Agent > Designer:
In the Conversational Studio, go to Asset library. My example is going to run from AI agents, so I will select LLM and ServiceNow Otto for Virtual Agent (default) as the Conversational Assistant to see my list of existing Assets.
Then, select Create asset to get started with the Topic.
In the Create asset modal, select Topic:
In the Create a topic wizard, enter the following:
- Application scope: <your desired app scope>
- Model Type: LLM
- Type: Topic
- Internal name: Story upload
- Display name: Story upload
- Topic description used for discovery: Upload a story
- Select LLM assistants to make topics available to them and any primary assistants: ServiceNow Otto for Virtual Agent (default), or Now Assist Panel if you desire as well
Configure Advanced properties if you need to, but I don’t believe you have to make any changes.
Select Create when finished. In the Topic builder, click-and-drag the Multi File Upload Utility to the line between Start and End blocks.
In the node configuration for the Multi File Upload utility, set the following variable values:
- Node name: Upload a story
- prompt (String): Upload a story
- allow_user_to_skip (Boolean): unchecked
- max_file_count (String): 5
- max_file_size (String): 5
- try_again_message (String): Please try uploading again.
- user_confirmation_to_repload_msg (String): Reupload
- allow_all_file_types (Boolean): checked
Create an output mapping variable at the bottom of the node configuration:
- Name: files
- Variable Name: files
- Enable: checked
Save and Publish the Topic. Verify that it is set to Active:
Exit the Virtual Agent Designer. We’ll use our Topic as a Tool in our AI Agent.
AI Agent Configuration
Now that our VA Topic is ready to go, navigate to the AI Agent Studio. Go to AI Agent Studio > Create and manage:
Under the AI agents pane, select Add > Chat:
Set up your AI agent like this. Under Define the specialty, enter the following:
- AI agent name: Story Summary Agent
- AI agent description: An AI agent for readers, students, and general users who want to upload a short story file, get a summary, and ask follow-up questions about the story. It reads the uploaded document, returns a concise summary, and provides document-grounded answers to additional questions.
- AI agent role: Acts as a document-based reading assistant that accepts a user-uploaded short story file, generates a concise summary of the story, and answers additional user questions grounded only in the uploaded story content. Communicates in clear, direct language. Produces accurate story summaries and question responses without adding facts that are not present in the document. Handles both initial summary requests and follow-up questions about plot, characters, themes, setting, tone, and other story details.
- List of steps:
## Instructions
# Gather story
1. Use the "Upload a story" tool and ask for an uploaded short story file from the user. Store the Attachment's [sys_attachment] sys_id value in variable ${attachmentId}
# Attachment validation
2. Check whether the uploaded file is accessible and readable.
2.a. If the file is not accessible or readable, return a message asking the user to upload the file again.
2.b. If the file is accessible and readable, continue to the next step.
2.c. Validation: Verify that the file is readable.
# Story content
3. Read the story content. Use the "Read story content from attachment" tool. Use the variable ${attachmentId} as the Attachment ID.
# Procedure for Summary request
4.a. Classify the request as Summary when the user asks for a general summary of the story.
4.b. If the request type is Summary, generate the story summary when the request type is Summary.
4.c. Return the summary exactly as generated.
# Procedure for Question and Answer
5.a. Classify the request as QnA when the user asks a specific question about the story, or when the user asks for a summary in a specific style, format, or length.
5.b. Capture the user's additional question when the request type is QnA.
5.c.. Generate the answer to the user's question from the uploaded story.
5.d. Return the answer exactly as generated. Base every response only on the uploaded story content.
5.e. State that the answer is not available in the story when the uploaded file does not contain the requested information.
5.f. Process each new follow-up question against the same uploaded story when the file remains available.
Under Add tools and information, set up two Tools. For the first, go to Add tool > Conversational topic:
In the Add a conversational topic Tool configuration, fill out the form as follows:
- Select topic: Story upload
- Name: Upload a story
- Tool description: Allows user to upload a story to the AI agent. Inputs: Story file.
- Execution mode: Autonomous
- Display output: unselected
Select Add. Your first Tool should be created:
For the second Tool, go to Add tool > AI skill:
In the Add an AI skill Tool configuration, fill out the form as follows:
- Select skill: Document extraction
- Name: Read story content from attachment
- Tool description: Read story content from the attachment. Input: Attachment ID. Output: Attachment text.
- Execution mode: Autonomous
- Display output: unselected
Let’s take a minute to examine the Document extraction skill. From AI Admin Hub, go to Platform > Other, and search for Document extraction:
This is the referenced Document extraction skill within AI Skill Kit (formerly Now Assist Skill Kit):
Select Add. Your second Tool should be created:
Finish out the rest of the AI agent configuration. Select security controls, triggers, conversation assistants, and be sure to activate your AI agent.
Testing the AI agent
In the AI Agent Studio, go to the Testing playground. Fill out the test form as follows:
- Choose a test type: AI agent or workflow
- Choose a testing mode: (either mode works)
- Name of the AI agent or agentic workflow: Story Summary Agent
- Version: (latest)
- Task: Summarize my story
Select Continue to test chat response.
When the execution plan runs, you’ll be asked to upload a file containing a story. I’ll use The Tale of Peter Rabbit, a classic children’s book written by Beatrix Potter in 1902.
After uploading my file (I used Microsoft Word, DOCX format), I’ll see a response like this:
Once the file content is in the conversation context, you can continue to refer to it:
You’re all done!
Troubleshooting
- If you’re using an older version of Now Assist in Document Intelligence, it should still work, but you may want to consider updating the plugin/application first. If you have skipped records in your upgrade logs [sys_upgrade_history_log], consider reverting those to baseline/OOB as well.
- If having trouble getting the file extracted in Content Understanding, try using a smaller file with only text.
- If you’re using a PDF file, you may want to try different encodings, or different export methods.
- Consider swapping LLMs in your Skill settings if you’re running into continued failures, at least rule out a model configuration issue.
Resources
- Content Understanding: https://www.servicenow.com/docs/r/intelligent-experiences/content-understanding-landing.html
- 61 Views
