---
title: Command line and SDK
summary: The argus command for people and pipelines, and the TypeScript SDK for apps.
section: build
order: 2
---
## The `argus` command

`argus` is a single static binary. It talks to the public API as the signed-in person or as an app backend, and is built to be driven by scripts and by other agents: results go to stdout, progress and errors to stderr, `-o json` is available on every command, and exit codes say what kind of failure happened.

**Planned: public CLI download and SDK package.** The `argus` binary is not publicly downloadable yet, so nothing below can be installed from this site today. Until it is, the plain HTTP calls work with a token you get yourself: see [Your first token](/docs/api.md#your-first-token) and the [API overview](/docs/api.md). The sign-in described below is the same device flow, which you can already run with curl.

### First run

```sh
argus init --prod && argus login && argus doctor
```

`init` writes a profile, `login` runs the device flow, and `doctor` checks the profile, the sign-in, the API, the clock and your project, and names the first failing step with a one-line fix.

### Commands

| Command | Does |
| --- | --- |
| `argus apply -f DIR` | Creates versions for agents, fragments and schemas whose content changed, and reports `unchanged` for the rest. |
| `argus diff -f DIR --exit-code` | Shows what apply would do, and exits 8 if anything would change. |
| `argus validate -f DIR` | Checks agent definitions with the API and stores nothing. Prints errors, then warnings (including the prompt-cache lint) with a fix for each; exits 6 only for an error. |
| `argus agents list`, `show`, `versions` | Reads agents, their labels and versions. |
| `argus label set AGENT LABEL VERSION --reason TEXT` | Moves a label. The eval gate applies; `--override` is for project admins. `--percent N` sets a canary share. |
| `argus run AGENT "message"` | Starts a session and streams the answer. `-i` answers approvals at the prompt. |
| `argus sessions tail ID` | Follows a session's events. |
| `argus sessions answer ID REQUEST --approve` | Answers a human step. |
| `argus sessions cancel ID` | Cancels the active run. |
| `argus eval suites`, `import`, `run`, `show` | Manages suites and runs one against a version. `import` updates a case of the same name when it changed. `argus eval case delete SUITE CASE` and `argus eval suite delete SUITE` delete one. `--fail-under 0.9` exits 9 below the bar. |
| `argus eval compare CANDIDATE_RUN BASELINE_RUN` | Compares two completed runs of a suite case by case with a judge and prints the wins, losses and ties with their intervals. `--max-net-loss 0.1` exits 9 when the candidate loses by more. |
| `argus usage`, `argus budgets` | Reads spend, and lists or sets budgets. |
| `argus whoami` | Shows your subject and your projects. |

### Exit codes

| Code | Meaning |
| --- | --- |
| 0 | Success |
| 2 | Usage: bad flags or files |
| 3 | Auth: not signed in, or the token was refused |
| 4 | Not found |
| 5 | Conflict: for example a human step already answered |
| 6 | Validation, including a failed eval gate |
| 7 | Server error, rate limit or network failure |
| 8 | `diff --exit-code` found changes |
| 9 | `eval run` finished below `--fail-under` |
| 1 | Anything else |

In JSON mode an error is one object with `error` and `kind`, and tokens, bearer headers and client secrets are removed from every message.

### Definitions in a repository

Keep your agents as `*.agent.md` files in a repository. In CI, `argus diff -f agents/ --exit-code` flags drift, `argus apply -f agents/` publishes the changes, and `argus eval run ... --fail-under` blocks a release that regressed. Every write carries an idempotency key, so a retried pipeline step does not duplicate anything.

## The TypeScript SDK

`@kurthlabs/argus-sdk` is the API client for Bun and the browser. It starts a session, follows its events with automatic reconnect, sends messages, answers human requests, serves client-side tools and cancels. It also includes a React hook that keeps a chat view current.

```ts
import { ArgusClient, eventText } from "@kurthlabs/argus-sdk";

const argus = new ArgusClient({ baseUrl: "https://api.kurthlabs.com/argus", project: "my-project", token });
const session = await argus.startSession({ agent: "showcase/assistant", text: "Plan a free Saturday in Lisbon." });

for await (const ev of session.events()) {
  if (ev.type === "delta.text") process.stdout.write(eventText(ev));
  if (ev.type === "run.completed") break;
}
```

`session.uploadImage(file)` stores a picture on the session and `imagePart(uploaded)` puts it in `session.send([...])`; see [Images](/docs/concepts/sessions-and-runs.md#images). `conversationTurns` can show them: give it `imageUrl` to say where each picture loads from.

`session.events()` reconnects by `Last-Event-ID`, so persisted events are never repeated or missed, and a stream that goes silent for 45 seconds (the API sends a heartbeat every 15) is dropped and resumed. Every write carries an idempotency key; pass your own to retry one safely. Errors from the API arrive as an `ArgusError` with the problem slug. A Go SDK exists with the same shape. **Planned:** the SDK package is not publicly available yet; the HTTP calls in the [API overview](/docs/api.md) do the same work.

To show a session inside your own web page, `@kurthlabs/argus-sdk/embed` has `<ArgusEmbed>`, which streams and posts to Argus directly with a short-lived token your backend mints. See [Embed a session](/docs/embed-a-session.md).
