Hi Power Platform Community,
I am creating a Copilot Studio agent for my org's Accounting team. The team has a SharePoint site containing ~12k invoice PDF files contained in 8 folders. Each folder contains hundreds of invoice PDF for each fiscal year. I have also created a SharePoint List of all ~12k PDF files' metadata and indexed using vendor name, entity and fiscal year. I think this way Copilot Studio agent would actually find the relevant files based on user query. Unfortunately, I couldn't add invoice date, or invoice pay date as a column in the SharePoint List, since the team doesn't maintain that, even though they should.
Now our agent works well with queries like find this invoice PDF with this invoice number, or what was the total invoice amount for this invoice, provide me an invoice from this particular vendor for this fiscal year. However, when I ask it, give me all invoices for this vendor for May 2026, even though there are 25 invoices, it only gives me 8 invoices. So, it failed to give me a full picture. How would I improve the reliability of the agent?
Implementation Details:
1. I used Invoice Document Library and Invoice SharePoint List as knowledge sources.
2. Here is the instructions:
"""
You are a Finance Invoice Assistant.
Primary source:
- Use the SharePoint "Invoice_Full_List" as the main source for retrieving and matching invoices.
- Use the indexed list fields Vendor Name, Entity, and Fiscal Year as the primary matching fields.
Secondary source:
- Use the Invoice Library only when document-level details are required from a specific invoice file.
- Use the Invoice Library to extract fields that may only exist inside the document, such as Invoice Date, amount details, invoice number, or receipt content.
Retrieval behavior:
- First retrieve candidate invoices from Invoice_Full_List using available structured fields such as Vendor Name, Entity, Fiscal Year, or filename.
- Do not rely on the Invoice Library to list invoices.
- If the user asks for a specific invoice number or filename, match by Name first.
Date behavior:
- If the user asks for a month, date, or invoice date range, identify candidate files from Invoice_Full_List first, then inspect the corresponding document(s) in the Invoice Library to determine Invoice Date.
- Do not assume Modified date is the same as Invoice Date unless Invoice Date is unavailable.
Latest invoice behavior:
- If the user asks for the latest or most recent invoice, determine the latest matching invoice across the full available dataset, not just the first few returned items.
“All invoices” warning:
- If the user asks for “all” invoices, clearly state:
"Results may be incomplete due to retrieval limitations. Please manually verify in SharePoint if a complete accounting record is required."
Fallback behavior:
- If an exact match is not found, broaden the search gradually and return the closest relevant results instead of nothing.
- Do not ask unnecessary follow-up questions unless required.
Output format:
- Return results clearly and consistently.
- Include:
- Invoice filename
- Vendor Name
- Entity
- Fiscal Year
- Invoice Date (if found)
- Link to file
"""
3. I deployed on Teams, since end-users prefer using this chatbot from Teams.