### Install dependencies Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/README.md Run this command to install the necessary project dependencies. ```bash npm install ``` -------------------------------- ### Install and run a PromptPack Source: https://github.com/altairalabs/promptpack-spec/blob/main/README.md Commands to install the PromptKit CLI tools, initialize a project, and execute a scenario. ```bash npm install -g @altairalabs/promptarena @altairalabs/packc promptarena init my-project --template iot-maintenance-demo cd my-project promptarena run --scenario scenarios/hardware-faults.scenario.yaml ``` -------------------------------- ### Test Documentation Locally Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/VERSIONING.md Command to start the local development server for verification. ```bash npm start # Verify: # - Version switcher works # - Archived docs are accessible # - Links work correctly ``` -------------------------------- ### Start local development server Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/README.md Initiates the local development environment and syncs RFC files. ```bash npm start ``` -------------------------------- ### Set up the development environment Source: https://github.com/altairalabs/promptpack-spec/blob/main/CONTRIBUTING.md Commands to clone the repository, install documentation dependencies, and launch the development server. ```bash # Clone the repository git clone https://github.com/altairalabs/promptpack-spec.git cd promptpack-spec # Install documentation dependencies cd promptpack-docs npm install # Start development server npm start ``` -------------------------------- ### Install PromptKit CLIs Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/promptkit-runtime.md Install the promptarena and packc command-line tools globally via npm. ```bash npm install -g @altairalabs/promptarena @altairalabs/packc ``` -------------------------------- ### Basic Usage Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0000-template.md A simple demonstration of the proposed feature's functionality. ```json { "example": "Show how the feature works" } ``` -------------------------------- ### Install LangChain.js Integration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/integrations.md Install the official LangChain.js package to enable PromptPack support in your project. ```bash npm install @promptpack/langchain ``` -------------------------------- ### Configure Multimodal Media Support Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example configuration for enabling image support with specific constraints. ```json "media": { "enabled": true, "supported_types": ["image"], "image": { "max_size_mb": 20, "allowed_formats": ["jpeg", "png", "webp"], "default_detail": "high", "max_images_per_msg": 5 } } ``` -------------------------------- ### Advanced Usage Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0000-template.md A demonstration of more complex scenarios for the proposed feature. ```json { "example": "Show more complex scenarios" } ``` -------------------------------- ### Complete PromptPack Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/getting-started.md A full example of a PromptPack configuration defining workflows, agents, tools, and fragments. ```json "workflow": { "version": 1, "entry": "collect", "states": { "collect": { "prompt_task": "collector", "description": "Collect and categorize customer feedback", "on_event": { "positive": "analyze", "neutral": "analyze", "negative": "analyze" } }, "analyze": { "prompt_task": "analyzer", "description": "Perform sentiment analysis", "on_event": { "analyzed": "respond" }, "persistence": "persistent" }, "respond": { "prompt_task": "responder", "description": "Draft follow-up response", "on_event": {}, "persistence": "persistent" } } }, "agents": { "entry": "collector", "members": { "collector": { "description": "Collects and categorizes customer feedback through conversation", "tags": ["feedback", "customer-service"], "input_modes": ["text/plain"], "output_modes": ["text/plain"] }, "analyzer": { "description": "Analyzes customer feedback sentiment and extracts key themes", "tags": ["analysis", "sentiment"], "input_modes": ["text/plain"], "output_modes": ["application/json"] }, "responder": { "description": "Drafts personalized follow-up responses to customer feedback", "tags": ["response", "customer-service"], "input_modes": ["text/plain", "application/json"], "output_modes": ["text/plain"] } } }, "tools": { "lookup_customer": { "name": "lookup_customer", "description": "Retrieve customer account information", "parameters": { "type": "object", "properties": { "customer_id": { "type": "string", "description": "Customer account ID" } }, "required": ["customer_id"] } }, "log_feedback": { "name": "log_feedback", "description": "Log customer feedback to the database", "parameters": { "type": "object", "properties": { "customer_id": { "type": "string" }, "sentiment": { "type": "string", "enum": ["positive", "neutral", "negative"] }, "summary": { "type": "string" } }, "required": ["sentiment", "summary"] } } }, "fragments": { "company_context": "{{company}} values every customer interaction. Our goal is to understand, learn, and improve from all feedback.", "response_guidelines": "Be empathetic and professional. Acknowledge the customer's experience. Never be dismissive." } } ``` -------------------------------- ### MultimodalExample Schema Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0004-multimodal-support.md Demonstrates how to structure a multimodal prompt example containing text and media parts. ```json { "examples": [ { "name": "image-analysis", "description": "Basic image analysis", "role": "user", "parts": [ { "type": "text", "text": "What's in this image?" }, { "type": "image", "media": { "file_path": "examples/photo.jpg", "mime_type": "image/jpeg", "detail": "high", "caption": "Sample photo" } } ] } ] } ``` -------------------------------- ### Define Prompt Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a prompt definition including system template, variables, tools, and generation parameters. ```json "prompts": { "support": { "id": "support", "name": "Support Bot", "version": "1.0.0", "system_template": "You are a {{role}} assistant for {{company}}.\n\nHelp resolve their issue.", "variables": [ { "name": "role", "type": "string", "required": true, "example": "support agent" }, { "name": "company", "type": "string", "required": true, "default": "TechCo" } ], "tools": ["lookup_order", "create_ticket"], "parameters": { "temperature": 0.7, "max_tokens": 1500 } } } ``` -------------------------------- ### PromptPack Compilation Metadata Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/file-format.md Example of the compilation metadata included in a PromptPack file. ```json { "compilation": { "compiled_with": "packc-v1.0.0", "created_at": "2025-10-31T12:00:00Z", "schema": "v1" } } ``` -------------------------------- ### CI/CD Build Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/scripts/README.md Example GitHub Actions step for building documentation, relying on the prebuild hook to sync RFCs. ```yaml - name: Build documentation run: | cd promptpack-docs npm ci npm run build # sync-rfcs runs via prebuild hook ``` -------------------------------- ### Version Badge Examples Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/VERSIONING.md Markdown snippets for displaying version badges and information boxes. ```markdown v1.1 · current :::info Version Information This documentation covers **v1.1** of the PromptPack specification. Looking for the previous version? [View v1.0 docs →](./v1.0/overview) ::: ``` ```markdown v1.0 · stable :::warning Archived Version This is the **v1.0** documentation. For the latest features, see [v1.1 docs →](../overview) ::: ``` -------------------------------- ### State Parameter Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0005-workflow-extension.md Example of defining parameters within a state to modify prompt behavior. ```json { "planning": { "prompt_task": "planning", "parameters": { "detail_level": "high" } } } ``` -------------------------------- ### Local Development and Production Build Commands Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/scripts/README.md Commands for starting the development server or building the production site, which trigger the sync process. ```bash cd promptpack-docs npm start # Syncs RFCs, then starts dev server ``` ```bash cd promptpack-docs npm build # Syncs RFCs, then builds static site ``` -------------------------------- ### Define PromptPack YAML Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/processes/contributing.md Example of a valid PromptPack YAML configuration file following project standards. ```yaml # Good: Clear, complete, realistic apiVersion: v1 kind: PromptPack metadata: name: customer-support version: 1.0.0 description: Customer support automation system spec: prompts: - name: greeting template: "Hello {{customer_name}}, how can I help you?" variables: - name: customer_name type: string required: true ``` -------------------------------- ### Conceptual CLI commands for PromptPack Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/community-tools.md Example commands for validating, linting, and initializing PromptPack files using a hypothetical CLI tool. ```bash # What could exist (doesn't exist yet) promptpack validate my-file.promptpack.yml promptpack lint --fix my-file.promptpack.yml promptpack init --template basic ``` -------------------------------- ### Define WorkflowBudget in JSON Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example configuration showing the engine budget settings within a workflow definition. ```json "workflow": { "version": 1, "entry": "plan", "states": { "plan": { "prompt_task": "plan", "on_event": { "PlanReady": "implement" } }, "implement": { "prompt_task": "implement", "max_visits": 5, "on_max_visits": "review", "artifacts": { "commit_sha": { "type": "text/plain", "description": "Latest commit" }, "test_report": { "type": "application/json", "description": "Test runner output" } }, "on_event": { "CodeReady": "test" } }, "test": { "prompt_task": "run_tests", "on_event": { "TestsFailed": "implement", "TestsPassed": "done" } }, "review": { "prompt_task": "review", "terminal": true }, "done": { "prompt_task": "summarize", "terminal": true } }, "engine": { "budget": { "max_total_visits": 50, "max_tool_calls": 200, "max_wall_time_sec": 600 } } } ``` -------------------------------- ### Multi-Prompt Pack Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0002-yaml-format.md Examples of individual prompt configurations that reference fragments, intended for compilation into a single pack. ```yaml apiVersion: promptkit.altairalabs.ai/v1alpha1 kind: PromptConfig metadata: name: support version: 1.0.0 spec: system_template: | {{fragments.greeting}} You are a support agent. variables: - name: company type: string required: true ``` ```yaml apiVersion: promptkit.altairalabs.ai/v1alpha1 kind: PromptConfig metadata: name: sales version: 1.0.0 spec: system_template: | {{fragments.greeting}} You are a sales representative. variables: - name: company type: string required: true ``` -------------------------------- ### GitHub Actions Integration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/promptkit-runtime.md Configuration examples for using promptarena and packc within GitHub Actions workflows. ```yaml - uses: AltairaLabs/PromptKit/.github/actions/promptarena-action@v1 with: scenario: scenarios/regression.scenario.yaml ``` ```yaml - uses: AltairaLabs/PromptKit/.github/actions/packc-action@v1 with: config: config.arena.yaml output: dist/app.pack.json ``` -------------------------------- ### Define a Tool with JSON Schema Parameters Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a tool definition including name, description, and parameter schema with required fields. ```json "tools": { "create_ticket": { "name": "create_ticket", "description": "Create a support ticket with title, description, and priority", "parameters": { "type": "object", "properties": { "title": { "type": "string", "description": "Ticket title" }, "priority": { "type": "string", "enum": ["low", "medium", "high", "urgent"] } }, "required": ["title"] } } } ``` -------------------------------- ### Define a PromptPack Workflow Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a state-machine workflow configuration defining entry points, states, and event-driven transitions. ```json "workflow": { "version": 1, "entry": "triage", "states": { "triage": { "prompt_task": "triage", "description": "Route incoming requests to the appropriate specialist", "on_event": { "billing": "billing_support", "technical": "tech_support", "resolved": "closing" } }, "billing_support": { "prompt_task": "billing", "on_event": { "resolved": "closing", "escalate": "human_handoff" }, "persistence": "persistent" }, "tech_support": { "prompt_task": "technical", "on_event": { "resolved": "closing", "escalate": "human_handoff" }, "persistence": "persistent" }, "closing": { "prompt_task": "closing", "on_event": {}, "orchestration": "internal" }, "human_handoff": { "prompt_task": "handoff", "on_event": {}, "orchestration": "external" } } } ``` -------------------------------- ### Complete Document Analyzer Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/guides/add-composition.md A full PromptPack definition demonstrating classification and conditional routing using composition steps. ```json { "$schema": "https://promptpack.org/schema/v1.5.0/promptpack.schema.json", "id": "document-analyzer", "name": "Document Analyzer", "version": "1.0.0", "template_engine": { "version": "v1", "syntax": "{{variable}}" }, "prompts": { "doc_classifier": { "id": "doc_classifier", "name": "Classifier", "version": "1.0.0", "system_template": "Classify the document. Return JSON: { \"type\": \"research_paper\" | \"general\" }.\n\n{{input}}", "parameters": { "temperature": 0.0 } }, "research_paper_extractor": { "id": "research_paper_extractor", "name": "Paper Extractor", "version": "1.0.0", "system_template": "Extract title, authors, abstract, findings.\n\n{{input}}", "parameters": { "temperature": 0.2 } }, "general_doc_extractor": { "id": "general_doc_extractor", "name": "General Extractor", "version": "1.0.0", "system_template": "Extract a summary and main entities.\n\n{{input}}", "parameters": { "temperature": 0.2 } } }, "workflow": { "version": 1, "entry": "main", "states": { "main": { "orchestration": "composition", "composition": "analyze_document", "terminal": true } } }, "compositions": { "analyze_document": { "version": 1, "description": "Classify a document and route to a type-specific analyzer.", "steps": [ { "id": "classify", "kind": "prompt", "prompt_task": "doc_classifier", "input": "${input.text}" }, { "id": "route", "kind": "branch", "predicate": { "path": "${classify.output.type}", "op": "equals", "value": "research_paper" }, "then": "extract_paper", "else": "extract_general" }, { "id": "extract_paper", "kind": "prompt", "prompt_task": "research_paper_extractor", "input": "${input.text}" }, { "id": "extract_general", "kind": "prompt", "prompt_task": "general_doc_extractor", "input": "${input.text}" } ] } } } ``` -------------------------------- ### Extended Tool Policy Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md A proposed JSON structure for adding loop semantics to the existing tool_policy configuration. ```json { "tool_policy": { "max_rounds": 50, "on_error": "retry", "result_bindings": { "run_tests.output": "artifacts.test_results" } } } ``` -------------------------------- ### Add media configuration to existing PromptPack Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0004-multimodal-support.md Example of enabling media support within an existing prompt definition while maintaining backward compatibility. ```json { "prompts": { "existing-prompt": { "system_template": "...", // Add media configuration "media": { "enabled": true, "supported_types": ["image"] } } } } ``` -------------------------------- ### Define a session-bound variable Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a variable configured to automatically populate from the session context. ```json { "name": "user_id", "type": "string", "required": true, "binding": { "kind": "session", "field": "user_id", "auto_populate": true } } ``` -------------------------------- ### Complete PromptPack Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/getting-started.md A full example of a PromptPack JSON file integrating template engines, LLM-based evaluations, and multiple prompt definitions with validators. ```json { "$schema": "https://promptpack.org/schema/latest/promptpack.schema.json", "id": "feedback-system", "name": "Customer Feedback System", "version": "1.4.0", "description": "Complete customer feedback collection, analysis, and response system", "template_engine": { "version": "v1", "syntax": "{{variable}}", "features": ["basic_substitution", "fragments"] }, "evals": [ { "id": "empathy-score", "description": "Monitors empathy level across all customer-facing responses", "type": "llm_judge", "trigger": "sample_turns", "sample_percentage": 20, "metric": { "name": "promptpack_empathy_score", "type": "gauge", "range": { "min": 1, "max": 5 } }, "params": { "judge_prompt": "Rate the empathy level of this customer interaction from 1 (cold/robotic) to 5 (warm/genuinely caring).", "model": "gpt-4o", "passing_score": 4 } } ], "prompts": { "collector": { "id": "collector", "name": "Feedback Collector", "version": "1.0.0", "system_template": "You are a feedback collector for {{company}}.\n\n{{fragments.company_context}}\n\n{{fragments.response_guidelines}}\n\nAsk about their experience and categorize feedback as positive, neutral, or negative.", "variables": [ { "name": "company", "type": "string", "required": true, "example": "Acme Corp" } ], "tools": ["lookup_customer", "log_feedback"], "parameters": { "temperature": 0.7, "max_tokens": 300 }, "validators": [ { "type": "banned_words", "enabled": true, "fail_on_violation": true, "params": { "words": ["don't care", "not my problem", "deal with it"] } }, { "type": "pii_detection", "enabled": true, "fail_on_violation": true } ] }, "analyzer": { "id": "analyzer", "name": "Sentiment Analyzer", "version": "1.0.0", "system_template": "You are a sentiment analysis specialist for {{company}}.\n\nAnalyze the customer feedback and return a JSON object with: sentiment (positive/neutral/negative), confidence (0-1), key_themes (array), and suggested_action.", "variables": [ { "name": "company", "type": "string", "required": true } ], "parameters": { "temperature": 0.2, "max_tokens": 500 }, "evals": [ { "id": "classification-accuracy", "description": "Checks whether sentiment classification matches the feedback content", "type": "llm_judge", "trigger": "every_turn", "metric": { "name": "promptpack_classification_accuracy", "type": "boolean" }, "params": { "judge_prompt": "Does the sentiment classification accurately reflect the customer's feedback? Answer true or false.", "model": "gpt-4o" } } ] }, "responder": { "id": "responder", "name": "Response Drafter", "version": "1.0.0", "system_template": "You are a customer response specialist for {{company}}.\n\n{{fragments.response_guidelines}}\n\nDraft a personalized follow-up response based on the feedback analysis.", "variables": [ { "name": "company", "type": "string", "required": true } ], "parameters": { "temperature": 0.6, "max_tokens": 500 } } } } ``` -------------------------------- ### Create a feature branch Source: https://github.com/altairalabs/promptpack-spec/blob/main/CONTRIBUTING.md Use this command to create and switch to a new branch for your documentation or example improvements. ```bash git checkout -b improve-examples ``` -------------------------------- ### Define Skills in PromptPack Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example showing the three supported formats for defining skills: string path, path object with preload, and inline skill definition. ```json "skills": [ "./skills/billing", { "path": "./skills/compliance", "preload": true }, { "name": "escalation-protocol", "description": "Steps for escalating unresolved customer issues", "instructions": "When a customer issue cannot be resolved within 3 exchanges:\n1. Acknowledge the complexity\n2. Collect case details\n3. Create an escalation ticket\n4. Provide the ticket reference to the customer" } ] ``` -------------------------------- ### PromptPack JSON Structure Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/file-format.md Example of a standard PromptPack definition file, including metadata, template engine configuration, and prompt definitions. ```json { "id": "customer-support", "name": "Customer Support Pack", "version": "1.0.0", "template_engine": { "version": "v1", "syntax": "{{variable}}" }, "prompts": { "support": { "id": "support", "name": "Customer Support", "version": "1.0.0", "system_template": "You are a helpful {{role}} for {{company}}.", "variables": [ { "name": "role", "type": "string", "required": true, "description": "The assistant's role" } ] } } } ``` -------------------------------- ### Define Agents Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of an agents configuration object defining an entry point and multiple member agents with their respective metadata. ```json "agents": { "entry": "triage", "members": { "triage": { "description": "Routes customer requests to the right specialist", "tags": ["router", "customer-service"], "input_modes": ["text/plain"], "output_modes": ["text/plain"] }, "billing": { "description": "Handles billing inquiries and payment issues", "tags": ["billing", "payments"], "input_modes": ["text/plain"], "output_modes": ["text/plain", "application/json"] }, "technical": { "description": "Provides technical troubleshooting assistance", "tags": ["support", "technical"] } } } ``` -------------------------------- ### Define Evals in PromptPack Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example configuration showing both a structural validation eval and an LLM-based scoring eval. ```json "evals": [ { "id": "json_format", "type": "json_valid", "trigger": "every_turn", "description": "Verify the assistant always returns valid JSON", "metric": { "name": "promptpack_json_valid", "type": "boolean" } }, { "id": "tone-check", "type": "llm_judge", "trigger": "sample_turns", "sample_percentage": 10, "params": { "judge_prompt": "Rate the response tone on a 1-5 scale for professionalism.", "model": "gpt-4o", "passing_score": 4 }, "metric": { "name": "promptpack_tone_score", "type": "gauge", "range": { "min": 1, "max": 5 } } } ] ``` -------------------------------- ### PromptPack Workflow Schema Structure Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0005-workflow-extension.md Example of the top-level JSON structure incorporating the new optional workflow section. ```json { "$schema": "https://promptpack.org/schema/v1/promptpack.schema.json", "id": "example-pack", "name": "Example Pack", "version": "1.0.0", "template_engine": { ... }, "prompts": { ... }, "workflow": { "version": 1, "entry": "initial_state", "states": { ... } } } ``` -------------------------------- ### Define a Multi-Prompt Pack Structure Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/structure.md Example of a JSON structure containing multiple specialized prompts within a single pack. ```json { "id": "customer-support", "name": "Customer Support Pack", "version": "1.0.0", "prompts": { "support": { /* optimized for general support */ }, "sales": { /* tuned for sales conversations */ }, "technical": { /* focused on troubleshooting */ }, "billing": { /* handles payment issues */ } } } ``` -------------------------------- ### Define Pack and Prompt Level Evaluations Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/guides/add-evals.md A complete configuration example showing pack-level evals for brand voice and safety, alongside a prompt-specific evaluation for conversion quality. ```json { "id": "quality-monitored-pack", "name": "Quality-Monitored Support", "version": "1.2.0", "template_engine": { "version": "v1", "syntax": "{{variable}}" }, "evals": [ { "id": "brand-voice", "description": "Cross-cutting brand voice consistency check", "type": "cosine_similarity", "trigger": "on_session_complete", "metric": { "name": "promptpack_brand_voice", "type": "gauge", "range": { "min": 0, "max": 1 } }, "params": { "reference_embeddings": "brand_voice_v2", "threshold": 0.85 } }, { "id": "safety-audit", "description": "Sampled safety review across all prompts", "type": "llm_judge", "trigger": "sample_turns", "sample_percentage": 10, "metric": { "name": "promptpack_safety_violations", "type": "counter" }, "params": { "judge_prompt": "Review the response for safety concerns: PII leakage, unauthorized commitments, inappropriate content. Return violation count.", "model": "gpt-4o" } } ], "prompts": { "support": { "id": "support", "name": "General Support", "version": "1.0.0", "system_template": "You are a support agent for {{company}}. Help resolve customer issues.", "variables": [ { "name": "company", "type": "string", "required": true } ], "validators": [ { "type": "toxicity", "enabled": true, "fail_on_violation": true, "params": { "threshold": 0.8 } } ] }, "sales": { "id": "sales", "name": "Sales Assistant", "version": "1.0.0", "system_template": "You are a sales assistant for {{company}}. Help customers find the right product.", "variables": [ { "name": "company", "type": "string", "required": true } ], "parameters": { "temperature": 0.8 }, "evals": [ { "id": "conversion-quality", "description": "Checks whether responses include clear calls to action", "type": "llm_judge", "trigger": "every_turn", "metric": { "name": "promptpack_conversion_quality", "type": "gauge", "range": { "min": 1, "max": 5 } }, "params": { "judge_prompt": "Rate 1-5 whether the response includes a clear, non-pushy call to action.", "model": "gpt-4o", "passing_score": 3 } } ] } } } ``` -------------------------------- ### Dedicated Loop Construct Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md A proposed JSON structure for a dedicated loop block within a workflow. ```json { "loop": { "entry": "implement", "max_iterations": 10, "exit_condition": "tests_pass", "states": { "..." } } } ``` -------------------------------- ### Top-Level Artifacts Declaration Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md A proposed JSON structure for declaring artifacts at the pack level instead of per-state. ```json { "artifacts": { "code": { "type": "text/plain" }, "test_results": { "type": "application/json" } } } ``` -------------------------------- ### Document Review Pipeline Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/examples.md A complete configuration example defining a document review pipeline with integrated evaluation metrics, prompt templates, validators, and tool definitions. ```json { "id": "document-review-pipeline", "name": "Document Review Pipeline", "version": "1.2.0", "description": "Document processing with validators for safety and evals for quality monitoring", "template_engine": { "version": "v1", "syntax": "{{variable}}", "features": ["basic_substitution", "fragments"] }, "evals": [ { "id": "brand-voice", "description": "Checks that all outputs align with corporate communication guidelines", "type": "cosine_similarity", "trigger": "on_session_complete", "metric": { "name": "promptpack_brand_voice_score", "type": "gauge", "range": { "min": 0, "max": 1 } }, "params": { "reference_embeddings": "corporate_style_guide_v3", "threshold": 0.85 } }, { "id": "structure-check", "description": "Validates that outputs conform to expected JSON structure", "type": "json_valid", "trigger": "every_turn", "metric": { "name": "promptpack_structure_valid", "type": "boolean" } } ], "prompts": { "summarizer": { "id": "summarizer", "name": "Document Summarizer", "version": "1.0.0", "system_template": "You are a document summarizer for {{company}}.\n\nSummarize the following document in {{format}} format.\n\n{{fragments.output_standards}}", "variables": [ { "name": "company", "type": "string", "required": true }, { "name": "format", "type": "string", "required": true, "example": "bullet-point" } ], "parameters": { "temperature": 0.3, "max_tokens": 1000 }, "validators": [ { "type": "max_length", "enabled": true, "fail_on_violation": true, "params": { "max_characters": 5000 } } ] }, "risk_analyzer": { "id": "risk_analyzer", "name": "Risk Analyzer", "version": "1.1.0", "system_template": "You are a risk analysis specialist for {{company}}.\n\nAnalyze the document for regulatory, financial, and operational risks.\n\nReturn a JSON object with risk_level, findings, and recommendations.\n\n{{fragments.output_standards}}", "variables": [ { "name": "company", "type": "string", "required": true } ], "tools": ["compliance_db_lookup", "precedent_search"], "parameters": { "temperature": 0.2, "max_tokens": 2000 }, "validators": [ { "type": "pii_detection", "enabled": true, "fail_on_violation": true } ], "evals": [ { "id": "risk-accuracy", "description": "LLM judge checks whether identified risks are substantiated by the source document", "type": "llm_judge", "trigger": "every_turn", "metric": { "name": "promptpack_risk_accuracy", "type": "gauge", "range": { "min": 1, "max": 5 } }, "params": { "judge_prompt": "Rate 1-5 whether each identified risk is clearly supported by evidence in the source document.", "model": "gpt-4o", "passing_score": 4 } } ] }, "drafter": { "id": "drafter", "name": "Response Drafter", "version": "1.0.0", "system_template": "You are a professional response drafter for {{company}}.\n\nDraft a {{response_type}} based on the analysis provided.\n\n{{fragments.output_standards}}", "variables": [ { "name": "company", "type": "string", "required": true }, { "name": "response_type", "type": "string", "required": true, "example": "client letter" } ], "parameters": { "temperature": 0.5, "max_tokens": 3000 } } }, "tools": { "compliance_db_lookup": { "name": "compliance_db_lookup", "description": "Search the regulatory compliance database", "parameters": { "type": "object", "properties": { "regulation": { "type": "string" }, "jurisdiction": { "type": "string" } }, "required": ["regulation"] } }, "precedent_search": { "name": "precedent_search", "description": "Search for relevant legal precedents", "parameters": { "type": "object", "properties": { "query": { "type": "string" }, "date_range": { "type": "string" } }, "required": ["query"] } } }, "fragments": { "output_standards": "Follow corporate communication standards. Be precise, cite sources, and avoid speculation." } } ``` -------------------------------- ### Define LLM generation parameters Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example configuration for controlling model behavior using temperature, token limits, and nucleus sampling. ```json "parameters": { "temperature": 0.7, "max_tokens": 1500, "top_p": 0.9 } ``` -------------------------------- ### Define Backward-Compatible Workflow Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md Example of a version 1 workflow configuration that remains valid without new features. ```yaml workflow: version: 1 entry: intake states: intake: prompt_task: intake on_event: RequirementsGathered: planning persistence: transient planning: prompt_task: planning on_event: PlanReady: execution persistence: persistent ``` -------------------------------- ### Imperative Loop DSL Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md A proposed JSON structure for adding loop primitives like while loops directly into workflow states. ```json { "states": { "implement": { "while": "tests_failing", "do": ["write_code", "run_tests"], "max_iterations": 10 } } } ``` -------------------------------- ### Environment Configuration with Variables Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/file-format.md Demonstrates how to define system templates and variables to allow for runtime configuration across different environments. ```json { "prompts": { "support": { "system_template": "You work for {{company_name}} in {{environment}}.", "variables": [ { "name": "company_name", "type": "string", "required": true }, { "name": "environment", "type": "string", "default": "production" } ] } } } ``` -------------------------------- ### Example Artifact Trace for Codegen Loop Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0009-agent-loops.md A visual representation of artifact values captured at each state transition during a codegen workflow. ```text Transition │ Event │ commit_sha │ test_report │ ──────────────────┼──────────────┼────────────┼─────────────┤ → plan │ (entry) │ — │ — │ → implement (1) │ PlanReady │ — │ — │ → test (1) │ CodeReady │ abc123 │ — │ → implement (2) │ TestsFailed │ abc123 │ 2/5 pass │ → test (2) │ CodeReady │ def456 │ 2/5 pass │ → review │ TestsPassed │ def456 │ 5/5 pass │ → done │ Approved │ def456 │ 5/5 pass │ ``` -------------------------------- ### Define Workflow Artifacts Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of defining named artifact slots for structured metadata that persists across state visits. ```json "artifacts": { "commit_sha": { "type": "text/plain", "description": "Latest generated commit" }, "test_report": { "type": "application/json", "description": "Test runner summary" }, "iteration_log": { "type": "text/plain", "mode": "append", "description": "Per-visit log accumulated across the loop" } } ``` -------------------------------- ### Using promptarena CLI Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/promptkit-runtime.md Common commands for initializing projects, inspecting configurations, running scenarios, and viewing results. ```bash # Scaffold a project from a template promptarena init my-project --template iot-maintenance-demo # Inspect resolved config promptarena config-inspect # Run a scenario across providers promptarena run --scenario scenarios/hardware-faults.scenario.yaml # Red-team / self-play scenarios promptarena run --scenario scenarios/redteam-selfplay.scenario.yaml # Launch the local results viewer promptarena view ``` -------------------------------- ### Define Validator Configurations Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a JSON array defining multiple validator rules, including banned word filtering and PII detection. ```json "validators": [ { "type": "banned_words", "enabled": true, "fail_on_violation": true, "params": { "words": ["impossible", "can't help"] } }, { "type": "pii_detection", "enabled": true, "fail_on_violation": true } ] ``` -------------------------------- ### Workflow Metadata Definition Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0005-workflow-extension.md Example of the workflow structure including versioning and metadata fields. ```json { "workflow": { "version": 1, "entry": "sparring", "metadata": { "analytics_id": "workflow-v1", "workflow_version": "2.1.0" }, "states": { ... } } } ``` -------------------------------- ### Deploy documentation Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/README.md Commands for deploying the site to GitHub Pages, with or without SSH configuration. ```bash USE_SSH=true npm run deploy ``` ```bash GIT_USER= npm run deploy ``` -------------------------------- ### Variable Validation Rules Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0003-template-variables.md Example of applying string validation constraints to a variable definition. ```json { "name": "email", "type": "string", "required": true, "validation": { "pattern": "^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$", "min_length": 5, "max_length": 100 } } ``` -------------------------------- ### Define a validated variable with enum Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/schema-guide.md Example of a variable using an enum validation rule to restrict input to specific allowed values. ```json { "name": "priority", "type": "string", "required": true, "description": "Support ticket priority level", "validation": { "enum": ["low", "medium", "high", "urgent"] } } ``` -------------------------------- ### Declare Prometheus Metric Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/guides/add-evals.md Example of defining a gauge metric within the evaluation configuration. ```json { "metric": { "name": "promptpack_tone_score", "type": "gauge", "range": { "min": 1, "max": 5 } } } ``` -------------------------------- ### Configure PromptConfig in YAML Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0004-multimodal-support.md Demonstrates the equivalent configuration using the YAML format for a vision assistant. ```yaml apiVersion: promptkit.altairalabs.ai/v1alpha1 kind: PromptConfig metadata: name: vision-assistant version: 1.0.0 spec: system_template: "You are an expert image analyst." media: enabled: true supported_types: - image image: max_size_mb: 10 allowed_formats: - jpeg - png - webp default_detail: high examples: - name: simple-analysis role: user parts: - type: text text: "What's in this image?" - type: image media: file_path: examples/photo.jpg mime_type: image/jpeg detail: high ``` -------------------------------- ### Update Sidebar Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/VERSIONING.md Example configuration for adding archived versions to the Docusaurus sidebar. ```typescript { type: 'category', label: 'Archive', collapsed: true, items: [ { type: 'category', label: 'v1.1', collapsed: true, items: [ 'spec/v1.1/overview', 'spec/v1.1/examples', // ... other v1.1 docs ], }, // ... older versions ], } ``` -------------------------------- ### Configure Optional Media Support Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0004-multimodal-support.md Demonstrates how to define prompts with or without media support within the prompt configuration. ```json { "prompts": { "text-only": { "system_template": "Text-only prompt", // No media field }, "vision": { "system_template": "Vision prompt", "media": { "enabled": true, "supported_types": ["image"] } } } } ``` -------------------------------- ### Kubernetes ConfigMap Configuration Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/spec/file-format.md Example of embedding a PromptPack JSON structure within a Kubernetes ConfigMap. ```yaml # Kubernetes ConfigMap apiVersion: v1 kind: ConfigMap metadata: name: ai-packs data: customer-support.json: | { "id": "customer-support", "version": "1.0.0", ... } ``` -------------------------------- ### Configure Sampling Trigger Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/guides/add-evals.md Example of an evaluation configuration using a sampling trigger with a defined percentage. ```json { "id": "safety-audit", "type": "llm_judge", "trigger": "sample_turns", "sample_percentage": 10, "metric": { "name": "promptpack_safety_violations", "type": "counter" }, "params": { "judge_prompt": "Review the response for safety concerns. Return the count of violations.", "model": "gpt-4o" } } ``` -------------------------------- ### Configure Multi-Prompt Architecture Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0001-core-schema.md Demonstrates how to define multiple specialized prompts within a single pack using the prompts map. ```json { "prompts": { "support": { "system_template": "..." }, "sales": { "system_template": "..." }, "technical": { "system_template": "..." } } } ``` -------------------------------- ### Validate PromptPack with ajv-cli Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/ecosystem/community-tools.md Install the ajv-cli tool and use it to validate a PromptPack file against the official schema. ```bash # Install ajv-cli npm install -g ajv-cli # Validate a PromptPack file ajv validate \ -s schema/promptpack.schema.json \ -d my-file.promptpack.yml ``` -------------------------------- ### Variable Definition Schema Source: https://github.com/altairalabs/promptpack-spec/blob/main/rfcs/0003-template-variables.md Example JSON structure for defining variables with metadata, types, and validation rules. ```json { "variables": [ { "name": "customer_name", "type": "string", "required": true, "description": "Customer's full name", "example": "John Doe" }, { "name": "priority", "type": "string", "required": false, "default": "medium", "validation": { "enum": ["low", "medium", "high", "urgent"] } } ] } ``` -------------------------------- ### Correct Skill Definition Example Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/docs/guides/add-skills.md Skills should contain descriptive instructions and domain expertise rather than code. ```json { "name": "billing-policy", "instructions": "For premium customers, apply a 20% discount on service fees." } ``` -------------------------------- ### Build static site Source: https://github.com/altairalabs/promptpack-spec/blob/main/promptpack-docs/README.md Generates the static website files in the build directory. ```bash npm run build ```