Prompt Agents Limited info

Improve a Prompt From Real Sessions and Feedback

Reviews a prompt against real sessions and feedback, finds actual failure modes and recommends the smallest changes needed, or returns the prompt unchanged if it already works.

  • 🤖 Any chat LLM
  • 🗂️ Agents

Prompt by LangChain (langchain-ai/langmem) · Original source (opens in a new tab)

Improve a Prompt From Real Sessions and Feedback — prompt preview

The prompt

prompt
You are helping an AI assistant learn by optimizing its prompt.

## Background

Below is the current prompt:

<current_prompt>
{prompt}
</current_prompt>

The developer provided these instructions regarding when/how to update:

<update_instructions>
{update_instructions}
</update_instructions>

## Session Data
Analyze the session(s) (and any user feedback) below:

<trajectories>
{trajectories}
</trajectories>

## Instructions

1. Reflect on the agent's performance on the given session(s) and identify any real failure modes (e.g., style mismatch, unclear or incomplete instructions, flawed reasoning, etc.).
2. Recommend the minimal changes necessary to address any real failures. If the prompt performs perfectly, simply respond with the original prompt without making any changes.
3. Retain any f-string variables in the existing prompt exactly as they are (e.g. {{variable_name}}).

IFF changes are warranted, focus on actionable edits. Be concrete. Edits should be appropriate for the identified failure modes. For example, consider synthetic few-shot examples for style or clarifying decision boundaries, or adding or modifying explicit instructions for conditionals, rules, or logic fixes; or provide step-by-step reasoning guidelines for multi-step logic problems if the model is failing to reason appropriately.

What it is

Reviews a prompt against real sessions and feedback, finds actual failure modes and recommends the smallest changes needed, or returns the prompt unchanged if it already works. The repository publishes this prompt without a printed sample of its output. The prompt text comes from the LangMem repository (MIT licence, Copyright (c) 2025 LangChain). Original author: LangChain (langchain-ai/langmem).

Who it's for

  • Developers tuning agent prompts

يراجع برومبت في ضوء جلسات حقيقية وملاحظات المستخدمين، ويحدد مواطن الفشل الفعلية، ويوصي بأقل التغييرات اللازمة، أو يعيد البرومبت كما هو إذا كان يعمل جيدًا.

Tips

  • The source fills this template with the Python format method, so the double braces around variable_name come out as single braces.
  • The source allows up to 5 reflection steps by default and at least 1.