5.1 KiB
Operations Guide
Scope
This document covers day-to-day operation of the CLI and HTTP service for currently implemented behavior.
For command syntax, see CLI reference. For file formats and defaults, see Configuration reference.
Operational Model
Scriptorium executes one request at a time per CLI invocation or HTTP request.
Important boundaries:
- No durable run state is stored.
- No built-in resume, checkpoint, archive, or backup workflow exists.
- Recovery is rerun-based: fix inputs/config, then rerun.
Filesystem Layout And Config
Scriptorium depends on:
- prompt definition files (
prompt_dir) - execution profile files (
profile_dir) - optional JSON schemas (
schema_dir)
Config discovery order when --config is omitted:
/usr/local/etc/scriptorium/config.yml/etc/scriptorium/config.yml
If neither exists, built-in defaults are used. If --config <path> is provided, that file must exist and parse successfully.
Built-in defaults relevant to operations:
schema_dir: .server.addr: :8080server.artifact_root: unset; HTTPfileinput references are rejected until configuredserver.max_request_bytes: 16777216server.max_artifact_bytes: 16777216server.max_response_bytes: 16777216defaults.render_format: text
Normal CLI Workflow
Use render first when you need to verify prompt resolution and runtime settings without calling a model.
Use run for generation.
Typical sequence:
- Confirm prompt/profile directories resolve through config or flags.
- Confirm required input files exist and map to prompt input names.
- Confirm required API-key environment variables are set.
- Confirm the selected profile's model endpoint is reachable from the process environment.
- Run
renderfor preflight when changing prompt/profile/input wiring. - Run
runfor actual generation.
Secrets Handling
Raw API keys are not accepted in config files, profile files as api_key, CLI flags, or HTTP request bodies.
Operational pattern:
- Set environment variables that hold secret values.
- Set profile
api_key_env(or runtime overrideapi_key_env) to the environment variable name. - Keep process environments scoped to only required variables.
HTTP Service Operation
Start service with:
go run ./cmd/scriptorium serve --config ./examples/config.yml
Current inbound API behavior:
- Route:
POST /v1/runs - JSON request parsing rejects unknown fields.
- Validation content failures still return
200 OKwithvalidation.status: "failed". inlineinput references work without filesystem configuration.fileinput references requireserver.artifact_rootorserve --artifact-root; relative paths resolve inside that root and paths outside it are rejected.- Request bodies, HTTP file input artifacts, and encoded JSON responses are limited by
server.max_request_bytes,server.max_artifact_bytes, andserver.max_response_bytes.
Security caveat:
servehas no built-in authentication or authorization.- Deploy only behind trusted controls (private network boundary, authenticated reverse proxy, API gateway, or equivalent).
- Keep the HTTP artifact root as narrow as practical and do not make it writable by untrusted users.
Sizing guidance:
- Keep limits at the defaults unless a deployment has a measured need for larger prompt inputs or outputs.
- Prefer
inlineinputs for small payloads and HTTPfileinputs for larger local artifacts inside a controlled artifact root. - Increase the response limit when prompts intentionally return large generated artifacts or when clients request
include_raw_output. - Set a limit to
0only for trusted deployments where another layer enforces request and response size.
Output, Logs, And Exit Codes
run command:
- Generated artifact body goes to stdout by default.
--outwrites generated artifact to a file.- Summary metadata line is written to stderr on success.
- Exit code
2means generation completed but validation failed.
render command:
- Prepared-run output goes to stdout by default.
--outwrites prepared-run output to a file.- Exit code is
0on success and1on failure.
serve command:
- Startup and server errors are written to stderr.
Validation Behavior In Operations
Validation modes (none, basic, json, json_schema) are defined by prompt output contract.
Operational interpretation:
- Validation runtime errors are hard failures (
runexit1; HTTP error response). - Validation content failures are soft failures (
runexit2; HTTP200with failed status).
A failed validation run can still produce output. Decide whether to keep or discard that output in your surrounding workflow.
Safe Recovery Steps
For failed runs or requests:
- Capture stderr output or HTTP error code/message.
- Confirm config path and directory settings.
- Verify prompt/profile IDs and input mappings.
- Verify API-key environment-variable presence when required.
- Reproduce with
render --format jsonwhen prompt/profile/input resolution is uncertain. - Rerun after correction.
Because Scriptorium does not persist run state, rerun is the canonical recovery path.