Skip to main content

Prompt Management

MutagenT provides a complete prompt management system with versioning, variables, and lifecycle management. Centralize your prompts, track changes, and optimize performance systematically.

Prompt Lifecycle

Each stage in the lifecycle builds on the previous. Start with a draft, test in the playground, validate with datasets, optimize automatically, and deploy with confidence.

Key Features

Version Control

Track changes with full version history. Compare versions, rollback when needed, and maintain audit trails.

Template Variables

Dynamic content with type-safe variables. Create reusable templates that adapt to different inputs.

Evaluation

Measure quality with automated testing. Use G-Eval, semantic similarity, and custom metrics.

Optimization

Automatically improve prompts through AI-driven mutation and selection cycles.

Prompt Content Types

MutagenT supports three content types when creating a prompt. Use exactly one:
Content TypeFieldsUse Case
Raw PromptrawPromptSingle prompt text with {variables}
System + HumansystemPrompt + humanPromptStructured system instructions paired with a user-facing template
Messages ArrayArray of {role, content} objectsFull chat-format messages (system, user, assistant)

Prompt Structure

interface Prompt {
  id: number;                                // Unique identifier
  name: string;                              // Display name
  description?: string;                      // Optional description
  version: string;                           // Semantic version (e.g., "1.0.0")
  isLatest: boolean;                         // Whether this is the latest version
  systemPrompt?: string;                     // System-level instructions
  humanPrompt?: string;                      // User-facing prompt template
  rawPrompt?: string;                        // Raw prompt text
  inputSchema: Record<string, any>;          // JSON Schema for input variables
  outputSchema?: Record<string, any>;        // JSON Schema for expected output
  metadata?: Record<string, any>;            // Arbitrary metadata
  tags?: string[];                           // Organization tags
  createdBy?: string;                        // Creator email
  createdAt: string;                         // ISO 8601 timestamp
  updatedAt: string;                         // ISO 8601 timestamp
}

Quick Example

import { Mutagent } from '@mutagent/sdk';

const client = new Mutagent({ apiKey: process.env.MUTAGENT_API_KEY });

// Create a prompt with rawPrompt content type
const prompt = await client.prompt.createPrompt({
  name: 'Customer Support',
  rawPrompt: `You are a support agent for {company_name}.

Help the customer with their question:
{customer_question}

Be helpful, professional, and concise.`,
  inputSchema: {
    company_name: { type: 'string' },
    customer_question: { type: 'string' },
  },
  description: 'Main customer support prompt template',
});

console.log('Created prompt:', prompt.id);
The CLI warns if you accidentally use double-brace {{variable}} syntax. MutagenT uses single-brace {variable} syntax for template variables.

Prompt Organization

Organize prompts effectively within your workspace:
Use clear, descriptive names that indicate the prompt’s purpose:
  • customer-support-v1
  • code-review-assistant
  • data-extraction-json
Add descriptions to document:
  • What the prompt does
  • Expected inputs and outputs
  • Any special considerations
Define inputSchema and outputSchema as JSON Schema objects to document expected parameters and responses:
{
  "inputSchema": {
    "customer_name": {"type": "string"},
    "order_id": {"type": "string"}
  },
  "outputSchema": {
    "action": {"type": "string", "enum": ["refund", "replace", "escalate"]},
    "response": {"type": "string"}
  }
}

What’s Next?

Versioning

Learn how to track and manage prompt versions

Variables

Create dynamic prompts with template variables