r/PowerAutomate 7d ago

Power Automate AI contract reader using 150k+ tokens per document. How would you redesign this?

Hi all,

First time posting here and yes used Ai to help me cultivate my post that makes more sense to you experts. Any advice is greatly appreciated.

I'm looking for some guidance from people who have built large document-processing solutions in Power Automate.

I built a contract intelligence solution that takes customer contracts (PDF/DOCX), extracts the text, and then uses AI prompts to identify and extract specific business information.

Current design:

  • Contract uploaded to SharePoint
  • Text extracted from entire document
  • 7 separate AI prompts run against the contract
  • Each prompt extracts a different category of information:
    • Customer details
    • Contract dates
    • Commercial terms
    • Billing details
    • Contacts
    • Renewal information
    • Other contract metadata
  • Results are written to SharePoint lists

The solution works, but token consumption is becoming a major issue.

Some contracts are 100+ pages and the flow is consuming ~150k+ tokens per execution. With multiple test runs I'm exhausting my AI credits very quickly.

Before I redesign everything, I wanted to ask the community:

  1. Would you combine the 7 prompts into a single structured extraction prompt?
  2. Is it better to chunk contracts first and only send relevant sections to AI?
  3. Are there Power Automate patterns that significantly reduce token usage?
  4. Has anyone moved part of the extraction logic outside of AI and into traditional parsing/rules?
  5. Are there any obvious anti-patterns in my design?

My goal is to extract 80-100 contract attributes as accurately as possible while keeping AI costs manageable.

Would appreciate any architecture suggestions or lessons learned from people who have built similar contract intelligence solutions.

Thank you in advance and any advice or direction is greatly appreciated.

4 Upvotes

11 comments sorted by

6

u/LieV2 7d ago

Start by just reading important pages. Mine does contracts but all the important info is on page 1 or 2 and then the 40 page contract doesn't need to be read each time. 

2

u/psykezzz 7d ago

I have a similar use case, but I just built a copilot agent, the contract gets uploaded and the info is pulled out via the agent instructions and some more guided markdown files stored as knowledge. Less than 10 credits per run

2

u/azimzicar 7d ago

using AI via Power Automate is expensive and not ideal for high volume process like yours. This process should be built using Azure AI foundry where you can control costs by using different models.

1

u/Huseyin-Nodient 6d ago

Your token bill is mostly the 7x duplication. Every prompt gets the full contract, so a 20k token document costs you 140k+ before outputs. Two changes fix most of it:

  1. Merge the 7 prompts into one with a structured JSON output schema (customer, dates, commercial terms, billing, contacts, renewal, metadata as one object). One pass over the text instead of seven.

  2. Pre-slice before prompting. Most contract metadata lives in the first and last few pages. Extract those sections and only send the full text as a fallback when fields come back empty.

That typically cuts consumption by 70-80 percent without losing accuracy.

For the redesign work itself: we run an AI consultancy and rebuild flows like this constantly, so we built a Chrome extension that exports the flow definition as JSON straight into Claude or ChatGPT and imports the result back. You describe the restructure, the AI rewrites the actions, you import and test. Took our redesign cycles from an afternoon to under an hour. Built it for our own client work, published it after months of daily internal use: https://chromewebstore.google.com/detail/ai-flow-editor-for-power/jlaicchhmifpghnhngkmklcbmikgnckp

1

u/VictorIvanidze 6d ago

Do a single AI request instead of 7 ones.

1

u/Ok_Presentation_5489 5d ago

Single Run a Prompt step is the way to go, you should be able to select the model in that prompt step and that can help as well but honestly, sounds like some large docs you're evaluating. Power Automate might not be the right answer for this

1

u/Prestigious_Eye2007 2d ago

You could look at using Content Understanding Studio...
https://learn.microsoft.com/en-us/azure/ai-services/content-understanding/quickstart/content-understanding-studio

PS. Includes Audio, video, and image modality analyzers

Pretty easy to do an initial setup, you can set your own schema of what you want to pull with "prompt" type descriptions to tell it things like Part Number may include P/N, Part #, PartNo, etc.

After you run a test, you can see the output, including JSON format. At the bottom of the JSON, it will tell you token consumption. So, you can do some testing against your real files before deciding to incorporate.

Content Understanding Studio is particularly good if you know what you want, but they forms that come in have stuff in different locations.

If it's always the same format coming in, you can use Document Intelligence Studio instead.

1

u/magriff99 1d ago

I actually used copilot to rewrite my prompt.

Create a prompt that will review my current prompt and suggest changes to reduce token usage

I then used the prompt to rewrite my prompt.

Act as an expert AI prompt engineer specializing in token optimization and the CLEAR framework (Constraint, Lean, Explicit, Architected, Reusable).

Review the target prompt provided below. Analyze it and provide a revised, highly efficient version optimized to reduce input tokens while maintaining or improving the quality of the LLM's response.

Your optimization strategy must focus on:
1. Eliminating filler words, polite phrasing, and redundant text.
2. Converting dense paragraphs into tight, structured bullet points.
3. Specifying output constraints (e.g., format, length) tightly upfront to reduce back-and-forth clarification turns.
4. Structuring context so it is delivered cleanly without repetition.

Provide your output in three parts:

  • A brief bulleted breakdown of where tokens were wasted in the original.
  • The newly optimized, token-efficient prompt wrapped in a code block so I can easily copy it.
  • An estimated percentage of input tokens saved.

Here is the prompt to review:
[PASTE YOUR CURRENT PROMPT HERE]