Manage prompts
Version your prompts, compare revisions, promote environment labels, and fetch labeled versions in code.
neatlogs tracks every prompt revision under improve → prompts, lets you inspect diffs across versions, and routes production traffic safely using environment labels such as production, staging, or development.
How prompts enter neatlogs
| Source | How versions are recorded |
|---|---|
| Your traces | When your app sends a model call, neatlogs captures the prompt under {workflow}/{span_name}_prompt and creates a new Auto-imported version whenever the wording changes. |
| Playground | Open + Prompt in improve → playground, iterate on instructions or variables, then select … → Save as prompt. |
| Langfuse import | Select Import to bring existing prompts from a Langfuse workspace (EU, US, Japan, or HIPAA US). |
| SDK or CLI | Call create_prompt / createPrompt in code or run neatlogs prompts create in the CLI. |
To keep auto-imported prompts cleanly separated by workflow, pass workflow_name in neatlogs.init() or tag spans explicitly with Prompt templates.
Inspect versions and diffs
Select any prompt to inspect its Properties alongside its Versions timeline (newest first):
- Compare two revisions to see removed text in red and added wording in green, or select Restore this version.
- Select Open in Playground to test a version side by side across models or revised instructions.
- Organize prompts with free-form tags, comments, and changelogs.
Label the version your app uses
Under Properties, select Set label to assign production, staging, development, or archived, or enter a Custom label (alphanumeric characters, _, and -, up to 50 characters).
Moving the production label opens Request approval for production promotion so a Project Admin or designated reviewer approves the change before live code fetches the updated revision.
Fetch managed prompts in code
Once labeled, fetch the active revision from your Python or TypeScript application without redeploying:
import os
import neatlogs
neatlogs.init(api_key=os.environ["NEATLOGS_API_KEY"])
prompt = neatlogs.get_prompt("support-system-prompt", label="production")
messages = prompt.compile_messages({"question": "Where is my refund?"})import { getPrompt, init } from 'neatlogs';
await init({ apiKey: process.env.NEATLOGS_API_KEY! });
const prompt = await getPrompt('support-system-prompt', { label: 'production' });
const text = prompt.compile({ question: 'Where is my refund?' });Reads are cached client-side for 60 seconds by default, or you can pin an immutable version (version=3). See Prompt templates and managed prompts for async helpers (aget_prompt) and direct PromptClient cache controls, or neatlogs prompts for CLI automation.
Permissions and boundaries
- Project Member / Admin: Can create, edit, tag, and assign non-production labels, or submit promotion approval requests.
- Project Viewer: Can inspect prompts, diffs, and comment threads cleanly without mutating versions.
- Coding agents: Can inspect history, diff revisions, and propose new versions (
neatlogs prompts create,neatlogs prompts diff), while humans review and approveproductionlabel promotions.
