Skip to content

Conversation

@christso
Copy link
Collaborator

@christso christso commented Dec 7, 2025

Summary

Add definePromptTemplate SDK wrapper to @agentv/eval that mirrors defineCodeJudge. Update orchestrator to execute .ts/.js prompt files as subprocesses.

Changes

SDK (@agentv/eval):

  • Added PromptTemplateInputSchema in packages/eval/src/schemas.ts
  • Created definePromptTemplate wrapper in packages/eval/src/prompt-template.ts
  • Exported new types: definePromptTemplate, PromptTemplateInput, PromptTemplateInputSchema, PromptTemplateHandler

Core (@agentv/core):

  • Updated LlmJudgeEvaluatorConfig to include config and resolvedPromptPath
  • Added executePromptTemplate function in orchestrator.ts
  • Updated resolveCustomPrompt to detect and execute .ts/.js files
  • Updated evaluator parser to pass through config and skip validation for executable prompts

Testing:

  • Added unit tests for PromptTemplateInputSchema (14 tests)
  • Added integration tests for executable prompt templates (3 tests)

Example:

  • Created examples/features/prompt-template-sdk/ with TypeScript prompt template example

Test plan

  • bun run build passes
  • bun run typecheck passes
  • bun run lint passes
  • bun test passes (369 tests)

🤖 Generated with Claude Code

@christso christso marked this pull request as draft December 7, 2025 23:25
@christso christso added the enhancement New feature or request label Jan 13, 2026
…t templates

Add TypeScript/JavaScript support for custom evaluator prompts using the
same subprocess pattern as code judges.

Changes:
- Add PromptTemplateInputSchema and definePromptTemplate to @agentv/eval
- Update orchestrator to execute .ts/.js prompt files as subprocesses
- Add config and resolvedPromptPath to LlmJudgeEvaluatorConfig
- Skip validation for executable prompt templates in evaluator parser
- Add unit tests for PromptTemplateInputSchema
- Add integration tests for executable prompt templates
- Add example in examples/features/prompt-template-sdk/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@christso christso force-pushed the feat/ts-prompt-templates branch from 4e912bd to 40e8fc6 Compare January 28, 2026 07:24
@christso christso marked this pull request as ready for review January 28, 2026 07:25
christso and others added 8 commits January 28, 2026 07:31
Move OpenSpec to archive after implementation is complete.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Archive change to openspec/changes/archive/2026-01-28-adopt-ts-template-prompts/
- Create new spec openspec/specs/custom-evaluator-prompts/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Reuse CodeJudgeInputSchema for PromptTemplateInputSchema (consistent payloads)
- Add timeout support to executePromptTemplate (prevents hanging scripts)
- Validate non-empty output from prompt templates
- Throw error for missing .ts/.js prompt template files (fail-fast)
- Update tests to reflect required fields

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…lates

Change executable prompt templates to use explicit script arrays instead
of auto-detecting runtime by file extension. This matches the code_judge
pattern for consistency.

Before:
  prompt: ../prompts/custom-evaluator.ts  # ambiguous runtime

After:
  prompt:
    script: [bun, run, ../prompts/custom-evaluator.ts]
    config: { ... }

Benefits:
- Consistent with code_judge pattern (one mental model)
- No ambiguity about runtime (user explicitly specifies bun/node/python)
- Future-proof (works with any runtime without code changes)
- Aligns with "Built-ins for Primitives Only" design principle

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Maintains backward compatibility for users who were using --eval-id.
Shows deprecation warning when used.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reverts to --eval-id as the primary flag for filtering eval cases.
This aligns with Jest/Vitest convention (--testNamePattern) where
the flag name describes what is being filtered, not the action.

Removes --filter alias to keep the CLI simple and match existing docs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new definePromptTemplate SDK for creating dynamic LLM judge
prompts with TypeScript. Includes YAML configuration example and available
context fields.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@christso christso merged commit de3808d into main Jan 28, 2026
@christso christso deleted the feat/ts-prompt-templates branch January 28, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants