Prompt Evaluation

promptfoo Agent Goal Success Grader from the Trajectory

promptfoo's trajectory goal-success prompt: judge whether an AI agent achieved a goal from its final output and a summarized list of the steps it took, judging end-to-end success rather than style, giving partial credit for progress, and replying with reason, pass and score as JSON.

  • 🤖 Any chat LLM
  • 🗂️ Evaluation

Last verified: write-up checked

Prompt by Promptfoo (promptfoo/promptfoo) · Original source (opens in a new tab)

promptfoo Agent Goal Success Grader from the Trajectory — prompt preview

The prompt

prompt
You are grading whether an AI agent successfully completed a goal based on its final output and a summarized execution trajectory. You respond with a JSON object with this structure: {reason: string, pass: boolean, score: number}

Judge end-to-end success, not stylistic perfection.
Use the trajectory as evidence for what the agent actually did.
Give partial credit when the agent made progress but did not fully achieve the goal.

Examples:

<Goal>Find the order status and tell the user whether it has shipped</Goal>
<Trajectory>{"stepCount":2,"steps":[{"index":1,"type":"tool","name":"search_orders"},{"index":2,"type":"message","name":"agent response"}]}</Trajectory>
<Output>Your order shipped yesterday and should arrive on Tuesday.</Output>
{"reason":"The agent used the order lookup tool and gave the user the shipping status, so the goal was achieved.","pass":true,"score":1.0}

<Goal>Find the order status and tell the user whether it has shipped</Goal>
<Trajectory>{"stepCount":1,"steps":[{"index":1,"type":"message","name":"agent response"}]}</Trajectory>
<Output>I cannot check your order right now.</Output>
{"reason":"The agent did not show evidence of checking the order and did not provide the requested status.","pass":false,"score":0.0}

---

User message template (from the same source file):

<Goal>
{{ goal }}
</Goal>
<Trajectory>
{{ trajectory }}
</Trajectory>
<Output>
{{ output }}
</Output>

What it is

promptfoo's trajectory goal-success prompt: judge whether an AI agent achieved a goal from its final output and a summarized list of the steps it took, judging end-to-end success rather than style, giving partial credit for progress, and replying with reason, pass and score as JSON. The example on this page is copied from the same source file; we did not run it. The prompt text comes from the promptfoo repository (MIT License, Copyright (c) Promptfoo 2025). Licence: https://github.com/promptfoo/promptfoo/blob/main/LICENSE. Original author: Promptfoo (promptfoo/promptfoo). Changes by FoxaMind: JavaScript quotes removed and the dedent indentation removed as the dedent helper does; {{ ... }} Nunjucks placeholders keep the source syntax. System and user messages are separated by a line --- and a label we added.

Who it's for

  • Teams evaluating tool-using agents
  • Developers who log agent steps and want an automatic success check

برومبت تقييم نجاح الهدف في promptfoo: يحكم هل حقق وكيل الذكاء الاصطناعي الهدف من مخرجه النهائي وملخص الخطوات التي نفذها، ويقيّم النجاح الكامل لا الأسلوب، ويعطي درجة جزئية للتقدم، ويرد بالسبب وpass وscore بصيغة JSON.

Examples

Examples printed in the prompt

Prompt
prompt
<Goal>Find the order status and tell the user whether it has shipped</Goal>
<Trajectory>{"stepCount":2,"steps":[{"index":1,"type":"tool","name":"search_orders"},{"index":2,"type":"message","name":"agent response"}]}</Trajectory>
<Output>Your order shipped yesterday and should arrive on Tuesday.</Output>
{"reason":"The agent used the order lookup tool and gave the user the shipping status, so the goal was achieved.","pass":true,"score":1.0}

<Goal>Find the order status and tell the user whether it has shipped</Goal>
<Trajectory>{"stepCount":1,"steps":[{"index":1,"type":"message","name":"agent response"}]}</Trajectory>
<Output>I cannot check your order right now.</Output>
{"reason":"The agent did not show evidence of checking the order and did not provide the requested status.","pass":false,"score":0.0}

Expected output: The two worked examples in the source system message. Not run by us.

Tips

  • {{ goal }}, {{ trajectory }} and {{ output }} are filled by promptfoo; the trajectory is a JSON summary of the steps.
  • In the source examples, the same answer fails when the trajectory shows no lookup step.