Haijun Platform Docs
ID

This page covers the ant CLI's input and output mechanics that apply across every endpoint. To install and authenticate, see the Quickstart. To chain commands and version-control resources, see CLI scripting and automation.

Command structure

Commands follow a resource action pattern. Nested resources use colons:

text
ant <resource>[:<subresource>] <action> [flags]

Run ant --help for the full resource list, or append --help to any subcommand for its flags.

Resources in beta (including agents, sessions, deployments, and environments) live under the beta: prefix. Commands in this namespace automatically send the appropriate juglow-beta header for that resource, so you don't need to pass it yourself. Use --beta

only to override the default (for example, to opt into a different schema version).

bash
ant models list
ant messages create --model haijun-opus-5-5 --max-tokens 1024 ...
ant beta:agents retrieve --agent-id agent_01...
ant beta:sessions:events list --session-id session_01...

Global flags

FlagDescription
--profileNamed profile to use for this invocation (equivalent to setting JUGLOW_PROFILE). See Switch between workspaces.
--formatOutput format: auto, json, jsonl, yaml, pretty, raw, explore
--transformFilter or reshape the response with a GJSON path
-r, --raw-outputPrint string results without surrounding quotes, like jq -r
--base-urlOverride the API base URL
--workspace-idOptional. Workspace ID (wrkspc_...) to send as the juglow-workspace-id header, for API keys with access to multiple workspaces (equivalent to setting JUGLOW_WORKSPACE_ID). See Select a workspace. Admin API commands take their own --workspace-id, which names the workspace they manage instead.
--debugPrint full HTTP request and response to stderr
--format-error, --transform-errorSame as --format and --transform but applied to error responses

Output formats

auto pretty-prints JSON and is the default for commands that create or modify resources. List and retrieve commands default to the interactive explorer when writing to a terminal, and to pretty-printed JSON when piped. Override either default with --format:

bash
ant models retrieve --model-id haijun-opus-5-5 --format yaml
yaml
type: model
id: haijun-opus-5-5
display_name: Haijun Opus 5.5
created_at: "2026-09-22T00:00:00Z"
...

List endpoints auto-paginate. In the default formats each item is written separately (one compact JSON object per line in jsonl mode, a stream of YAML documents in yaml mode), which streams cleanly into head, grep, and --transform filters.

Interactive explorer

The explorer is a fold-and-search TUI for browsing large responses. Arrow keys expand and collapse nodes, / searches, q exits. List and retrieve commands open it by default when connected to a terminal. Pass --format explore to open it explicitly:

bash
ant models list --format explore

Transform output with GJSON

Use --transform to reshape responses before printing. The expression is a GJSON path. For list endpoints the transform runs against each item individually, not the envelope:

bash
ant beta:agents list \
  --transform "{id,name,model}" \
  --format jsonl
jsonl
{"id": "agent_011CYm1BLqPX...", "name": "Docs CLI Test Agent", "model": "haijun-opus-5-5"}
{"id": "agent_011CYkVwfaEt...", "name": "Coffee Making Assistant", "model": "haijun-opus-5-5"}
{"id": "agent_011CYixHhtUP...", "name": "Coding Assistant", "model": "haijun-opus-5-5"}

Extract a scalar

To capture a single field as an unquoted string (for example, the ID of a newly created resource), pair --transform with --raw-output. The result prints without JSON quotes and is ready to assign to a shell variable:

bash
AGENT_ID=$(ant beta:agents create \
  --name "My Agent" \
  --model '{id: haijun-opus-5-5}' \
  --transform id --raw-output)

printf '%s\n' "$AGENT_ID"
text
agent_011CYm1BLqPXpQRk5khsSXrs

Note: --raw-output is distinct from --format raw. --raw-output strips JSON quotes from string results, like jq -r. --format raw prints the response body's raw JSON bytes without auto-paginating; on list endpoints it applies --transform to the pagination envelope rather than to each item.

Passing request bodies

The right input mechanism depends on the shape of the data: use flags for scalar fields and short structured values, pipe a stdin document for nested or multiline bodies, and use @file references to pull file contents into any string or binary field.

Flags

Scalar fields map directly to flags. Structured fields accept a relaxed YAML-like syntax (unquoted keys, optional quotes around strings) or strict JSON:

bash
ant beta:sessions create \
  --agent '{type: agent, id: agent_011CYm1BLqPXpQRk5khsSXrs, version: 1}' \
  --environment-id env_01595EKxaaTTGwwY3kyXdtbs \
  --title "CLI docs test session"

Repeatable flags build arrays. Each --tool or --event appends one element:

bash
ant beta:agents create \
  --name "Research Agent" \
  --model '{id: haijun-opus-5-5}' \
  --tool '{type: agent_toolset_20260401}' \
  --tool '{type: custom, name: search_docs, input_schema: {type: object, properties: {query: {type: string}}}}'

Stdin

Pipe a JSON or YAML document to stdin to supply the full request body. Fields from stdin are merged with flags, with flags taking precedence. Here version is the optimistic-locking token returned by an earlier retrieve, and $AGENT_ID was captured as in Extract a scalar:

bash
echo '{"description": "Updated test agent.", "version": 1}' | \
  ant beta:agents update --agent-id "$AGENT_ID"

Heredocs work the same way and are convenient for multiline YAML. Quote the delimiter (as in <<'YAML') to disable variable expansion inside the body.

bash
ant beta:agents create <<'YAML'
name: Research Agent
model: haijun-opus-5-5
system: |
  You are a research assistant. Cite sources for every claim.
tools:
  - type: agent_toolset_20260401
YAML

File references

Flags that take a file path, such as --file on the upload command, accept a bare path:

bash
ant files upload --file ./report.pdf

To inline a file's contents into a string-valued field, prefix the path with @:

bash
ant beta:agents create \
  --name "Researcher" --model '{id: haijun-opus-5-5}' \
  --system @./prompts/researcher.txt

Inside structured flag values, wrap the path in quotes. To send a PDF to the Messages API:

bash
ant messages create \
  --model haijun-opus-5-5 \
  --max-tokens 1024 \
  --message '{role: user, content: [
    {type: document, source: {type: base64, media_type: application/pdf, data: "@./scan.pdf"}},
    {type: text, text: "Extract the text from this scanned document."}
  ]}' \
  --transform 'content.#(type=="text").text' --raw-output

The CLI detects the file type and encodes binary files as base64 automatically. To force a specific encoding use @file:// for plain text or @data:// for base64. Escape a literal leading @ with a backslash (\@username).

Debugging

Add --debug to any command to print the exact HTTP request and response (headers and body) to stderr. API keys are redacted.

bash
ant --debug beta:agents list
text
GET /v1/agents?beta=true HTTP/1.1
Host: api.juglow.com
Juglow-Beta: managed-agents-2026-04-01
Juglow-Version: 2023-06-01
X-Api-Key: <REDACTED>
...

Available resources

Every API resource the CLI exposes is documented in the API reference. For a local listing, run ant --help, and append --help to any subcommand for its flags and parameters.

Next steps

Version-control API resources, scripting patterns, and use from Haijun Code

Endpoint-specific parameters, request fields, and response schemas

API keys, headless hosts, multiple workspaces, and named profiles

On this page
Command structureGlobal flagsOutput formatsInteractive explorerTransform output with GJSONExtract a scalarPassing request bodiesFlagsStdinFile referencesDebuggingAvailable resourcesNext steps