Skip to main content
All prompt operations are available under the tracia.prompts namespace.
import { Tracia } from 'tracia';

const tracia = new Tracia({ apiKey: process.env.TRACIA_API_KEY });

// Run a prompt
const result = await tracia.prompts.run('welcome-email', { name: 'Alice' });

// List all prompts
const { prompts } = await tracia.prompts.list();

// Get a single prompt
const prompt = await tracia.prompts.get('welcome-email');

// Create a prompt
const newPrompt = await tracia.prompts.create({ name: 'My Prompt', content: [...] });

// Update a prompt
const updated = await tracia.prompts.update('welcome-email', { name: 'New Name' });

// Delete a prompt
await tracia.prompts.delete('welcome-email');

Available Methods

Types

Prompt

interface Prompt {
  id: string;
  slug: string;
  name: string;
  description: string | null;
  model: string | null;
  modelConfigurationId: string | null;
  currentVersion: number;
  content: PromptMessage[];
  variables: string[];
  createdAt: string;
  updatedAt: string;
}

PromptMessage

interface PromptMessage {
  id: string;
  role: 'system' | 'user' | 'assistant';
  content: string;
}

PromptListItem

interface PromptListItem {
  id: string;
  slug: string;
  name: string;
  description: string | null;
  model: string | null;
  currentVersion: number;
  variables: string[];
  createdAt: string;
  updatedAt: string;
}