Skip to content

Compile Packs

Compile YAML prompt configurations into production-ready pack files.

Transform your arena.yaml configuration or individual prompt files into optimized .pack.json files ready for use with the PromptKit SDK.

  • packc installed (installation guide)
  • Prompt configuration files (arena.yaml or individual .yaml files)
  • Basic understanding of pack structure
Section titled “Method 1: Compile from arena.yaml (Recommended)”

This is the standard approach for production packs.

  1. Prepare your arena.yaml

    # config/arena.yaml
    prompts:
    - prompts/support.yaml
    - prompts/sales.yaml
    - prompts/marketing.yaml
    tools_directory: ./tools
  2. Run the compile command

    Terminal window
    packc compile \
    --config config/arena.yaml \
    --output packs/customer-service.pack.json \
    --id customer-service
  3. Verify the output

    Terminal window
    ls -lh packs/customer-service.pack.json
    packc inspect packs/customer-service.pack.json
Loaded 3 prompt configs from memory repository
Compiling 3 prompts into pack 'customer-service'...
✓ Pack compiled successfully: packs/customer-service.pack.json
Contains 3 prompts: [support, sales, marketing]

For individual prompt development or testing.

  1. Create a prompt file

    # prompts/support.yaml
    apiVersion: promptkit.altairalabs.ai/v1alpha1
    kind: PromptConfig
    spec:
    task_type: customer-support
    name: Customer Support Agent
    system_prompt: |
    You are a helpful customer support agent.
    user_template: |
    Customer:
  2. Compile the prompt

    Terminal window
    packc compile-prompt \
    --prompt prompts/support.yaml \
    --output packs/support.pack.json
  3. Verify compilation

    Terminal window
    packc validate packs/support.pack.json
Terminal window
# Development
packc compile \
--config config/arena.dev.yaml \
--output packs/app-dev.pack.json \
--id app-dev
# Staging
packc compile \
--config config/arena.staging.yaml \
--output packs/app-staging.pack.json \
--id app-staging
# Production
packc compile \
--config config/arena.prod.yaml \
--output packs/app-prod.pack.json \
--id app-prod
Terminal window
VERSION="1.2.0"
packc compile \
--config arena.yaml \
--output "packs/app-v${VERSION}.pack.json" \
--id app
# Also create latest symlink
ln -sf "app-v${VERSION}.pack.json" packs/app-latest.pack.json
#!/bin/bash
# build-all-packs.sh
for config in config/*.yaml; do
name=$(basename "$config" .yaml)
echo "Building pack: $name"
packc compile \
--config "$config" \
--output "packs/${name}.pack.json" \
--id "$name"
done
#!/bin/bash
set -e
echo "Compiling packs..."
packc compile --config arena.yaml --output packs/app.pack.json --id app
echo "Validating pack..."
packc validate packs/app.pack.json
echo "Inspecting pack..."
packc inspect packs/app.pack.json
echo "✓ Build complete"
Terminal window
mkdir -p packs/{dev,staging,prod}
# Compile to environment directories
packc compile \
--config config/arena.prod.yaml \
--output packs/prod/app.pack.json \
--id app
Terminal window
# Create build info
cat > packs/build-info.txt <<EOF
Build: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
Compiler: $(packc version)
Git Commit: $(git rev-parse --short HEAD)
Branch: $(git branch --show-current)
EOF
# Compile pack
packc compile --config arena.yaml --output packs/app.pack.json --id app
#!/bin/bash
# build-with-hooks.sh
# Pre-compilation checks
echo "Running pre-compilation checks..."
./scripts/validate-prompts.sh
# Compile
echo "Compiling pack..."
packc compile --config arena.yaml --output packs/app.pack.json --id app
# Post-compilation tasks
echo "Running post-compilation tasks..."
packc validate packs/app.pack.json
./scripts/test-pack.sh packs/app.pack.json
.PHONY: compile
compile:
@mkdir -p packs
packc compile --config arena.yaml --output packs/app.pack.json --id app
.PHONY: compile-all
compile-all:
@mkdir -p packs
@for config in config/*.yaml; do \
name=$$(basename $$config .yaml); \
echo "Compiling $$name..."; \
packc compile --config $$config --output packs/$$name.pack.json --id $$name; \
done
.PHONY: compile-and-validate
compile-and-validate: compile
packc validate packs/app.pack.json
.PHONY: clean
clean:
rm -rf packs/*.pack.json

Usage:

Terminal window
make compile # Compile main pack
make compile-all # Compile all configs
make compile-and-validate # Compile and validate
make clean # Remove compiled packs

After compilation, verify your pack:

Terminal window
test -f packs/app.pack.json && echo "✓ Pack file created"
Terminal window
# Pack should be < 1MB for most use cases
ls -lh packs/app.pack.json
Terminal window
packc validate packs/app.pack.json
Terminal window
packc inspect packs/app.pack.json
pack, err := manager.LoadPack("./packs/app.pack.json")
if err != nil {
log.Fatal("Pack load failed:", err)
}
fmt.Println("✓ Pack loaded successfully")

Problem:

Error loading arena config: open arena.yaml: no such file or directory

Solution: Specify correct path:

Terminal window
packc compile --config ./config/arena.yaml --output packs/app.pack.json --id app

Problem:

Error: --output and --id are required

Solution: Provide all required flags:

Terminal window
packc compile --config arena.yaml --output packs/app.pack.json --id my-app

Problem:

Error loading prompt: open prompts/support.yaml: no such file or directory

Solution: Check paths in arena.yaml are relative to config file:

# arena.yaml should reference prompts correctly
prompts:
- ../prompts/support.yaml # Adjust path as needed

Problem:

Error parsing prompt config: yaml: line 5: mapping values are not allowed

Solution: Validate YAML syntax:

Terminal window
# Check YAML with yamllint
yamllint prompts/support.yaml

Problem:

⚠ Media validation warnings for customer-support:
- Image file not found: images/logo.png

Solution: Ensure media files exist or update paths:

Terminal window
mkdir -p images
cp assets/logo.png images/

Problem:

Failed to write pack file: no such file or directory

Solution: Create output directory:

Terminal window
mkdir -p packs
packc compile --config arena.yaml --output packs/app.pack.json --id app
Terminal window
packc compile --config arena.yaml --output packs/app.pack.json --id app
packc validate packs/app.pack.json
Terminal window
# Good
--id customer-support-prod-v1
# Avoid
--id pack1
packs/
├── dev/
│ └── app.pack.json
├── staging/
│ └── app.pack.json
└── prod/
└── app.pack.json
Terminal window
packc compile \
--config arena.yaml \
--output "packs/app-v1.2.0.pack.json" \
--id app-v1.2.0
  • Compile separate packs for different features
  • Don’t bundle unrelated prompts together
  • Consider pack size for deployment