Copilot different response on every run and sometimes passing, sometimes failing same prompt

Sarita Shukla 0 Reputation points
2026-09-14T01:54:35.5566667+00:00

I have created an agent at my work’s copilot. It is to follow all calculations logic instructions I have provided in agent and knowledge section. Then read the excel and pdf I attach for values (on different clients based on file names). And create a .eml draft with exact body what I want to write, and attach the relevant files to that draft. At times it does perfect job. Then at times, it fails to read the body sample and only writes few rows on the drafts and also says it can not attach because the binary files are not available. It’s time entities issue for me now and need help. Please advice.

Microsoft Copilot | Microsoft 365 Copilot | Development
0 comments No comments

1 answer

Sort by: Oldest
  1. Prasad-MSFT 10,546 Reputation points Microsoft External Staff Moderator
    2026-09-14T06:30:14.4966667+00:00

    This looks less like a “time entities” issue and more like an unreliable end-to-end design: the agent is being asked to extract multiple files, apply calculations, reproduce an exact template, generate an .eml, and preserve binary attachments in one generative step.

    Recommended approach

    Separate knowledge from runtime files

    Keep calculation rules and the body template in the agent’s instructions or persistent knowledge.

    Upload each client’s Excel/PDF files in the same message that starts processing. Runtime attachments are separate from knowledge sources and may be skipped if processing fails.

    Do not rely on ordinary knowledge retrieval for an exact email body

    Store the body as a deterministic template, with placeholders such as {{ClientName}}, {{Amount}}, and {{Date}}.

    Tell the agent to return structured fields only, preferably JSON.

    Have a flow insert those values into the template. Retrieval and generative rewriting can omit or shorten rows, so it should not be the final formatting mechanism.

    Use a flow for the file and email operations

    Agent: identify the client, extract values, calculate results, and return JSON.

    Flow: fetch the original files by SharePoint/OneDrive file identifier, construct the exact body, create the Outlook draft, and add attachments using file name plus file content.

    Avoid asking the model to carry binary file content through its conversational output. A filename or extracted text is not the binary content required by an attachment action.

    Add validation before draft creation Require the workflow to stop rather than create a partial draft when:

    an expected file is missing;

    required Excel/PDF values are null;

    the calculated results fail checks;

    the generated body is missing required sections or rows;

    the flow cannot retrieve an attachment’s binary content.

    Reduce file complexity during testing Test with one client and one document at a time, then gradually add files. Microsoft recommends splitting large or complex PDFs and spreadsheets into smaller inputs when upload or interpretation is unreliable.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.