TypeScript
Syntic Code does not have a published TypeScript package yet. Nothing is available on npm to install, and this page does not describe a TypeScript API, because none has been released.
Until a package is published, a TypeScript program drives Syntic Code by starting the syntic binary as a child process and reading its output. That interface is available today and is the supported way to call the agent from Node.js.
The syntic binary is the same program the interactive CLI runs. A Node.js program that starts it gets the same features you have in a terminal.
Run one task
Start syntic with -p and --output-format json, then parse the single JSON object it prints. The object contains the final answer in result, the session id, the turn count, the stop reason and the estimated cost.
syntic -p "list the exported functions in src/index.ts" --output-format jsonFrom Node.js, run the same command with child_process, pass the prompt as an argument, and parse standard output as JSON. Check the exit status, and treat a result whose is_error is true as a failure.
Stream the messages
For progress while a run is going, use --output-format stream-json --verbose. The program receives one JSON message per line on standard output: an init record with the model, the tools and the session id, the assistant messages as they are produced, and a final result.
syntic -p "review the open pull request diff" --output-format stream-json --verboseRead the output line by line and parse each line as its own JSON object.
Send several turns
With --input-format stream-json, the program writes user messages to standard input, one JSON object per line, and the agent answers each turn. The format is the same JSON-lines shape the stream output uses.
Approve tool calls from code
Add --permission-prompt-tool stdio to a streaming-input run. When a tool call needs approval, Syntic Code writes a control_request with subtype can_use_tool, and your program answers with a control_response carrying the same request_id and {"behavior": "allow"} or {"behavior": "deny", "message": "why"}. Deny rules and plan mode still apply first. See User input and Permissions for programs.
What is not available yet
- A published TypeScript package with its own types and helpers. Drive the
synticcommand as shown above. - A persistent-session preview package. Several turns in one process work today through streaming input; see TypeScript v2 preview.
Related pages
- Scripting and CI for every flag and the output formats.
- Cost tracking for programs for budgets and cost fields.
- Hooks for programs for checks that run around tool calls.