One turn from a command line
narya -p "<prompt>" runs one turn and answers on standard output. Its flags:
--repo <path>sets the working repository, and defaults to the working directory.--model <id>chooses the model.--agent <name>runs the turn under a named agent.--session <id>continues an existing session.--style <name>names a response style you declared as[styles.<name>]inconfig.toml. It cannot join--session.--jsonswitches the output to a machine shape.
Exit codes
The two credential failures carry different codes on purpose. An absent key exits
2, and a rejected key exits 1. Retry on 1. On 2, read the message first: a held store clears on its own, and a missing credential does not.
The two shapes of --json
narya -p --json streams one event envelope per line on standard output. Each line carries id, type and timestamp. A line adds sessionId and laneId when the event belongs to a session or a lane. payload is null when the event carries no body. Plain output carries the main lane alone. The stream carries every lane, so select on laneId. These are the same event envelopes the host streams on its API, so a pipeline and a client read one format.
Every other command answers with one document. The actions share one envelope:
result is one word to branch on. changed appears only on a run that changed something. A non-zero exit carries reason instead.
narya schedule add, narya schedule rm, narya schedule budget and narya export publish their own document on success, and print the envelope only on failure. Branch on the exit code for those four, never on result.
Under --json, standard output carries the document or the stream and nothing else. Sentences for a person go to standard error.
The credential on a runner
Put the provider key in your CI secret store and hand it to the step as
<PROVIDER>_API_KEY. The process that calls the supplier reads that variable from its own environment, so a runner with no host running consults no keychain and stores nothing.
Narya reads the branch’s own history, so check out the full branch.
Schedules
Put work on the host’s clock.
narya schedule add "<prompt>" --every <duration>repeats on an interval, and--at <RFC3339>fires once.- Add
--repo <path>,--agent <name>or--budget <usd>to either form. narya schedule listlists what exists, andnarya schedule rm <schedule-id>removes one.narya schedule budget <schedule-id> on <usd>oroffchanges the ceiling on an existing schedule.
--budget, the schedule takes the operator’s default, $5.00 per fire, as [schedules] ceiling_usd. If you set a number, Narya keeps it. If you set 0, Narya stores the schedule and refuses to fire it until you set a budget.
Workflows
A workflow is a JavaScript program that orchestrates agents. Start one by path or as inline source, over the host API. Narya refuses an invalid program before anything runs. A workflow program calls four capabilities:
agent(step, agent, task)runs one agent.agents([...])runs one wave, read in the order you asked.step(name, value)records a step.argshands the program its own run’s arguments.

