KyroBatch Overview
Async batch evaluation at scale. Submit thousands of transcripts via provider Batch APIs, exit your process, and poll later.
Async batch evaluation for LLM applications using the OpenAI Batch API
Evaluate thousands of transcripts at 50% cost compared to synchronous requests. Submit a job, let your process exit, and poll for results later — state is automatically persisted to disk.
Table of Contents
- /batch
Overview
/batch is designed for offline, large-scale evaluation workflows:
- Async by design –
submit()returns a job ID immediately;check()polls without blocking - Process-exit safe – state is saved to
.kyro/<config>.batch-state.jsonbefore your process exits - Multiple runs – run each judge N times and aggregate via majority vote for more reliable results
- Cost-efficient – uses the OpenAI Batch API (50% cheaper than synchronous calls)
Installation
Quick Start
1. Define Judges
Create judges.yml — only version and judges are needed (no pipeline):
Prompt types are the same as /judge: inline strings, file paths (./prompt.txt), or structured XML objects.
2. Submit a Batch Job
3. Poll for Results
Run this on a schedule (cron job, queue worker, etc.) until the result is non-null:
Configuration
Judges Config
The YAML config for batch only requires version and judges:
Prompt variants:
Run Options
API Reference
BatchJudge
Parameters:
| Parameter | Type | Description |
|---|---|---|
provider | BatchProvider | Provider instance (e.g. OpenAIBatchProvider) |
judgesConfigPath | string | Path to the judges YAML config file |
options.stateDir | string? | Custom directory for state files (default: .kyro/ next to the config file) |
submit()
Submits all transcripts × all judges × runs as a single batch job. Returns the OpenAI batch job ID. State is saved automatically before returning.
Transcripts can be:
- Inline strings
- Paths to
.jsonfiles (parsed and stringified) - Paths to
.txtfiles (read as-is)
check()
Single-poll check — does not block or retry. Returns:
null— job is still in progressBatchRunResult— job is complete (state file is cleared automatically)- Throws — job ended with a non-completed terminal status (
failed,expired,cancelled)
If jobId is omitted, it is loaded from the state file saved by submit().
OpenAIBatchProvider
Wraps the OpenAI Batch API. Only OpenAI is currently supported for batch.
Types
BatchRunResult
Overall status logic:
SUCCESS— all judge evaluations passed (SUCCESS or NA)ERROR— all judge evaluations failedPARTIAL— mix of successes and failures
TranscriptEvaluation
BatchValidationError
Thrown on config or state file errors:
State Management
After submit(), state is saved to:
For example, with ./judges.yml the state file is .kyro/judges.batch-state.json.
The state file stores the batch job ID and the full request map so that check() can reconstruct results without re-reading the transcripts. It is automatically deleted after a successful check().
To use a custom state directory:
Examples
See examples/javascript/batch/ for a complete working example including transcripts and a multi-step submit/check script.
License
MIT License - see LICENSE for details.