KyroKyro
API Reference

@kyro/judge

Full API reference for the Judge class and related types.

Judge

The main class for running evaluation pipelines.

Constructor

new Judge(configPath: string, provider: AIProvider, options?: JudgeOptions)
ParameterTypeDescription
configPathstringPath to the YAML pipeline config file
providerAIProviderAI provider instance from @kyro/shared
optionsJudgeOptions?Optional configuration
interface JudgeOptions {
  maxConcurrency?: number;  // Max parallel steps (default: unlimited)
}

.run(input, variables?)

Execute the evaluation pipeline against an input.

async run(
  input: string | Record<string, unknown>,
  variables?: Record<string, string>
): Promise<KyroResult>
ParameterTypeDescription
inputstring | objectTranscript string, JSON object, or file path
variablesRecord<string, string>?Template variables for prompt interpolation

KyroResult

interface KyroResult {
  status: 'SUCCESS' | 'ERROR';
  message: string;
  data: Record<string, StepResult>;
  input: {
    type: 'string' | 'object' | 'file';
    size: number;  // byte length
  };
  usage: {
    totalInputTokens: number;
    totalOutputTokens: number;
  };
}

StepResult

interface StepResult {
  status: 'SUCCESS' | 'ERROR' | 'SKIPPED';
  root_cause: string;
  thinking: string;
  tokens: {
    input: number;
    output: number;
  };
}

Error types

ClassDescription
KyroErrorBase error class
KyroConfigErrorInvalid YAML config, schema validation failure, circular dependency
KyroExecutionErrorRuntime error during step execution
KyroProviderErrorAI provider API error

On this page