Skip to main content
flw retrieves completed job results from a workspace processed by nrvnad.

Usage

flw <workspace> [job_id]
flw <workspace> -w [job_id]
flw [--help | --version]

Arguments

workspace
string
required
Directory path for job storage. Must match the workspace used by nrvnad.
job_id
string
Specific job ID to retrieve. If omitted, retrieves the latest completed job. Can be read from stdin for piping.

Options

-w, --wait
boolean
Wait for job to complete before returning. Polls every 100ms until status is DONE or FAILED.
-h, --help
boolean
Display help message.
-v, --version
boolean
Display version number.

Environment Variables

NRVNA_LOG_LEVEL
string
Log level: ERROR, WARN, INFO, DEBUG, TRACE (default: WARN for clean output).

Output

On success, flw outputs the job result to stdout:
The capital of France is Paris.
Error messages go to stderr, making it safe for piping.

Examples

Retrieve latest job

flw ./workspace

Retrieve specific job

flw ./workspace abc123def456

Wait for job completion

flw ./workspace -w abc123def456

Pipe from wrk

wrk ./workspace "Hello" | flw ./workspace -w
This pattern submits a job and waits for the result in one command.

Store result in variable

result=$(flw ./workspace abc123)
echo "Result: $result"

Chain with job submission

jobid=$(wrk ./workspace "What is 2+2?")
flw ./workspace -w $jobid

Behavior

Job Resolution

  1. If job_id is provided as argument, retrieves that specific job
  2. If job_id is omitted, retrieves the latest job from output/ or failed/ directories
  3. If stdin is not a TTY, reads job_id from stdin (for piping)

Status Handling

  • DONE: Outputs job content to stdout, exit code 0
  • FAILED: Outputs error to stderr, exit code 1
  • QUEUED/RUNNING: Outputs status message to stderr, exit code 2
  • MISSING: Outputs “Job not found” to stderr, exit code 1

Wait Mode

When --wait is used:
  • Polls job status every 100ms
  • Blocks until status is DONE or FAILED
  • Then returns the result or error

Exit Codes

  • 0 - Success, job completed
  • 1 - Error or job failed
  • 2 - Job not ready (still queued or running)

Job Status Values

  • QUEUED - Job is waiting to be processed
  • RUNNING - Job is currently being processed
  • DONE - Job completed successfully
  • FAILED - Job failed during processing
  • MISSING - Job ID not found in workspace

Error Messages

Errors are written to stderr:
No jobs found
Job not found: abc123
Job failed: abc123
Job not ready: abc123 (status: RUNNING)

Integration Pattern

The recommended workflow combines wrk and flw:
# Submit and wait for result
wrk ./workspace "prompt" | flw ./workspace -w

# Or with error handling
if result=$(wrk ./workspace "prompt" | flw ./workspace -w); then
    echo "Success: $result"
else
    echo "Failed"
fi

Build docs developers (and LLMs) love