trainer-optimize

Optimizes markdown prompt files using Agent Lightning APO with explicit JSONL train and validation datasets.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Tyler-R-Kendrick/copilot-auto-training --skill trainer-optimize-tyler-r-kendrick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trainer-optimize
Source: https://github.com/Tyler-R-Kendrick/copilot-auto-training/tree/main/skills/trainer-optimize
Command: npx skills add https://github.com/Tyler-R-Kendrick/copilot-auto-training --skill trainer-optimize-tyler-r-kendrick

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires agentlightning, openai, opto, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Manually rewriting prompt templates is slow and unmeasurable. This Skill automates prompt improvement by running Agent Lightning APO (Automatic Prompt Optimization) against explicit train and validation datasets, returning a scored, optimized markdown prompt with a JSON report. ## Core Features & Use Cases - Automated Prompt Optimization: Runs APO or VERL beam-search optimization over a markdown prompt template using JSONL train/val datasets, with deterministic, custom, or LLM-judge scoring modes. - Safe, Non-Destructive Output: Returns the optimized prompt in JSON/stdout by default; file writes happen only when explicitly requested via output, report, or in-place flags. - Offline Fallback: When no inference model is configured or rate limits hit, it returns a manual_followup payload with a ready-to-use model prompt so an agent can complete the optimization without an API token. - Use Case: You have a support-intent classifier prompt and a CSV of labeled examples. Generate train.jsonl and val.jsonl, then run the optimizer to get a measurably better prompt plus a dashboard URL for inspecting rollouts. ## Quick Start Ask the agent to optimize your markdown prompt with /trainer-optimize by providing the prompt file path along with explicit train and validation JSONL dataset paths.

Frequently Asked Questions about trainer-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a markdown prompt with Agent Lightning?

Run scripts/run_optimize.py with --prompt-file, --train-file, and --val-file arguments pointing to your markdown prompt and JSONL datasets. The runtime returns the optimized prompt as JSON, and you can add --output-file or --in-place to persist it.

What dataset format does prompt optimization require?

Datasets must be JSONL files where each line is a JSON object with an input field and an expected field, plus an optional scoring field such as exact_match or llm_judge. Both train and validation files need at least one row, with 10+ train rows recommended.

What is the difference between APO and VERL algorithms?

APO is the default beam-search prompt optimization algorithm suitable for most tasks. VERL is an alternative algorithm selectable via --algorithm verl when you explicitly want the other optimization path or repository policy prefers it.

Can prompt optimization run without an API key or model access?

Yes. When no model is configured or rate limits occur, the runtime returns a manual_followup JSON payload containing a model_prompt and handoff instructions so an agent can draft the candidate prompt without an inference token.

Why does prompt optimization fail with placeholder mismatch errors?

The optimizer validates that every template placeholder like {input} or {question} matches keys in the dataset rows. If a placeholder is missing from the task schema, the run stops and lists the unmatched placeholders and available fields.

When should I use llm_judge instead of deterministic scoring?

Use llm_judge only for open-ended tasks where exact matching is impossible, such as drafting replies. Prefer deterministic scoring when you have exact expected outputs, and custom mode for normalized or JSON-schema comparisons.