Leia

Leia Cookbook

Cookbook recipes are short, copyable starting points. Each recipe points to a checked-in example or command that can be run locally.

Clean And Group Records

Use tables for record-like data and standard-library helpers for cleanup.

go run ./cmd/leia examples run examples/data_processing/string_processing.leia

Related references:

Run Script Tests With A JSON Report

Use leia test for deterministic script tests. JSON output is suitable for CI dashboards and local tooling.

go run ./cmd/leia test --json --output test-report.json tests/smoke/01_basic.leia

Use --golden=require when every test must have an expected stdout file.

Evaluate An Agent With Replay

Use evaluate blocks for agent regressions and replay fixtures for deterministic runs.

go run ./cmd/leia evaluate --format=text --replay examples/evaluate/agent_replay.records.json examples/evaluate/agent_replay.leia

Update a fixture only through the explicit golden update mode:

go run ./cmd/leia evaluate --format=text --update-golden examples/evaluate/agent_replay.records.json examples/evaluate/agent_replay.leia

Related references:

Embed Leia In A Go Service

Start with the executable Go examples:

go test ./examples/embedding -run Example -count=1

They cover compiling a script, exposing Go functions, injecting LLM providers, and using hot reload.

Related references:

Run Concurrent Work

Use goroutines and channels for fan-out/fan-in workloads.

go run ./cmd/leia examples check examples/concurrency/goroutines_channels.leia examples/concurrency/select_timeout.leia

Use cancellation-aware host operations for long-running scripts.

go run ./cmd/leia examples run examples/concurrency/context_cancel.leia

Related reference:

Use Data-Oriented Arrays

Use dense arrays and SoA helpers for numeric kernels or column-oriented data.

go run ./cmd/leia examples run examples/data_processing/data_oriented/soa_kernels.leia
go run ./cmd/leia examples check examples/data_processing/data_oriented/particle_integration.leia

Related references:

Inspect Tooling And Environment

Use local tooling checks before sending a change for review.

go run ./cmd/leia env
go run ./cmd/leia check --no-docs .
scripts/run.sh production --quick

Related guide: