web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Best practice to defin...
Copilot Studio
Suggested Answer

Best practice to define the exact length of a content piece generated by CS Agent

(0) ShareShare
ReportReport
Posted on by
Hi everyone,
 
Imagine you have an investment application form and you are building an agent that helps users formulate answers for this form.
The challenge is that each answer has a strict character limit.
The agent should:
- ask the user for input,
- compare the input against available best practices,
- generate a well-formulated answer,
- make sure the answer does not exceed, let’s say, 2,000 characters including spaces,
- then continue question by question.
The problem is that we know LLMs cannot reliably count characters. They usually estimate it.
How would you design such a solution from a character-counting and answer-adjustment perspective?
I tried one approach with Generative Answers: the agent generates an answer block, measures the length, and if the length is not acceptable, the process repeats a few times in a loop.
But I am not fully happy with the answer quality when using Generative Answers.
A custom prompt as a tool also tends to hallucinate too much.
If I use a child agent, the answer quality is better, but then it is not very clear to me how to store the AI-generated answer in a variable and measure its length.
 
Any ideas? ^^
I have the same question (0)
  • Suggested answer
    Romain The Low-Code Bearded Bear Profile Picture
    2,665 Super User 2026 Season 1 on at
    hello
     
    I totally agree, agent are not reliable when you ask "count number of character".
    How i do in real life ;
    -> ask the agent for less like 1800 or 1500. And it will be alway under 2000
    -> use external code to cut at 1999 if it's very very important.
     
    Last option wich i don't like and is expensive is to test lenght, and make a loop to ask AI builder to reduce the lenght, i don't like it because it will cost a lot in real life for something that could be handle with option 1
     
    Hope it help to solve the prob :) if yes please mark asnwer as verify in green, it's important for the community and search engine :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 813

#2
Vish WR Profile Picture

Vish WR 313

#3
Haque Profile Picture

Haque 271

Last 30 days Overall leaderboard