Skip to content

Configuration

The configuration module provides prompt template loading and framework-level configuration. It enables customer-specific prompts to live outside the framework codebase, and supports both YAML and JSON prompt file formats.

Import

import {
  PromptTemplate,
  PromptFormat,
  FrameworkConfig,
  frameworkConfigSchema,
  loadFrameworkPrompts,
} from "@modernpath/agent-framework";

Module Map

graph LR
    FC[FrameworkConfig] -->|validates with| ZS[frameworkConfigSchema]
    FC -->|creates| PT[PromptTemplate]
    LFP[loadFrameworkPrompts] -->|parses config| FC
    LFP -->|returns| PT
    PT -->|loads from| PF["YAML / JSON files"]
    PT -->|renders with| TE["Template Engine"]

Components

PromptTemplate

Loads prompt templates from disk and renders them with a built-in template engine supporting variables, conditionals, iteration, and JSON serialization. Customer-specific prompts are swapped by pointing promptsPath at a different directory.

FrameworkConfig & loadFrameworkPrompts

The FrameworkConfig interface defines the top-level framework configuration structure, validated by a Zod schema. The loadFrameworkPrompts() function bootstraps prompt loading from a validated configuration object.

Quick Start

import { PromptTemplate, loadFrameworkPrompts } from "@modernpath/agent-framework";

// Option 1: Direct usage
const prompts = new PromptTemplate("./prompts");
await prompts.load("yaml");
const rendered = prompts.render("agent.system", { agentName: "IncidentResolver" });

// Option 2: Via framework config
const prompts2 = await loadFrameworkPrompts({
  prompts: { path: "./prompts", format: "yaml" },
});
const systemPrompt = prompts2.render("synthesis.system", {
  context: ragContext,
  telemetry: telemetryData,
});