Programmatic Usage
Syntic Code runs as a headless engine when you invoke it in print mode. Instead of opening the interactive TUI, syntic --print executes a single prompt, streams or returns the result, and exits. This makes the agent scriptable: you can call it from CI jobs, git hooks, Makefiles, or any program that can run a subprocess and read its output.
Print mode
The --print (or -p) flag runs one prompt non-interactively and writes the response to stdout:
# One-shot query, plain text on stdout
syntic --print "Summarize the changes in the last commit."
# Pipe input in and get an answer out
git diff | syntic -p "Review this diff and flag any security issues."Structured output
For machine consumption, choose an output format. json returns a single structured envelope after the run completes; stream-json emits newline-delimited JSON events as they happen, which is ideal for driving a UI or logging progress in real time:
# Full result as one JSON object
syntic -p "List the failing tests" --output-format json
# Incremental events, one JSON object per line
syntic -p "Refactor utils.js" --output-format stream-jsonThe JSON envelope includes the final text, the tools used, token accounting, and a result status you can branch on.
Exit codes and CI
In print mode syntic returns 0 on success and a non-zero code on failure, so pipelines can gate on the outcome without parsing text. Combine this with --output-format json to capture details and with hooks to enforce policy. A typical CI step runs syntic -p against a review prompt, checks the exit code, and posts the JSON result as a comment. Authentication in CI is supplied through environment variables — see environment variables for the SYNTIC_API_KEY and related settings that let the agent reach Amara on api.syntic.ai without an interactive login.