Skip to main content

Generate Extraction Prompt

warning

A schema must be available before you can generate a prompt.

Once you have a schema (generated or manually defined), prompt generation uses a separate three-agent pipeline to create a complete extraction prompt tailored to your documents.

How It Works

Prompt generation uses a separate three-agent pipeline:

Agent 1: PatternMinerAgent. Examines your sample documents to discover extraction-relevant patterns. It identifies field anchors and labels (e.g., "Account No:", "Invoice Date:", "Total Amount"), formatting conventions (date formats, currency symbols, number separators), and layout patterns (where fields tend to appear in the document).

Agent 2: PromptArchitectAgent. Uses the mined patterns along with the schema and document summaries to construct a comprehensive extraction prompt. The generated prompt follows a structured format that includes a task overview, the output schema, field-specific guidance, disambiguation rules, edge case handling, and output format specifications.

Agent 3: CriticDryRunner. Stress-tests the draft prompt by simulating an extraction. It checks whether the output would be valid JSON, whether it conforms to the schema, and whether the instructions are unambiguous. It identifies potential failure modes and suggests revisions. The final prompt has been vetted for common issues.

Generating a Prompt

img Agentic Prompt Studio

  1. From the Status tab, click Create Prompt.
  2. In the dialog, select an LLM Connector to run the agent pipeline.
  3. Click Generate.

The system generates the prompt and saves it as a new version. The prompt appears in the Extraction Prompt tab.

Viewing the Prompt

The Extraction Prompt tab displays the generated prompt in a code editor. The prompt includes the complete extraction instructions: task overview, schema, field-specific guidance, edge cases, and output format specifications.

The toolbar shows the current version number (e.g., "v1") and provides access to Regenerate, Edit, History, and Compare actions.

To generate a prompt from scratch, click Regenerate. The Regenerate dialog allows you to select a different LLM connector when regenerating. img Agentic Prompt Studio

Editing a Prompt

img Agentic Prompt Studio

  1. Click Edit in the Extraction Prompt toolbar.
  2. Modify the prompt text in the code editor. You can adjust extraction instructions, add field-specific guidance, change edge case rules, or modify formatting requirements.
  3. Click Save to save your changes.
  4. In the Save Prompt Version dialog, enter a Short Description (max 50 chars), a brief label for this version (e.g., "Minor Changes"), and a Long Description (max 255 chars) explaining what changed.
  5. Click Save Version. img Agentic Prompt Studio

Prompt Version History

Every generated or manually saved prompt is stored as a version. Click History in the Extraction Prompt toolbar to open the Prompt Version History dialog.

The history table shows:

ColumnDescription
VersionThe version number (v1, v2, v3, etc.). The current active version is labeled "Current".
Short DescriptionThe label given when the version was saved.
Long DescriptionThe detailed description of changes.
CreatedThe timestamp when the version was created.
AccuracyThe accuracy score for this version (populated after running extraction and calculating accuracy).
ActionsLoad to switch to a different version, or the compare icon to open version comparison.

img Agentic Prompt Studio

Comparing Prompt Versions

Click Compare in the Extraction Prompt toolbar (or the compare icon in Version History) to open the Compare Prompt Versions dialog.

This side-by-side diff view highlights differences between any two prompt versions:

  • Select a Left Version and Right Version from the dropdowns.
  • Lines removed from the left version are highlighted in red.
  • Lines added in the right version are highlighted in green.
  • Unchanged lines appear without highlighting.

This is useful for understanding exactly what changed between an auto-generated prompt and a manually edited version, or between two regenerated versions. img Agentic Prompt Studio