Configuration Schema Validation
PromptKit provides JSON schemas for all configuration file types, enabling automatic validation and IDE support.
Overview
Section titled “Overview”JSON schemas are automatically generated from the PromptKit codebase and provide:
- Validation: Ensure your config files match the expected structure
- IDE Support: Get autocomplete, inline documentation, and error checking
- CI/CD Integration: Validate configs automatically in your pipelines
- Automatic Loading: Configs are validated against schemas when loaded by PromptKit tools
Automatic Validation
Section titled “Automatic Validation”As of version 1.0, PromptKit automatically validates all configuration files against their schemas during loading:
- Arena configs: Validated when
config.LoadConfig()is called - Scenarios: Validated when loading individual scenario files
- Providers: Validated when loading provider configurations
- PromptConfigs: Validated when loading prompt configuration files
- Tools: Validated when loading tool definitions
- Personas: Validated when loading persona files
This means you’ll get immediate, detailed error messages if your configs don’t match the expected structure, making it easier to catch typos and structural issues early.
Available Schemas
Section titled “Available Schemas”All schemas are available at https://promptkit.altairalabs.ai/schemas/.
Using Latest Schemas (Recommended)
Section titled “Using Latest Schemas (Recommended)”The /latest/ path automatically points to the current stable schema version:
| Config Type | Latest Schema URL |
|---|---|
| Arena | https://promptkit.altairalabs.ai/schemas/latest/arena.json |
| Scenario | https://promptkit.altairalabs.ai/schemas/latest/scenario.json |
| Provider | https://promptkit.altairalabs.ai/schemas/latest/provider.json |
| PromptConfig | https://promptkit.altairalabs.ai/schemas/latest/promptconfig.json |
| Tool | https://promptkit.altairalabs.ai/schemas/latest/tool.json |
| Persona | https://promptkit.altairalabs.ai/schemas/latest/persona.json |
| Eval | https://promptkit.altairalabs.ai/schemas/latest/eval.json |
Benefits of using /latest/:
- Automatic updates when new schema versions are released
- No need to update URLs in your config files
- Always get the latest validation rules and field definitions
Versioned Schemas
Section titled “Versioned Schemas”For stability in production or when you need a specific schema version:
| Config Type | Versioned Schema URL |
|---|---|
| Arena | https://promptkit.altairalabs.ai/schemas/v1alpha1/arena.json |
| Scenario | https://promptkit.altairalabs.ai/schemas/v1alpha1/scenario.json |
| Provider | https://promptkit.altairalabs.ai/schemas/v1alpha1/provider.json |
| PromptConfig | https://promptkit.altairalabs.ai/schemas/v1alpha1/promptconfig.json |
| Tool | https://promptkit.altairalabs.ai/schemas/v1alpha1/tool.json |
| Persona | https://promptkit.altairalabs.ai/schemas/v1alpha1/persona.json |
| Eval | https://promptkit.altairalabs.ai/schemas/v1alpha1/eval.json |
Common Schemas
Section titled “Common Schemas”Shared configuration structures:
- Metadata:
https://promptkit.altairalabs.ai/schemas/v1alpha1/common/metadata.json - Assertions:
https://promptkit.altairalabs.ai/schemas/v1alpha1/common/assertions.json - Media:
https://promptkit.altairalabs.ai/schemas/v1alpha1/common/media.json
Using Schemas in Configuration Files
Section titled “Using Schemas in Configuration Files”Add a $schema field at the top of your YAML config:
$schema: https://promptkit.altairalabs.ai/schemas/latest/arena.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Arenametadata: name: my-arenaspec: # ... rest of configTip: Use /latest/ in the $schema URL to automatically get schema updates, while apiVersion remains stable for runtime compatibility.
Arena Configuration
Section titled “Arena Configuration”Recommended file name: config.arena.yaml
$schema: https://promptkit.altairalabs.ai/schemas/latest/arena.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Arenametadata: name: customer-support-arenaspec: scenarios: - file: scenarios/support-ticket.scenario.yaml - file: scenarios/product-inquiry.scenario.yaml
providers: - file: providers/openai.provider.yaml - file: providers/anthropic.provider.yamlScenario Configuration
Section titled “Scenario Configuration”Recommended file name: *.scenario.yaml (e.g., support-ticket.scenario.yaml)
$schema: https://promptkit.altairalabs.ai/schemas/latest/scenario.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Scenariometadata: name: support-ticketspec: id: "support-ticket" task_type: "assistant" description: "Test handling of customer support tickets"
turns: - role: user content: "I need help with my order" assertions: - type: content_includes params: patterns: ["ticket number", "order"]Provider Configuration
Section titled “Provider Configuration”Recommended file name: *.provider.yaml (e.g., openai.provider.yaml)
$schema: https://promptkit.altairalabs.ai/schemas/latest/provider.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Providermetadata: name: openai-gpt4spec: id: "openai-gpt4" type: openai model: gpt-4 defaults: temperature: 0.7 max_tokens: 2000Tool Configuration
Section titled “Tool Configuration”Recommended file name: *.tool.yaml (e.g., search.tool.yaml)
$schema: https://promptkit.altairalabs.ai/schemas/latest/tool.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Toolmetadata: name: searchspec: id: "search" description: "Search for information" input_schema: type: object properties: query: type: string description: "Search query"Persona Configuration
Section titled “Persona Configuration”Recommended file name: *.persona.yaml (e.g., customer.persona.yaml)
$schema: https://promptkit.altairalabs.ai/schemas/latest/persona.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Personametadata: name: curious-customerspec: id: "curious-customer" description: "A curious customer asking detailed questions" traits: - inquisitive - detail-orientedEval Configuration
Section titled “Eval Configuration”Recommended file name: *.eval.yaml (e.g., validate-session.eval.yaml)
$schema: https://promptkit.altairalabs.ai/schemas/latest/eval.jsonapiVersion: promptkit.altairalabs.ai/v1alpha1kind: Evalmetadata: name: validate-customer-support
spec: id: "support-validation" description: "Validate customer support conversation quality"
recording: path: recordings/session-123.recording.json type: session
judge_targets: default: type: openai model: gpt-4o id: quality-judge
assertions: - type: llm_judge params: judge: default criteria: "Was the conversation helpful and professional?" expected: pass
tags: - customer-support - quality-checkVS Code Integration
Section titled “VS Code Integration”Automatic Setup
Section titled “Automatic Setup”If you’re using the PromptKit repository, schema validation is already configured in .vscode/settings.json.
Manual Setup
Section titled “Manual Setup”Add to your workspace or user settings:
{ "yaml.schemas": { "https://promptkit.altairalabs.ai/schemas/latest/arena.json": [ "config.arena.yaml", "*.arena.yaml", "**/arena.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/scenario.json": [ "*.scenario.yaml", "**/scenarios/*.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/provider.json": [ "*.provider.yaml", "**/providers/*.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/promptconfig.json": [ "*.prompt.yaml", "**/prompts/*.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/tool.json": [ "*.tool.yaml", "**/tools/*.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/persona.json": [ "*.persona.yaml", "**/personas/*.yaml" ], "https://promptkit.altairalabs.ai/schemas/latest/eval.json": [ "*.eval.yaml", "**/evals/*.yaml" ] }, "yaml.schemaStore.enable": true, "yaml.validate": true}File Naming Convention: Use typed file extensions for better IDE integration:
- Arena:
config.arena.yaml - Scenarios:
*.scenario.yaml - Providers:
*.provider.yaml - Tools:
*.tool.yaml - Personas:
*.persona.yaml - PromptConfigs:
*.prompt.yaml - Evals:
*.eval.yaml
Features
Section titled “Features”Once configured, VS Code provides:
- Autocomplete: Press
Ctrl+Spaceto see available fields - Inline Documentation: Hover over fields to see descriptions
- Error Checking: Real-time validation with red squiggles
- Quick Fixes: Suggestions for fixing validation errors
Other Editors
Section titled “Other Editors”JetBrains IDEs (IntelliJ, GoLand, PyCharm)
Section titled “JetBrains IDEs (IntelliJ, GoLand, PyCharm)”- Open Settings → Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings
- Click + to add a new mapping
- Enter schema URL:
https://promptkit.altairalabs.ai/schemas/latest/arena.json - Add file patterns:
config.arena.yaml,*.arena.yaml - Repeat for other config types (scenario, provider, tool, persona)
Vim/Neovim
Section titled “Vim/Neovim”Use yaml-language-server with the following config:
require('lspconfig').yamlls.setup { settings = { yaml = { schemas = { ["https://promptkit.altairalabs.ai/schemas/latest/arena.json"] = { "config.arena.yaml", "*.arena.yaml" }, ["https://promptkit.altairalabs.ai/schemas/latest/scenario.json"] = { "*.scenario.yaml", "**/scenarios/*.yaml" }, ["https://promptkit.altairalabs.ai/schemas/latest/provider.json"] = { "*.provider.yaml", "**/providers/*.yaml" }, ["https://promptkit.altairalabs.ai/schemas/latest/tool.json"] = { "*.tool.yaml", "**/tools/*.yaml" }, ["https://promptkit.altairalabs.ai/schemas/latest/persona.json"] = { "*.persona.yaml", "**/personas/*.yaml" }, ["https://promptkit.altairalabs.ai/schemas/latest/eval.json"] = { "*.eval.yaml", "**/evals/*.yaml" }, } } }}Use lsp-mode with yaml-language-server:
(with-eval-after-load 'lsp-mode (add-to-list 'lsp-yaml-schemas '("https://promptkit.altairalabs.ai/schemas/latest/arena.json" . ["config.arena.yaml" "*.arena.yaml"])) (add-to-list 'lsp-yaml-schemas '("https://promptkit.altairalabs.ai/schemas/latest/scenario.json" . ["*.scenario.yaml"])))File Naming Conventions
Section titled “File Naming Conventions”PromptKit uses typed file extensions to improve IDE integration and make file purposes clear:
| Type | Pattern | Example |
|---|---|---|
| Arena | config.arena.yaml | config.arena.yaml |
| Scenario | *.scenario.yaml | support-ticket.scenario.yaml |
| Provider | *.provider.yaml | openai-gpt4.provider.yaml |
| Tool | *.tool.yaml | search.tool.yaml |
| Persona | *.persona.yaml | curious-customer.persona.yaml |
| PromptConfig | *.prompt.yaml | assistant.prompt.yaml |
Why Use Typed Extensions?
Section titled “Why Use Typed Extensions?”- Better IDE Support: Schema stores and language servers can match files by pattern
- Self-Documenting: File purpose is clear from the name
- Easier Navigation: Find all providers with
find . -name "*.provider.yaml" - Backwards Compatible: Old names like
arena.yamlstill work
Migration Example
Section titled “Migration Example”Old structure:
arena.yamlproviders/ openai.yaml anthropic.yamlscenarios/ test1.yaml test2.yamlNew structure:
config.arena.yamlproviders/ openai.provider.yaml anthropic.provider.yamlscenarios/ test1.scenario.yaml test2.scenario.yamlNote: The kind field in each manifest remains the authoritative type indicator at runtime. File naming is primarily for IDE and developer experience.
Command Line Validation
Section titled “Command Line Validation”Using promptarena validate (Recommended)
Section titled “Using promptarena validate (Recommended)”The promptarena CLI includes a built-in validate command that automatically detects config types:
# Validate any config file (auto-detects type from 'kind' field)promptarena validate arena.yamlpromptarena validate scenarios/test.yamlpromptarena validate providers/openai.yaml
# Explicit type specificationpromptarena validate config.yaml --type arena
# Schema-only validation (skip business logic checks)promptarena validate arena.yaml --schema-only
# Verbose error outputpromptarena validate arena.yaml --verboseFeatures:
- Automatic type detection from
kindfield - Schema validation with detailed error messages
- Optional business logic validation for arena configs
- Field path highlighting in error messages
Example output:
Validating arena.yaml as type 'arena'...✅ Schema validation passed for arena.yaml
Running business logic validation...✅ Business logic validation passed
✅ arena.yaml is validUsing ajv-cli
Section titled “Using ajv-cli”Install ajv-cli:
npm install -g ajv-cli ajv-formatsValidate a config file:
ajv validate \ -s https://promptkit.altairalabs.ai/schemas/v1alpha1/arena.json \ -d arena.yaml \ --strict=falseUsing make (in PromptKit repo)
Section titled “Using make (in PromptKit repo)”The PromptKit repository includes Makefile targets:
# Check if schemas are up to datemake schemas-check
# Regenerate schemasmake schemasCI/CD Integration
Section titled “CI/CD Integration”GitHub Actions
Section titled “GitHub Actions”PromptKit includes a schema validation workflow that:
- Validates schemas are up to date with code
- Tests all example configs against their schemas
- Reports validation errors
Example workflow snippet:
- name: Validate configs run: | npm install -g ajv-cli ajv-formats
for file in $(find . -name "arena.yaml"); do ajv validate \ -s https://promptkit.altairalabs.ai/schemas/v1alpha1/arena.json \ -d "$file" \ --strict=false doneGitLab CI
Section titled “GitLab CI”validate:schemas: image: node:20 script: - npm install -g ajv-cli ajv-formats - | for file in $(find . -name "*.yaml"); do # Determine schema based on file location case "$file" in */scenarios/*) schema="scenario" ;; */providers/*) schema="provider" ;; *arena*) schema="arena" ;; *) continue ;; esac
ajv validate \ -s "https://promptkit.altairalabs.ai/schemas/v1alpha1/${schema}.json" \ -d "$file" \ --strict=false donePre-commit Hooks
Section titled “Pre-commit Hooks”Create .pre-commit-config.yaml:
repos: - repo: local hooks: - id: validate-arena-configs name: Validate Arena Configs entry: bash -c 'for f in $(git diff --cached --name-only | grep arena.yaml); do ajv validate -s https://promptkit.altairalabs.ai/schemas/v1alpha1/arena.json -d "$f" --strict=false; done' language: system files: 'arena\.yaml$' pass_filenames: falseSchema Generation
Section titled “Schema Generation”Schemas are automatically generated from the PromptKit Go codebase using reflection.
How It Works
Section titled “How It Works”- The
schema-gentool analyzes Go struct definitions - Generates JSON Schema Draft 7 compatible schemas
- Adds descriptions from Go doc comments
- Includes validation rules from struct tags
Contributing to Schemas
Section titled “Contributing to Schemas”When you modify config structures in the codebase:
- Update struct tags and doc comments:
// ArenaConfig defines the complete arena configurationtype ArenaConfig struct { // Metadata about the arena Metadata Metadata `json:"metadata" jsonschema:"required,description=Arena metadata"`
// List of scenario files to include Scenarios []ScenarioRef `json:"scenarios" jsonschema:"required,minItems=1,description=Scenarios to test"`}- Run
make schemasto regenerate - The CI validates schemas match the code
Troubleshooting
Section titled “Troubleshooting”Schema Not Found (404)
Section titled “Schema Not Found (404)”Ensure you’re using the correct schema URL. All schemas are hosted at:
https://promptkit.altairalabs.ai/schemas/v1alpha1/
Validation Errors
Section titled “Validation Errors”Common issues:
Missing required fields:
Error: must have required property 'metadata'→ Add the metadata field to your config
Invalid type:
Error: must be string→ Check the field type matches the schema (e.g., string vs number)
Additional properties:
Error: must NOT have additional properties→ Remove unknown fields or check for typos
IDE Not Recognizing Schema
Section titled “IDE Not Recognizing Schema”- Ensure the YAML extension is installed (e.g., Red Hat YAML for VS Code)
- Check the
$schemafield is at the top of the file - Verify VS Code settings include the schema mapping
- Reload the window:
Cmd+Shift+P→ “Developer: Reload Window”
Best Practices
Section titled “Best Practices”- Always include
$schema: Makes configs self-documenting - Use schema validation in CI: Catch errors before deployment
- Keep schemas up to date: Run
make schemasafter struct changes - Add descriptions: Document fields in Go struct tags
- Test with examples: Validate example configs in CI