Skip to main content

How to Write Prompts for Agents and AI Templates

How to write prompts that work for Weflow AI agents and Ask Weflow AI templates: whose records, which dates and what output to ask for.

What an agent returns depends on two things: the records it is given and the prompt it runs. We recommend adding details around whose deals, which dates and what output, and run on a record set the lookup has already narrowed.

Only Weflow admins can build, edit and manage agents, so the agent rules are for admins. They apply to the AI Agent step in Agent Builder, and the later sections cover the prompts in Ask Weflow AI templates, AI Field Updates and AI Playbooks.

What makes an agent prompt work in Weflow

  • Narrow the records first: an agent whose Get/Lookup Record step names the object, the stage and the date window gives materially better output than the same prompt run without one. The lookup tells the AI what it may look at; the prompt says what to do with it

  • Name whose and when: say whose competitors, whose deals and which dates you mean. A prompt that leaves them out answers from the wrong context

  • Be specific: prompts that work are long and specific. They name the entity, the period, the constraints and what not to include. A good prompt is not one sentence typed in passing

  • Use relative dates: Weflow gives every prompt the current date, so "the last seven days" or "this quarter" resolve from today

  • Leave out the company description: the business context in Admin Console > Weflow AI > Ask AI reaches every agent, so a prompt does not repeat what your company does or who its competitors are. Object Context and Field Context on the same page reach agents and AI Playbooks too, so a prompt need not explain an object or a custom field described there

  • Choose files in Output Format: a PDF or CSV is made only when you choose it in the step's Output Format. Asking for an Excel or CSV attachment in the prompt produces no file

  • Ask once for one answer: each AI Agent step is its own run of the model, so two steps with the same instructions return different content. For one answer in several forms, choose several output formats in one step

  • Switch on Web Search for public information: with Web Search on, the agent brings in public information, such as a company's latest news, beside your Salesforce data

How to fit agent instructions into the 4,000-character prompt

  • Condense or split: the AI Agent step holds up to 4,000 characters and takes no uploaded document. A methodology, a forecasting guide or a set of hygiene rules written as a document is condensed into the prompt, or the work is split across two agents with their own prompts and runs

  • One prompt per audience: an agent runs one fixed prompt, with no placeholder for the person receiving it. A personal report for each rep needs one agent per rep, with the rep's name in the prompt; otherwise send one team-wide report, and each rep asks which deals are theirs in Ask Weflow AI

  • Keep the data within limits: a run can time out when its lookup returns more data than it can process. A shorter date range or fewer stages keeps it within limits, and a list that only needs exporting belongs in a CSV

Writing prompt templates for Ask Weflow AI

The prompt templates you share with teams can be set in Admin Console > Weflow AI > Ask AI > Prompts. These hold up to 25,000 characters.

  • Name a time frame and a scope: Ask Weflow AI answers a question about one record in seconds, while a question that sweeps many records or a long period takes minutes, and one that reaches across the whole system can stop before it finishes. "The last three months" and "one team" keep an answer fast and complete. Work that sweeps the whole book of business belongs in an agent

  • Write in your team's rules: a template can carry how your team measures things, for example that revenue comes from a delivery schedule object rather than the opportunity amount

  • One topic per chat: a new question on a new topic works best in a new chat; one long conversation that mixes many questions answers less well

Writing prompts for AI Field Updates and AI Playbooks

  • AI Field Updates: the accuracy of a field update depends on how well its prompt is written, and Weflow ships more than 250 pre-built prompts to start from. Each update reads one call transcript and writes over the field's content, so add an instruction to leave the field unchanged when the call carries no new information

  • AI Playbooks: each playbook element carries your own evaluation criteria and a description of what a properly completed element looks like, and the AI scores the deal against that description

  • Where to edit them: template prompts are edited in the Admin Console. Neither the API nor the MCP connector writes a prompt into a template

Frequently asked questions about writing prompts for agents

Can an agent prompt use a document?

No. The AI Agent step takes no uploaded document, so its rules go into the 4,000-character prompt. Ask Weflow AI can take a file you attach in a chat.

Why do two AI Agent steps with the same prompt return different results?

Each AI Agent step is its own run of the model, and AI output is never identical twice. Ask for the answer once and choose several output formats in that step.

Does my prompt need today's date?

No. Weflow gives every prompt the current date, so relative periods such as "last month" work as written.

Did this answer your question?