@cursor/july 0.1.91 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -0
- package/dist/docs/404.html +3 -1
- package/dist/docs/ab.html +4 -2
- package/dist/docs/ab.md +338 -0
- package/dist/docs/building-with-agents.html +4 -2
- package/dist/docs/building-with-agents.md +124 -0
- package/dist/docs/concepts.html +4 -2
- package/dist/docs/concepts.md +174 -0
- package/dist/docs/deployment.html +4 -2
- package/dist/docs/deployment.md +464 -0
- package/dist/docs/evals.html +4 -2
- package/dist/docs/evals.md +481 -0
- package/dist/docs/example-agents/approval-buddy.html +4 -2
- package/dist/docs/example-agents/approval-buddy.md +266 -0
- package/dist/docs/example-agents/benny.html +4 -2
- package/dist/docs/example-agents/benny.md +182 -0
- package/dist/docs/example-agents/bugbot.html +4 -2
- package/dist/docs/example-agents/bugbot.md +229 -0
- package/dist/docs/example-agents/codebase-wiki.html +4 -2
- package/dist/docs/example-agents/codebase-wiki.md +170 -0
- package/dist/docs/example-agents/codeowners-review.html +4 -2
- package/dist/docs/example-agents/codeowners-review.md +192 -0
- package/dist/docs/example-agents/concierge.html +4 -2
- package/dist/docs/example-agents/concierge.md +201 -0
- package/dist/docs/example-agents/fsd.html +4 -2
- package/dist/docs/example-agents/fsd.md +329 -0
- package/dist/docs/example-agents/index.html +4 -2
- package/dist/docs/example-agents/index.md +102 -0
- package/dist/docs/example-agents/knowledge-base.html +4 -2
- package/dist/docs/example-agents/knowledge-base.md +168 -0
- package/dist/docs/example-agents/oncall.html +4 -2
- package/dist/docs/example-agents/oncall.md +212 -0
- package/dist/docs/example-agents/security-reviewer.html +4 -2
- package/dist/docs/example-agents/security-reviewer.md +265 -0
- package/dist/docs/example-agents/slack-agent.html +4 -2
- package/dist/docs/example-agents/slack-agent.md +142 -0
- package/dist/docs/example-agents/weather-agent.html +4 -2
- package/dist/docs/example-agents/weather-agent.md +296 -0
- package/dist/docs/guides/agent-to-agent.html +4 -2
- package/dist/docs/guides/agent-to-agent.md +113 -0
- package/dist/docs/guides/cloud-runtime.html +4 -2
- package/dist/docs/guides/cloud-runtime.md +131 -0
- package/dist/docs/guides/convert-automation.html +4 -2
- package/dist/docs/guides/convert-automation.md +171 -0
- package/dist/docs/guides/github.html +4 -2
- package/dist/docs/guides/github.md +287 -0
- package/dist/docs/guides/human-in-the-loop.html +4 -2
- package/dist/docs/guides/human-in-the-loop.md +126 -0
- package/dist/docs/guides/mcp-oauth.html +4 -2
- package/dist/docs/guides/mcp-oauth.md +159 -0
- package/dist/docs/guides/opentelemetry.html +4 -2
- package/dist/docs/guides/opentelemetry.md +209 -0
- package/dist/docs/guides/slack.html +4 -2
- package/dist/docs/guides/slack.md +337 -0
- package/dist/docs/guides/webhooks.html +4 -2
- package/dist/docs/guides/webhooks.md +463 -0
- package/dist/docs/hillclimbing.html +4 -2
- package/dist/docs/hillclimbing.md +88 -0
- package/dist/docs/index.html +4 -2
- package/dist/docs/index.md +179 -0
- package/dist/docs/llms-full.txt +11518 -0
- package/dist/docs/llms.txt +75 -0
- package/dist/docs/quickstart.html +4 -2
- package/dist/docs/quickstart.md +364 -0
- package/dist/docs/reference/agent-config.html +4 -2
- package/dist/docs/reference/agent-config.md +256 -0
- package/dist/docs/reference/artifacts.html +4 -2
- package/dist/docs/reference/artifacts.md +112 -0
- package/dist/docs/reference/channels.html +4 -2
- package/dist/docs/reference/channels.md +255 -0
- package/dist/docs/reference/cli.html +4 -2
- package/dist/docs/reference/cli.md +957 -0
- package/dist/docs/reference/connections.html +4 -2
- package/dist/docs/reference/connections.md +268 -0
- package/dist/docs/reference/hooks.html +4 -2
- package/dist/docs/reference/hooks.md +102 -0
- package/dist/docs/reference/http-api.html +4 -2
- package/dist/docs/reference/http-api.md +267 -0
- package/dist/docs/reference/instructions.html +4 -2
- package/dist/docs/reference/instructions.md +74 -0
- package/dist/docs/reference/playground.html +4 -2
- package/dist/docs/reference/playground.md +62 -0
- package/dist/docs/reference/project-layout.html +4 -2
- package/dist/docs/reference/project-layout.md +107 -0
- package/dist/docs/reference/prompt.html +4 -2
- package/dist/docs/reference/prompt.md +42 -0
- package/dist/docs/reference/schedules.html +4 -2
- package/dist/docs/reference/schedules.md +215 -0
- package/dist/docs/reference/sessions.html +4 -2
- package/dist/docs/reference/sessions.md +170 -0
- package/dist/docs/reference/skills.html +4 -2
- package/dist/docs/reference/skills.md +83 -0
- package/dist/docs/reference/subagents.html +4 -2
- package/dist/docs/reference/subagents.md +71 -0
- package/dist/docs/reference/tools.html +4 -2
- package/dist/docs/reference/tools.md +298 -0
- package/dist/docs/scaffolding-agents.html +4 -2
- package/dist/docs/scaffolding-agents.md +130 -0
- package/dist/docs/storage.html +4 -2
- package/dist/docs/storage.md +219 -0
- package/dist/docs/templates/agentic-owners.html +4 -2
- package/dist/docs/templates/agentic-owners.md +92 -0
- package/dist/docs/templates/demo.html +4 -2
- package/dist/docs/templates/demo.md +79 -0
- package/dist/docs/templates/pr-autofixer.html +4 -2
- package/dist/docs/templates/pr-autofixer.md +131 -0
- package/dist/docs/templates/security-reviewer.html +4 -2
- package/dist/docs/templates/security-reviewer.md +84 -0
- package/dist/docs/templates/triage.html +4 -2
- package/dist/docs/templates/triage.md +98 -0
- package/dist/docs/troubleshooting.html +4 -2
- package/dist/docs/troubleshooting.md +111 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -1
- package/dist/internal/init-scaffold.js +1 -0
- package/dist/internal/playground/static.d.ts.map +1 -1
- package/dist/internal/playground/static.js +2 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +3 -1
- package/package.json +2 -2
- package/skills/ab/SKILL.md +3 -0
- package/skills/create-agent/SKILL.md +3 -0
- package/skills/debug/SKILL.md +3 -0
- package/skills/evals/SKILL.md +3 -0
- package/skills/framework-map/SKILL.md +3 -0
- package/skills/github/SKILL.md +3 -0
- package/skills/hillclimb/SKILL.md +3 -0
- package/skills/mcp-auth/SKILL.md +3 -0
- package/skills/otel/SKILL.md +3 -0
- package/skills/setup-slack/SKILL.md +3 -0
- package/src/internal/init-scaffold.ts +1 -0
- package/src/internal/playground/static.ts +2 -0
- package/src/internal/session-engine.ts +4 -6
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
# CLI reference
|
|
2
|
+
|
|
3
|
+
`@cursor/july` installs `july` (so `npx @cursor/july docs` works),
|
|
4
|
+
`agent-sdk`, and the legacy `agent-serve` alias. The examples on this
|
|
5
|
+
page use `agent-sdk`. Run the CLI with Node 22.13 or newer. Don't run it
|
|
6
|
+
with Bun; Bun corrupts tool-result streams from the Cursor SDK.
|
|
7
|
+
|
|
8
|
+
The current release still uses `.agent-serve` for on-disk state. See the
|
|
9
|
+
[rename table](/docs/index.md#run-the-cli) for identifiers still moving to
|
|
10
|
+
agent-sdk names.
|
|
11
|
+
|
|
12
|
+
`agent-sdk help` prints the built-in summary. The Slack and GitHub packs
|
|
13
|
+
also provide `agent-sdk slack help` and `agent-sdk github help`.
|
|
14
|
+
|
|
15
|
+
| Command | Description |
|
|
16
|
+
| ------------------------------------------------------- | -------------------------------------------------------------- |
|
|
17
|
+
| [`serve`](#serve) | Serve agents over HTTP |
|
|
18
|
+
| [`dev`](#dev) | Start local development with `serve --dev` |
|
|
19
|
+
| [`chat`](#chat) | Talk to a running agent |
|
|
20
|
+
| [`resume`](#resume) | Reattach chat to a previous session |
|
|
21
|
+
| [`logs`](#logs) | Follow local or hosted logs |
|
|
22
|
+
| [`sessions`](#sessions) | List sessions on a running agent |
|
|
23
|
+
| [`session`](#session) | Inspect one session |
|
|
24
|
+
| [`cost`](#cost) | Report per-session token usage and estimated cost |
|
|
25
|
+
| [`playground`](#playground) | Open the local or hosted playground |
|
|
26
|
+
| [`docs`](#docs) | Serve the shipped documentation site locally |
|
|
27
|
+
| [`run`](#run) | Run one or more turns locally, remotely, or on a hosted agent |
|
|
28
|
+
| [`call`](#call) | Call a server tool without a model turn |
|
|
29
|
+
| [`eval`](#eval) | Run filesystem evals |
|
|
30
|
+
| [`trajectory`](#trajectory) | Summarize a saved `events.ndjson` file |
|
|
31
|
+
| [`init`](#init) | Scaffold a project, or print the setup guide |
|
|
32
|
+
| [`convert-automation`](#convert-automation) | Export a Cursor Automation into an agent project |
|
|
33
|
+
| [`install-skills`](#install-skills) | Refresh coding-agent skills (`npm install` already copies them) |
|
|
34
|
+
| [`info`](#info) | Print the discovered agent surface |
|
|
35
|
+
| [`validate`](#validate) | Check a project and fail on errors |
|
|
36
|
+
| [`login` / `logout` / `whoami`](#login-logout-whoami) | Manage the host's Cursor credential |
|
|
37
|
+
| `version` | Print the installed version and exit (also `--version` / `-V`) |
|
|
38
|
+
| [`update`](#update) | Upgrade the installed CLI |
|
|
39
|
+
| [`deploy`](#deploy) | Deploy one or more agents to Cursor managed hosting |
|
|
40
|
+
| [`deployments`](#deployments) | List hosted deployments |
|
|
41
|
+
| [`deployment`](#deployment) | Inspect one hosted deployment |
|
|
42
|
+
| [`stop`](#stop) | Stop a hosted deployment |
|
|
43
|
+
| [`delete`](#delete) | Delete a hosted deployment |
|
|
44
|
+
| [`rotate-token`](#rotate-token) | Replace a deployment's alias token |
|
|
45
|
+
| [`rotate-pod-credential`](#rotate-pod-credential) | Replace a deployment's pod credential |
|
|
46
|
+
| [`secrets`](#secrets) | Manage deployment secrets |
|
|
47
|
+
| [`mcp`](#mcp) | Proxy the agent's MCP endpoint over stdio; `mcp install` writes `~/.cursor/mcp.json` |
|
|
48
|
+
| [`mcp oauth`](#mcp-oauth) | Authorize host MCP OAuth; optional `--store` to deployment secrets |
|
|
49
|
+
| [`slack ...`](#slack) | Provision, set up, and check Slack channels |
|
|
50
|
+
| [`github ...`](#github) | Forward, replay, and inspect GitHub webhook channels |
|
|
51
|
+
|
|
52
|
+
## Choose a target
|
|
53
|
+
|
|
54
|
+
Request-sending commands support three target types.
|
|
55
|
+
|
|
56
|
+
| Target | How to select it | Commands |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| Ephemeral local server | Omit `--url` and `--prod` | `run`, `call`, `eval` |
|
|
59
|
+
| Running server | Pass `--url <baseUrl>`, unless the command uses the localhost default described next | `chat`, `resume`, `logs`, `sessions`, `session`, `cost`, `playground`, `run`, `call`, `eval`, `mcp` |
|
|
60
|
+
| Cursor managed hosting | Pass `--prod` | `chat`, `resume`, `logs`, `sessions`, `session`, `cost`, `playground`, `run`, `call`, `eval`, `mcp` |
|
|
61
|
+
|
|
62
|
+
`chat`, `logs`, `sessions`, `session`, `cost`, and `playground` default to
|
|
63
|
+
`http://127.0.0.1:3000`. A `--url` must include the agent slug for a
|
|
64
|
+
multi-agent server, such as `http://127.0.0.1:3000/pr-approver`.
|
|
65
|
+
`--slug` doesn't change an explicit URL. `mcp` has no default target;
|
|
66
|
+
pass `--url` or `--prod`.
|
|
67
|
+
|
|
68
|
+
With `--prod`, `--slug` selects the deployment and `--team` selects the
|
|
69
|
+
Cursor team. The slug defaults to the `--dir` basename. The team
|
|
70
|
+
defaults to the signed-in account's team. `--url` and `--prod` are
|
|
71
|
+
mutually exclusive.
|
|
72
|
+
|
|
73
|
+
Use `--bearer-token <token>` when a running server requires bearer
|
|
74
|
+
authentication. Hosted commands use your Cursor credential to request
|
|
75
|
+
short-lived engine access. `--api-key` overrides the Cursor credential
|
|
76
|
+
for `login`, `serve`, hosted targets, and managed-hosting commands.
|
|
77
|
+
`--state-root` applies to `serve` and ephemeral `run`, `call`, and
|
|
78
|
+
`eval` servers. Running and hosted targets ignore it.
|
|
79
|
+
|
|
80
|
+
For ephemeral `run`, `call`, and `eval` commands, omitting `--slug`
|
|
81
|
+
selects an unslugged root mount when one exists. Otherwise, the Agent SDK
|
|
82
|
+
selects the first discovered agent.
|
|
83
|
+
|
|
84
|
+
## serve
|
|
85
|
+
|
|
86
|
+
`serve` hosts every agent under `--dir` in multi-agent mode by default.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
agent-sdk serve [--dir <path>] [--port 3000] [--host 127.0.0.1] [--dev]
|
|
90
|
+
[--mode multi|single] [--api-key <key>]
|
|
91
|
+
[--state-root <path>] [--bearer-token <secret> | --allow-anonymous]
|
|
92
|
+
[--allow-anonymous-cursor-github]
|
|
93
|
+
[--allow-anonymous-cursor-account-mcp]
|
|
94
|
+
[--public-url <url>] [--cloud-tools-url <url>]
|
|
95
|
+
[--cursor-github-proxy] [--no-control-plane]
|
|
96
|
+
[--no-schedules] [--no-playground]
|
|
97
|
+
[--no-docs] [--cursor-events --repo owner/name]...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If `--dir` is an agent project, it mounts under its directory name. If
|
|
101
|
+
it contains agent projects, each child mounts separately. The index
|
|
102
|
+
lives at `/`. Each agent is available at `/<slug>/v1/*` and
|
|
103
|
+
`/<slug>/playground`. On a TTY, press Enter to restart.
|
|
104
|
+
Unless `--state-root` is set, each mount uses
|
|
105
|
+
`<agent-project>/.agent-serve`; slugged mounts use
|
|
106
|
+
`<agent-project>/.agent-serve/<slug>`.
|
|
107
|
+
|
|
108
|
+
| Flag | Meaning |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `--port` | Listen on this port. `0` selects an available port. The default is `3000`. When the default is taken, serve tries the next free port and prints a notice; an explicit `--port` fails with a next-port hint instead. |
|
|
111
|
+
| `--host` | Bind this host. The default is loopback-only `127.0.0.1`. |
|
|
112
|
+
| `--dev` | Disable automatic schedule and reminder firing, admit unsigned loopback GitHub deliveries, widen playground session access on loopback, and start Vite HMR when available. |
|
|
113
|
+
| `--mode` | Use `multi` for slugged routes and an index, or `single` for one agent at the unslugged `/v1/*`. The default is `multi`. |
|
|
114
|
+
| `--api-key` | Use this Cursor API key. The command falls back to `CURSOR_API_KEY`, then the stored login. |
|
|
115
|
+
| `--state-root` | Store sessions, streams, workspaces, and channel state here. Keep durable production state outside the agent repository. |
|
|
116
|
+
| `--bearer-token` | Require this bearer token on routes without authored auth. Mutually exclusive with `--allow-anonymous`. |
|
|
117
|
+
| `--allow-anonymous` | Admit every caller as one `anonymous` principal. Use only behind a trusted network boundary. |
|
|
118
|
+
| `--allow-anonymous-cursor-github` | Allow anonymous callers to drive sessions holding a Cursor account's repo-scoped GitHub credential. Use only behind an authenticating proxy. |
|
|
119
|
+
| `--allow-anonymous-cursor-account-mcp` | Allow anonymous callers to drive Cursor account MCP connectors (`defineConnection({ cursorAccount: true })`). Use only behind an authenticating proxy (hosted alias token counts). |
|
|
120
|
+
| `--public-url` | Set the externally reachable host URL. Cloud-runtime peer connections need it to call back into this server. |
|
|
121
|
+
| `--cloud-tools-url` | Authenticated HTTP MCP URL for this deployment's direct server-tool endpoint. Hosted deployments configure it automatically. |
|
|
122
|
+
| `--cursor-github-proxy` | Route `githubChannel({ cursorAccount })` API calls through the Cursor backend's GitHub forwarder instead of minting raw installation tokens into this process. `AGENT_SERVE_GITHUB_PROXY_URL` overrides the base URL. |
|
|
123
|
+
| `--no-control-plane` | Skip the bundled schedule and reminder clocks. Cursor hosting passes this so the platform fires timed work through internal routes instead. |
|
|
124
|
+
| `--no-schedules` | Disable the cron runner outside dev mode. |
|
|
125
|
+
| `--no-playground` | Skip the web playground and its build or HMR process. |
|
|
126
|
+
| `--no-docs` | Skip the documentation site at `/docs` and its build. |
|
|
127
|
+
| `--cursor-events` | Pull SCM events from Cursor's `/v0/scm-events` in addition to authored webhook routes. Requires a signed-in host. Pass repeatable `--repo owner/name` values; repos declared by `githubChannel({ cursorAccount })` also enable the relay. State lives under `<state-root>/cursor-events/`. |
|
|
128
|
+
|
|
129
|
+
Multi-agent slugs must start with a letter or digit, then contain only
|
|
130
|
+
letters, digits, `_`, or `-`. The reserved slugs are `v1`, `playground`,
|
|
131
|
+
and `docs`.
|
|
132
|
+
|
|
133
|
+
## dev
|
|
134
|
+
|
|
135
|
+
`dev` is the local-development shortcut for `serve --dev`. Pass the
|
|
136
|
+
agent folder as a positional path, or run it from inside the project:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
agent-sdk dev
|
|
140
|
+
agent-sdk dev ./sdk-pr-reviewer
|
|
141
|
+
agent-sdk dev ./sdk-pr-reviewer --port 3000
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`dev` accepts the same flags as [`serve`](#serve). You can use `--dir`
|
|
145
|
+
instead of the positional path.
|
|
146
|
+
Dev mode is always on: schedules and reminders wait for manual dispatch,
|
|
147
|
+
GitHub accepts unsigned loopback deliveries, and Vite HMR starts when
|
|
148
|
+
the toolchain is present. Prefer this over `serve --dev` while
|
|
149
|
+
iterating. Pass at most one positional path. Don't combine a positional
|
|
150
|
+
path with a different `--dir`.
|
|
151
|
+
|
|
152
|
+
## chat
|
|
153
|
+
|
|
154
|
+
`chat` talks to a running agent from the terminal. It never starts a
|
|
155
|
+
server.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
agent-sdk chat --url http://127.0.0.1:3000/pr-approver
|
|
159
|
+
agent-sdk chat --message "Is the PR ready to approve?"
|
|
160
|
+
agent-sdk chat --message "Inspect PR 42" --json
|
|
161
|
+
agent-sdk chat --prod --slug pr-approver --team 123
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`chat` streams text, tool calls, and a per-turn usage footer.
|
|
165
|
+
On a TTY, `--message` seeds the interactive REPL. With non-TTY input,
|
|
166
|
+
`--message` runs one turn and exits; without it, `chat` reads
|
|
167
|
+
newline-delimited messages until EOF. `--json` requires `--message`,
|
|
168
|
+
runs one turn, and prints
|
|
169
|
+
`{ ok, sessionId, continuationToken, trajectory }`. `--text` prints a
|
|
170
|
+
compact trajectory when combined with `--json`. `--no-color` forces
|
|
171
|
+
plain interactive output.
|
|
172
|
+
|
|
173
|
+
Use `--session <id>` to reattach a stored session. The command looks up
|
|
174
|
+
its continuation token when you omit `--continuation-token`. Use
|
|
175
|
+
`--resume` to select the most recently updated session with a
|
|
176
|
+
continuation token.
|
|
177
|
+
|
|
178
|
+
## resume
|
|
179
|
+
|
|
180
|
+
`resume` is the direct way to reattach the chat REPL.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
agent-sdk resume ses_123 --url http://127.0.0.1:3000/pr-approver
|
|
184
|
+
agent-sdk resume --url http://127.0.0.1:3000/pr-approver
|
|
185
|
+
agent-sdk resume ses_123 --prod --team 123 --slug pr-approver
|
|
186
|
+
agent-sdk resume ses_123 --message "Continue the review" --json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Pass a session ID to select it. Omit the ID to select the most recently
|
|
190
|
+
updated followable session from `/v1/sessions`. The command looks up a
|
|
191
|
+
missing continuation token, replays the transcript, and accepts
|
|
192
|
+
follow-ups. `resume --json` requires `--message`. The same operation is
|
|
193
|
+
available as `chat --session <id>` or `chat --resume`.
|
|
194
|
+
|
|
195
|
+
## logs
|
|
196
|
+
|
|
197
|
+
`logs` follows the local or hosted log buffer.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
agent-sdk logs [--url http://127.0.0.1:3000] [--once] [--json]
|
|
201
|
+
agent-sdk logs --prod [--slug <slug>] [--team <id>] [--once] [--json]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Local mode reads `/v1/logs` from the running server. Hosted mode reports
|
|
205
|
+
deploy progress until the deployment is running or degraded, then
|
|
206
|
+
follows reachable runtime logs.
|
|
207
|
+
The command follows until Ctrl-C by default. `--once` prints the current
|
|
208
|
+
buffer and exits. `--json` emits newline-delimited JSON events.
|
|
209
|
+
|
|
210
|
+
## sessions
|
|
211
|
+
|
|
212
|
+
`sessions` lists sessions on a running or hosted agent.
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
agent-sdk sessions [--url <baseUrl> | --prod] [--slug <slug>]
|
|
216
|
+
[--team <id>] [--bearer-token <token>] [--json]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Text output shows session ID, channel, mode, turn count, running status,
|
|
220
|
+
and update time. `--json` prints full session summaries in
|
|
221
|
+
`{ sessions }`, including continuation tokens.
|
|
222
|
+
|
|
223
|
+
## session
|
|
224
|
+
|
|
225
|
+
`session` inspects the event stream for one session.
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
agent-sdk session <sessionId> [--url <baseUrl> | --prod]
|
|
229
|
+
[--slug <slug>] [--team <id>]
|
|
230
|
+
[--json | --text | --events] [--out <file.ndjson>]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
By default, `session` prints a compact trajectory. `--text` selects the
|
|
234
|
+
same format. `--json` prints the trajectory object. `--events` prints
|
|
235
|
+
`{ sessionId, events }` with the raw event list. You can't combine
|
|
236
|
+
`--events` and `--json`. `--out <file.ndjson>` writes the raw NDJSON
|
|
237
|
+
trace to a file instead of printing. The file uses the same format as
|
|
238
|
+
`run --events` and the playground download. Use
|
|
239
|
+
[`resume`](#resume) to continue the conversation.
|
|
240
|
+
|
|
241
|
+
## cost
|
|
242
|
+
|
|
243
|
+
`cost` reports token usage and estimated cost.
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
agent-sdk cost [sessionId] [--url <baseUrl> | --prod]
|
|
247
|
+
[--slug <slug>] [--team <id>] [--json]
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
With a session ID, `cost` prints per-turn token usage and estimated
|
|
251
|
+
cost for that session. Without one, it prints one row per session on
|
|
252
|
+
the target plus a total. Costs are the engine's recorded estimates from
|
|
253
|
+
`turn.completed` events; turns persisted before cost tracking count as
|
|
254
|
+
unpriced. `--json` prints the underlying report, or `{ sessions }` when
|
|
255
|
+
aggregating. Like `session`, the command supports `--dir`,
|
|
256
|
+
`--bearer-token`, and the `--url`/`--prod` targets, and defaults to the
|
|
257
|
+
local server.
|
|
258
|
+
|
|
259
|
+
## playground
|
|
260
|
+
|
|
261
|
+
`playground` opens an agent's web playground.
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
agent-sdk playground [--url <baseUrl> | --prod] [--session <id>]
|
|
265
|
+
[--slug <slug>] [--team <id>]
|
|
266
|
+
[--bearer-token <token>] [--print]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
`--session` opens a deep link to one session. `--print` prints the URL
|
|
270
|
+
without opening a browser.
|
|
271
|
+
|
|
272
|
+
For an unauthenticated local URL, `playground` opens the browser and
|
|
273
|
+
exits. `--prod` and `--bearer-token` start a loopback proxy to inject
|
|
274
|
+
browser-inaccessible credentials. The proxy stays open until Ctrl-C,
|
|
275
|
+
including when you pass `--print`.
|
|
276
|
+
|
|
277
|
+
## docs
|
|
278
|
+
|
|
279
|
+
`docs` serves the documentation shipped inside `@cursor/july` and opens
|
|
280
|
+
it in a browser. You don't need an agent project.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
npx @cursor/july docs
|
|
284
|
+
agent-sdk docs [--port <n>] [--host 127.0.0.1] [--print]
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
The site is the same VitePress build mounted at `/docs` on a running
|
|
288
|
+
`serve` host. `docs` starts a loopback-only static server (default port
|
|
289
|
+
is an ephemeral port) and keeps it open until Ctrl-C. `--print` prints
|
|
290
|
+
the URL without opening a browser.
|
|
291
|
+
|
|
292
|
+
## run
|
|
293
|
+
|
|
294
|
+
`run` sends one or more turns and prints a JSON result.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
agent-sdk run --dir . --message "Is https://github.com/acme/checkout/pull/42 ready?"
|
|
298
|
+
agent-sdk run --dir . --message "Inspect PR 42" --message "Summarize the risks"
|
|
299
|
+
agent-sdk run --url http://127.0.0.1:3000/pr-approver --message "Inspect PR 42"
|
|
300
|
+
agent-sdk run --prod --slug pr-approver --team 123 --message "Inspect PR 42"
|
|
301
|
+
agent-sdk run --dir . --messages-file ./prompts.json
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Without `--url` or `--prod`, the command starts an ephemeral server on
|
|
305
|
+
an available port. Its state root is a temporary directory outside the
|
|
306
|
+
project unless you pass `--state-root`. The command closes the server
|
|
307
|
+
after the turns finish.
|
|
308
|
+
|
|
309
|
+
| Flag | Meaning |
|
|
310
|
+
| --- | --- |
|
|
311
|
+
| `--message <text>` | Send a user message. Repeat the flag for a multi-turn run. |
|
|
312
|
+
| `--messages-file <path>` | Read a JSON array of strings. File messages run before repeated `--message` values. |
|
|
313
|
+
| `--session <id>` | Follow up an existing session. Unlike `chat`, `run` doesn't look up a missing continuation token. |
|
|
314
|
+
| `--continuation-token <token>` | Continue the existing session selected by `--session`. |
|
|
315
|
+
| `--events <file>` | Write the raw NDJSON event stream to this path. |
|
|
316
|
+
| `--no-events` | Don't write an event stream. |
|
|
317
|
+
| `--text` | Print a compact trajectory instead of the JSON result. |
|
|
318
|
+
| `--timeout-ms <n>` | Abort the turn after a positive number of milliseconds. There is no default timeout. |
|
|
319
|
+
| `--no-stream` | Hide live tool and reply progress on stderr. Progress is on by default when stderr is a TTY. |
|
|
320
|
+
| `--slug <slug>` | Pick one agent when local discovery mounts several agents. With `--prod`, select the hosted deployment. |
|
|
321
|
+
|
|
322
|
+
The default trace path is
|
|
323
|
+
`<dir>/.agent-serve/traces/<sessionId>.ndjson`. JSON output contains
|
|
324
|
+
`ok`, `sessionId`, `continuationToken`, `trace`, `playgroundUrl`,
|
|
325
|
+
`playgroundHint`, `visualize`, and `trajectory`. The command exits
|
|
326
|
+
non-zero when the trajectory fails.
|
|
327
|
+
|
|
328
|
+
## call
|
|
329
|
+
|
|
330
|
+
`call` invokes a server tool directly, with no model turn.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
agent-sdk call inspect_pr --dir . \
|
|
334
|
+
--input '{"prUrl":"https://github.com/acme/checkout/pull/42"}'
|
|
335
|
+
agent-sdk call inspect_pr --url http://127.0.0.1:3000/pr-approver \
|
|
336
|
+
--input '{"prUrl":"https://github.com/acme/checkout/pull/42"}'
|
|
337
|
+
agent-sdk call refresh_cache --url http://127.0.0.1:3000/pr-approver \
|
|
338
|
+
--session ses_123
|
|
339
|
+
agent-sdk call inspect_pr --prod --slug pr-approver --team 123 --input '{}'
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
`call` sends `POST /v1/tools/:toolName` and runs the tool in the serving
|
|
343
|
+
process without a model turn. `--input` accepts any valid JSON and
|
|
344
|
+
defaults to `{}`. Tools with a Zod input schema validate and transform
|
|
345
|
+
the value before execution. A local call needs no inference credential.
|
|
346
|
+
A hosted call still needs Cursor credentials to reach the deployment.
|
|
347
|
+
|
|
348
|
+
`--session` runs the tool inside an existing session and records it on
|
|
349
|
+
the event stream. If a model turn is active or pending, the server
|
|
350
|
+
returns `session_busy`; retry after the turn finishes. The command
|
|
351
|
+
prints the server's JSON response and exits non-zero unless the HTTP
|
|
352
|
+
response succeeds with `ok: true`. See
|
|
353
|
+
[Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn).
|
|
354
|
+
|
|
355
|
+
## eval
|
|
356
|
+
|
|
357
|
+
`eval` runs the project's filesystem evals.
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
agent-sdk eval --dir . --list # discovered datapoints
|
|
361
|
+
agent-sdk eval --dir . # run all
|
|
362
|
+
agent-sdk eval --dir . builds/checkout # one datapoint
|
|
363
|
+
agent-sdk eval --dir . builds # every datapoint in the file
|
|
364
|
+
agent-sdk eval --dir . --tag smoke # by tag (repeatable)
|
|
365
|
+
agent-sdk eval --dir . --json # machine-readable results
|
|
366
|
+
agent-sdk eval --dir . --verbose # stream t.log lines + reply snippets
|
|
367
|
+
agent-sdk eval --prod --slug pr-approver --team 123
|
|
368
|
+
# prints Eval ID immediately on --prod/--url; then:
|
|
369
|
+
agent-sdk eval status <evalId> --prod --slug pr-approver
|
|
370
|
+
agent-sdk eval cancel <evalId> --prod --slug pr-approver
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
`eval` runs `evals/**/*.eval.{ts,js}` on an ephemeral server or against
|
|
374
|
+
`--url`. Select one or more exact case IDs, file ID prefixes, or tags.
|
|
375
|
+
Omit selectors to run all cases. Repeated `--tag` flags use OR matching.
|
|
376
|
+
|
|
377
|
+
An eval run requires `evals/evals.config.{ts,js}` with `maxConcurrency`
|
|
378
|
+
between 1 and 200. Timeout priority is the case's `timeoutMs`, the CLI's
|
|
379
|
+
`--timeout-ms`, the config's `timeoutMs`, then 180 seconds.
|
|
380
|
+
|
|
381
|
+
| Flag | Meaning |
|
|
382
|
+
| --- | --- |
|
|
383
|
+
| `--list` | Print discovered cases without running. `--list --json` prints them as an array. |
|
|
384
|
+
| `--tag <tag>` | Run cases with this tag. Repeated flags use OR matching. |
|
|
385
|
+
| `--json` | Print `{ ok, passed, failed, results }`. |
|
|
386
|
+
| `--verbose` | Stream `t.log` lines and reply snippets. |
|
|
387
|
+
| `--no-stream` | Hide live progress on stderr. |
|
|
388
|
+
| `--strict` | Exit `1` when a scored case misses a soft threshold. |
|
|
389
|
+
| `--max-concurrency <n>` | Override `maxConcurrency` from `evals.config.ts`. |
|
|
390
|
+
| `--junit <path>` | Write JUnit XML for CI annotations. |
|
|
391
|
+
| `--artifacts <dir>` | Write run artifacts here. The default is a timestamped directory under `<dir>/.agent-serve/evals/`. |
|
|
392
|
+
| `--no-artifacts` | Skip run artifacts. |
|
|
393
|
+
| `--skip-report` | Ignore reporters from `evals.config.ts` and eval files. |
|
|
394
|
+
| `--out <path>` | Also write the full results JSON to this path (also for `eval status <evalId>`). |
|
|
395
|
+
| `--no-wait` | Return with the Eval ID as soon as a `--prod` or `--url` batch is accepted. |
|
|
396
|
+
| `--timeout-ms <n>` | Per-case timeout override. |
|
|
397
|
+
|
|
398
|
+
Failed cases exit `1`. A scored case also exits `1` under `--strict`.
|
|
399
|
+
No matching cases exit `2`. `eval status` exits `3` while the remote batch
|
|
400
|
+
is still running.
|
|
401
|
+
|
|
402
|
+
## trajectory
|
|
403
|
+
|
|
404
|
+
`trajectory` summarizes a saved event stream.
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
agent-sdk trajectory --events /tmp/run.ndjson [--text]
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
`trajectory` converts a saved NDJSON stream into the trajectory JSON
|
|
411
|
+
returned by `run`. `--text` prints the compact view. The command exits
|
|
412
|
+
non-zero when the reconstructed trajectory failed.
|
|
413
|
+
|
|
414
|
+
## init
|
|
415
|
+
|
|
416
|
+
`init` scaffolds a new project.
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
agent-sdk init ./my-agent # scaffold package.json, tsconfig.json, agent/ + a demo tool
|
|
420
|
+
agent-sdk init ./my-demo --template demo # record a PR walkthrough
|
|
421
|
+
agent-sdk init ./my-reviewer --template security-reviewer # review PRs for security bugs
|
|
422
|
+
agent-sdk init ./my-triage --template triage-linear # comment on Linear issues
|
|
423
|
+
agent-sdk init ./my-triage --template triage-jira # comment on Jira issues
|
|
424
|
+
agent-sdk init ./my-owners --template agentic-owners # review PRs via owners policies
|
|
425
|
+
agent-sdk init ./pr-autofixer --template pr-autofixer # fix PRs on a cloud VM
|
|
426
|
+
agent-sdk init ./pr-autofixer --template pr-autofixer \
|
|
427
|
+
--var repos=acme/widgets,acme/api --json
|
|
428
|
+
agent-sdk init ./my-agent --json # machine-readable summary for tooling
|
|
429
|
+
agent-sdk init # no directory: print the setup guide
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
`init` leaves existing files unchanged and labels each one `create` or
|
|
433
|
+
`exist`. It prints the project path, then runs `npm install` so
|
|
434
|
+
`@cursor/july` resolves for `dev` and `run`.
|
|
435
|
+
|
|
436
|
+
Templates may ship `init.json`. On a TTY, `init` asks those questions
|
|
437
|
+
before writing files. `pr-autofixer` asks for GitHub repos. Repeat
|
|
438
|
+
`--var id=value` to answer without a prompt.
|
|
439
|
+
`--json` and non-TTY hosts skip the interview unless `--var` is set.
|
|
440
|
+
|
|
441
|
+
On a TTY, `init` also asks whether to refresh the coding-agent skills in
|
|
442
|
+
`~/.cursor/skills/agentsdk/`. Installing `@cursor/july` already copies
|
|
443
|
+
them via postinstall (with `alwaysApply: true` so Cursor injects the
|
|
444
|
+
bodies), so this prompt is a chance to overwrite with the package
|
|
445
|
+
version. The prompt is skipped for `--json` and non-interactive hosts.
|
|
446
|
+
|
|
447
|
+
If the host isn't signed in, `init` runs `agent-sdk login` and waits for
|
|
448
|
+
the browser flow. It then prints the `cd`, `agent-sdk login`, and
|
|
449
|
+
`agent-sdk dev` steps still needed.
|
|
450
|
+
|
|
451
|
+
With `--json`, `init` still installs dependencies but never blocks on
|
|
452
|
+
login or skill installation. It prints `{ ok, directory, template, created,
|
|
453
|
+
skipped, installed, installError, cliOnPath, cliLinkError, next }`. The
|
|
454
|
+
`next` list includes `login` when the host is unsigned.
|
|
455
|
+
|
|
456
|
+
## convert-automation
|
|
457
|
+
|
|
458
|
+
`convert-automation` exports a Cursor Automation into an agent project.
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
agent-sdk convert-automation <url> [--dir <path>] [--json]
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
`<url>` is the dashboard URL (`…/automations/<uuid>` or
|
|
465
|
+
`…/custom-agents/<uuid>`) or a bare UUID. The command fetches the
|
|
466
|
+
Automation with your Cursor credentials. It writes converted files to
|
|
467
|
+
`--dir`, which defaults to `./<automation-name>`, adds missing `init`
|
|
468
|
+
scaffold files, and runs `npm install`. File generation does not
|
|
469
|
+
overwrite existing paths. The install may still update lockfiles or run
|
|
470
|
+
lifecycle scripts from an existing `package.json`.
|
|
471
|
+
|
|
472
|
+
MCP servers convert to Cursor-account connections resolved at runtime.
|
|
473
|
+
The project contains their names, not server URLs or credentials.
|
|
474
|
+
Local runs use the signed-in account. Hosted deployments use a separate
|
|
475
|
+
service account; authorize each generated connection with
|
|
476
|
+
[`mcp oauth`](#mcp-oauth) after the first deploy. Review the generated
|
|
477
|
+
project, then run `validate` and `dev`.
|
|
478
|
+
|
|
479
|
+
Warnings do not change the exit status. Bad arguments, authentication
|
|
480
|
+
failures, fetch failures, and file write failures return a nonzero exit
|
|
481
|
+
code.
|
|
482
|
+
|
|
483
|
+
`--json` prints
|
|
484
|
+
`{ ok, directory, files, warnings, setupSteps, installed, installError, mcpConnections }`.
|
|
485
|
+
On failure it prints `{ ok: false, error }` and still writes the prose
|
|
486
|
+
error to stderr.
|
|
487
|
+
|
|
488
|
+
The [Convert a Cursor Automation](/docs/guides/convert-automation.md) guide
|
|
489
|
+
covers generated files and behavior the converter cannot reproduce.
|
|
490
|
+
|
|
491
|
+
## install-skills
|
|
492
|
+
|
|
493
|
+
`install-skills` copies the package's coding-agent skills into
|
|
494
|
+
`~/.cursor/skills/agentsdk/` with `alwaysApply: true` so Cursor loads
|
|
495
|
+
them as global rules. Installing `@cursor/july` already does this in
|
|
496
|
+
postinstall (`npm install`, `npx`, a version bump). Use this command
|
|
497
|
+
to refresh without reinstalling the package, or from a monorepo
|
|
498
|
+
source checkout (postinstall skips that tree).
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
agent-sdk install-skills [--print] [--json]
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Running the command is the confirmation: it never prompts, and it
|
|
505
|
+
overwrites the installed skills with the version bundled in the
|
|
506
|
+
package. `init` offers the same refresh once, interactively. `--print`
|
|
507
|
+
previews the skills, the removals, and the install path without writing
|
|
508
|
+
anything. `--json` prints
|
|
509
|
+
`{ ok, dryRun, directory, firstInstall, skills, removed }`.
|
|
510
|
+
|
|
511
|
+
Set `CURSOR_JULY_SKIP_SKILL_INSTALL=1` to skip the postinstall copy.
|
|
512
|
+
`CURSOR_JULY_SKILLS_HOME` overrides the `~/.cursor/skills` directory.
|
|
513
|
+
|
|
514
|
+
## info
|
|
515
|
+
|
|
516
|
+
`info` prints the discovered agent surface.
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
agent-sdk info --dir . [--json]
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
`info` reports the model, instruction size, tools, skills, MCP
|
|
523
|
+
connections, subagents, channel routes, schedules, hooks, and
|
|
524
|
+
diagnostics. Text output summarizes each mounted agent. `--json` prints
|
|
525
|
+
`{ agents: [{ slug, ...projectInfo }] }`, with one entry per mounted
|
|
526
|
+
slug. Use `validate`, not `info --json`, when a script needs an error
|
|
527
|
+
exit status.
|
|
528
|
+
|
|
529
|
+
## validate
|
|
530
|
+
|
|
531
|
+
`validate` checks the project and sets the exit code.
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
agent-sdk validate --dir .
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
`validate` prints diagnostics for each agent and exits non-zero when any
|
|
538
|
+
diagnostic has error severity. `serve` also refuses to start when errors
|
|
539
|
+
are present. Warnings don't change the exit status.
|
|
540
|
+
|
|
541
|
+
## login / logout / whoami
|
|
542
|
+
|
|
543
|
+
Three commands manage the host's Cursor credential.
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
agent-sdk login [--api-key <key>] [--key-name <name>]
|
|
547
|
+
agent-sdk whoami [--json]
|
|
548
|
+
agent-sdk logout
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
`login` signs the host in to Cursor: browser sign-in mints a named,
|
|
552
|
+
dashboard-revocable API key, and only the key is stored (the default
|
|
553
|
+
name is `<invoked command> (<hostname>)`). It powers inference, the cloud
|
|
554
|
+
runtime, and Cursor account MCP connections. `--key-name` changes the
|
|
555
|
+
name of a browser-minted key. `login --api-key` validates and stores a
|
|
556
|
+
key you already created.
|
|
557
|
+
|
|
558
|
+
`whoami` shows which credential is active and why. `CURSOR_API_KEY`
|
|
559
|
+
takes precedence over the stored login. `logout` removes the local
|
|
560
|
+
credential file but doesn't revoke the API key. Revoke it in the Cursor
|
|
561
|
+
dashboard when it should stop working.
|
|
562
|
+
|
|
563
|
+
Non-production backends: login and account RPCs honor
|
|
564
|
+
`CURSOR_API_BASE_URL` while the SDK harness honors `CURSOR_BACKEND_URL`.
|
|
565
|
+
Set both to the same URL, or keys minted on one backend are rejected by
|
|
566
|
+
the other.
|
|
567
|
+
|
|
568
|
+
## update
|
|
569
|
+
|
|
570
|
+
`update` upgrades an installed copy to the latest published version.
|
|
571
|
+
|
|
572
|
+
```bash
|
|
573
|
+
agent-sdk update
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
The command checks npm's `latest` tag, detects how the Agent SDK was installed,
|
|
577
|
+
and runs the matching npm, pnpm, Yarn, or Bun upgrade command. It handles
|
|
578
|
+
global installs and project dependencies. It doesn't prompt before
|
|
579
|
+
running the package-manager command.
|
|
580
|
+
|
|
581
|
+
Source checkouts, `npx` or `pnpm dlx` caches, and unknown install layouts
|
|
582
|
+
aren't changed. The command prints a manual upgrade hint instead.
|
|
583
|
+
|
|
584
|
+
Published installs also check for a newer version at most once every 24
|
|
585
|
+
hours and print an update warning on stderr. Source checkouts, CI, and
|
|
586
|
+
commands with an explicit `--json` flag skip this automatic check.
|
|
587
|
+
|
|
588
|
+
## deploy
|
|
589
|
+
|
|
590
|
+
`deploy` sends one or more agents to Cursor managed hosting.
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
agent-sdk deploy [--dir <path>] [--slug <slug> | --all] [--team <id>]
|
|
594
|
+
[--repo <https-url>] [--ref <git-ref>] [--path <agent-path>]
|
|
595
|
+
[--cursor-events-repo owner/name]...
|
|
596
|
+
[--allow-domain <domain>]... [--no-wait] [--json]
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Managed hosting requires team-admin permission and the team's
|
|
600
|
+
cloud-agent entitlement. `--team` defaults to the signed-in account's
|
|
601
|
+
team.
|
|
602
|
+
|
|
603
|
+
For a single project, the slug defaults to a normalized version of the
|
|
604
|
+
directory name. Deployment slugs contain lowercase letters, digits, `_`,
|
|
605
|
+
or `-`, with a maximum of 64 characters. For a directory with several
|
|
606
|
+
agents, select one with `--slug`, deploy all with `--all`, or choose from
|
|
607
|
+
the TTY prompt. Non-interactive callers must pass `--slug` or `--all`.
|
|
608
|
+
If `--dir` contains no agent project or child agents, `deploy` requires
|
|
609
|
+
`--slug` (or a slug derived from the directory name) and an https git
|
|
610
|
+
repository URL (`--repo`, or inferred from `origin` when `--dir` is an
|
|
611
|
+
agent project). `--all` fails when there is no agent project.
|
|
612
|
+
|
|
613
|
+
The command infers `--repo`, `--ref`, and `--path` from the current Git
|
|
614
|
+
checkout when possible. Explicit flags take precedence. `--repo` must
|
|
615
|
+
use HTTPS. Repeat `--cursor-events-repo` to select SCM event sources.
|
|
616
|
+
Repeat `--allow-domain` to add engine egress domains; these values are
|
|
617
|
+
combined with `hosting.egressDomains` from the agent config. Egress
|
|
618
|
+
domains apply only to repository-backed deployments. Each domain must
|
|
619
|
+
be a lowercase hostname with at least two labels and an alphabetic
|
|
620
|
+
top-level domain. One leading `*.` wildcard is allowed. A deployment
|
|
621
|
+
can declare at most 20 domains.
|
|
622
|
+
|
|
623
|
+
By default, the command polls every three seconds for up to ten minutes
|
|
624
|
+
and succeeds only when the deployment reaches `running`. `--no-wait`
|
|
625
|
+
returns after the deployment request is accepted. Multi-agent deploys
|
|
626
|
+
run sequentially. When several agents are selected, `--path` is ignored
|
|
627
|
+
and each project infers its own path. A single-target `--json` run
|
|
628
|
+
prints one object; a multi-target run prints an array.
|
|
629
|
+
|
|
630
|
+
The first deployment can return an alias token. It appears once in text
|
|
631
|
+
or JSON output and can't be retrieved later. Store it as a secret. Send
|
|
632
|
+
it as `X-Agent-Alias-Token` when calling the stable alias URL, or use it
|
|
633
|
+
to sign in to the hosted playground.
|
|
634
|
+
|
|
635
|
+
See [Deployment](/docs/deployment.md) for the hosting security model and
|
|
636
|
+
state layout.
|
|
637
|
+
|
|
638
|
+
## deployments
|
|
639
|
+
|
|
640
|
+
`deployments` lists the selected team's deployments.
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
agent-sdk deployments [--team <id>] [--json]
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Text output shows each slug, status, generation, deployment kind, and
|
|
647
|
+
update time. `--json` prints `{ deployments }`.
|
|
648
|
+
|
|
649
|
+
## deployment
|
|
650
|
+
|
|
651
|
+
`deployment` prints the full status of one deployment.
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
agent-sdk deployment <slug> [--team <id>] [--json]
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Text output includes status, generation, kind, alias, source, egress
|
|
658
|
+
domains, secret names, engine state, and the last error when present.
|
|
659
|
+
`--json` returns the full API response. It can include short-lived
|
|
660
|
+
`engineAccess.headers`, so handle JSON output as a credential.
|
|
661
|
+
|
|
662
|
+
## stop
|
|
663
|
+
|
|
664
|
+
`stop` shuts down a deployment.
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
agent-sdk stop <slug> [--team <id>] [--no-wait] [--json]
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
The command polls for up to ten minutes until the status reaches
|
|
671
|
+
`stopped`. `--no-wait` returns after the stop request is accepted.
|
|
672
|
+
|
|
673
|
+
## delete
|
|
674
|
+
|
|
675
|
+
`delete` removes a deployment.
|
|
676
|
+
|
|
677
|
+
```bash
|
|
678
|
+
agent-sdk delete <slug> [--team <id>] [--no-wait] [--json]
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
The command waits until the deployment is gone. `--no-wait` returns after
|
|
682
|
+
the delete request is accepted.
|
|
683
|
+
|
|
684
|
+
## rotate-token
|
|
685
|
+
|
|
686
|
+
`rotate-token` replaces the alias token used by callers and the hosted
|
|
687
|
+
playground.
|
|
688
|
+
|
|
689
|
+
```bash
|
|
690
|
+
agent-sdk rotate-token <slug> [--team <id>] [--json]
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
The old token stops working immediately. The replacement is shown once.
|
|
694
|
+
`--json` prints `{ aliasToken }`.
|
|
695
|
+
|
|
696
|
+
## rotate-pod-credential
|
|
697
|
+
|
|
698
|
+
`rotate-pod-credential` replaces the credential used by the running
|
|
699
|
+
engine pod.
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
agent-sdk rotate-pod-credential <slug> [--team <id>] [--json]
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
The command prints only the masked key (`--json` prints
|
|
706
|
+
`{ podCredentialMaskedKey }`). The running pod keeps the old credential
|
|
707
|
+
until the next deploy, so nothing breaks in between. Run
|
|
708
|
+
`agent-sdk deploy --slug <slug>` to inject the replacement and retire
|
|
709
|
+
the old credential.
|
|
710
|
+
|
|
711
|
+
## mcp
|
|
712
|
+
|
|
713
|
+
`mcp` proxies an agent's MCP endpoint over stdio for MCP clients that
|
|
714
|
+
spawn local servers, such as Cursor.
|
|
715
|
+
|
|
716
|
+
```bash
|
|
717
|
+
agent-sdk mcp --prod [--slug <slug>] [--team <id>]
|
|
718
|
+
agent-sdk mcp --url <baseUrl> [--bearer-token <token>]
|
|
719
|
+
agent-sdk mcp install [--prod | --url <baseUrl>] [--name <serverName>]
|
|
720
|
+
[--print] [--json] [--remote]
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
The bare command reads newline-delimited JSON-RPC on stdin and forwards
|
|
724
|
+
one POST per message to `<target>/v1/mcp`. It requires `--prod` or
|
|
725
|
+
`--url`. With `--prod`, it resolves the hosted deployment through the
|
|
726
|
+
signed-in Cursor account and re-mints short-lived engine credentials as
|
|
727
|
+
they expire, so no durable secret lands in a config file. stdout is
|
|
728
|
+
reserved for the MCP wire; logging goes to stderr.
|
|
729
|
+
|
|
730
|
+
`mcp install` writes the matching entry into `~/.cursor/mcp.json` so
|
|
731
|
+
the agent shows up as an MCP server in Cursor. `--name` overrides the
|
|
732
|
+
server name (the default is the slug, or a name derived from `--url`).
|
|
733
|
+
`--print` prints the entry instead of writing the file, and `--json`
|
|
734
|
+
prints a machine-readable result. `--remote` (with `--prod`) writes a
|
|
735
|
+
remote HTTP entry pointing at the stable Cursor MCP gateway instead of
|
|
736
|
+
the local stdio proxy, for MCP hosts that can't spawn stdio servers.
|
|
737
|
+
The remote entry carries your API key in plain text, so treat the file
|
|
738
|
+
as a credential.
|
|
739
|
+
|
|
740
|
+
## mcp oauth
|
|
741
|
+
|
|
742
|
+
`mcp oauth` authorizes a `defineConnection({ url, oauth: true })` or
|
|
743
|
+
`defineConnection({ cursorAccount: true })` connection.
|
|
744
|
+
|
|
745
|
+
URL connections run a browser PKCE flow. Tokens are written to
|
|
746
|
+
`mcp-auth.json` under the agent-serve config dir (default
|
|
747
|
+
`~/.config/agent-serve`). Pass `--store` to upsert matching
|
|
748
|
+
`MCP_OAUTH_<CONNECTION>_*` secrets on the hosted deployment.
|
|
749
|
+
|
|
750
|
+
Cursor-account connections authorize the hosted deployment's service
|
|
751
|
+
account through the Cursor backend's connector consent flow. Those
|
|
752
|
+
tokens live on the Cursor backend, so `--store` isn't needed; the
|
|
753
|
+
command prints a note when you pass it anyway.
|
|
754
|
+
|
|
755
|
+
```bash
|
|
756
|
+
agent-sdk mcp oauth <connection> [--dir .] [--store] [--slug <slug>] [--team <id>]
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
`<connection>` is the `agent/mcp-connections/<connection>.ts` basename.
|
|
760
|
+
`--slug` defaults to the `--dir` basename. `--team` defaults to the
|
|
761
|
+
signed-in account's team. You need `agent-sdk login` (or `--api-key`)
|
|
762
|
+
before `--store`.
|
|
763
|
+
|
|
764
|
+
Secret names are `MCP_OAUTH_<NAME>_ACCESS_TOKEN`,
|
|
765
|
+
`_REFRESH_TOKEN`, and `_CLIENT_ID` (`<NAME>` is the connection id in
|
|
766
|
+
upper snake case). Declare them in `hosting.secretNames` so deploy
|
|
767
|
+
validation expects them. Secrets apply on the next deploy.
|
|
768
|
+
|
|
769
|
+
Tokens are bound to the connection's resource URL. Changing the URL
|
|
770
|
+
invalidates the local entry; run `mcp oauth` again.
|
|
771
|
+
|
|
772
|
+
See the [Host MCP OAuth guide](/docs/guides/mcp-oauth.md).
|
|
773
|
+
|
|
774
|
+
## secrets
|
|
775
|
+
|
|
776
|
+
`secrets` manages environment secrets for a deployment.
|
|
777
|
+
|
|
778
|
+
```bash
|
|
779
|
+
agent-sdk secrets set <slug> NAME [NAME2 ...] [--team <id>] [--json]
|
|
780
|
+
agent-sdk secrets list <slug> [--team <id>] [--json]
|
|
781
|
+
agent-sdk secrets unset <slug> NAME [--team <id>] [--json]
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
Pass names only. On a TTY, `secrets set` prompts for each value with
|
|
785
|
+
hidden input (nothing echoes). When stdin is piped, provide one line per
|
|
786
|
+
name. Values never print on stdout.
|
|
787
|
+
|
|
788
|
+
Do not put values on the command line. `NAME=VALUE` in argv shows up in
|
|
789
|
+
shell history and in agent-captured terminals. The CLI refuses that form
|
|
790
|
+
unless you pass `--from-argv` (still warns). Prefer a file redirect when
|
|
791
|
+
a human is not at the prompt:
|
|
792
|
+
|
|
793
|
+
```bash
|
|
794
|
+
agent-sdk secrets set weather-agent WEATHER_API_KEY < ./weather-api-key.txt
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
Secret names use `UPPER_SNAKE_CASE`, start with a letter, and contain at
|
|
798
|
+
most 64 characters. Names beginning with `CURSOR_` are reserved. Values
|
|
799
|
+
can contain at most 4096 bytes, and one deployment can hold 32 secrets.
|
|
800
|
+
|
|
801
|
+
`secrets list` returns names and creation times, never values. Secret
|
|
802
|
+
changes reach the engine on its next deploy. `secrets set` upserts the
|
|
803
|
+
named secrets without deleting others.
|
|
804
|
+
|
|
805
|
+
JSON output is `{ secretNames }` for `set`, `{ secrets }` for `list`,
|
|
806
|
+
and `{ removed }` for `unset`.
|
|
807
|
+
|
|
808
|
+
## slack
|
|
809
|
+
|
|
810
|
+
The `slack` pack provisions, generates, and checks Socket Mode channel
|
|
811
|
+
setup.
|
|
812
|
+
|
|
813
|
+
```bash
|
|
814
|
+
agent-sdk slack setup
|
|
815
|
+
agent-sdk slack create [--dir <path>] [--name <name>] [--prod]
|
|
816
|
+
[--slack-team <T…>] [--team <id>]
|
|
817
|
+
[--icon <https-url-or-file>]
|
|
818
|
+
[--prefix <prefix> | --no-prefix]
|
|
819
|
+
[--channel-posts] [--json]
|
|
820
|
+
agent-sdk slack destroy [--dir <path>] [--prod] [--slack-team <T…>]
|
|
821
|
+
[--team <id>] [--json]
|
|
822
|
+
agent-sdk slack icon <https-url-or-file> [--dir <path>] [--prod]
|
|
823
|
+
[--slack-team <T…>] [--team <id>] [--json]
|
|
824
|
+
agent-sdk slack init --manual [--dir <path>] [--name <name>]
|
|
825
|
+
[--prefix <prefix> | --no-prefix] [--channel-posts]
|
|
826
|
+
agent-sdk slack manifest [--dir <path>] [--name <name>]
|
|
827
|
+
[--env dev|prod|both] [--channel-posts] [--print]
|
|
828
|
+
agent-sdk slack doctor [--dir <path>] [--prefix <prefix> | --no-prefix] [--json]
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
`slack setup` prints the two-product chooser plus the `--manual` setup
|
|
832
|
+
checklist. It doesn't change files.
|
|
833
|
+
|
|
834
|
+
`slack create` opens the signed-in Cursor dashboard wizard. Finish Slack
|
|
835
|
+
consent and the bot name there. The CLI writes the token pair into
|
|
836
|
+
`<dir>/.env.local` and runs `doctor`. It requires a signed-in host
|
|
837
|
+
(`agent-sdk login` or `CURSOR_API_KEY`). `--prod` provisions the
|
|
838
|
+
production app; the default is the development app. `--name` / `--icon`
|
|
839
|
+
/ `--channel-posts` prefill the wizard. A second create for the same
|
|
840
|
+
slug and env overwrites the live Slack app. If Slack needs a workspace
|
|
841
|
+
admin's approval, the wizard waits; keep the CLI running, open Slack's
|
|
842
|
+
**Request approval** page (the CLI prints the link), and click **Retry**
|
|
843
|
+
after the admin approves. Token values never print.
|
|
844
|
+
|
|
845
|
+
`slack destroy` deletes the provisioned app for the selected
|
|
846
|
+
environment. Tokens already written to `.env.local` stay in place and
|
|
847
|
+
stop working.
|
|
848
|
+
|
|
849
|
+
`slack icon` sets the provisioned app's icon from an https image URL or
|
|
850
|
+
a local png, jpg, or gif file of at most 512KB.
|
|
851
|
+
|
|
852
|
+
`slack init` without `--manual` exits non-zero and writes no files. Use
|
|
853
|
+
`slack create` for the dashboard wizard. `slack init --manual` writes
|
|
854
|
+
the channel file, development and production manifests, `env.example`,
|
|
855
|
+
and setup status under the project. You paste those manifests at
|
|
856
|
+
api.slack.com. The command refuses to overwrite a target file. If a
|
|
857
|
+
collision occurs, it exits non-zero; files created earlier in the run
|
|
858
|
+
remain. The token prefix defaults to the directory basename normalized
|
|
859
|
+
to uppercase snake case. Explicit `--prefix` values use the same
|
|
860
|
+
normalization. For example, `pr-approver` becomes
|
|
861
|
+
`PR_APPROVER_SLACK_BOT_TOKEN`. `--no-prefix` uses shared
|
|
862
|
+
`SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`. `--channel-posts` subscribes
|
|
863
|
+
the manifests to channel-post events. The command always prints a JSON
|
|
864
|
+
summary.
|
|
865
|
+
|
|
866
|
+
`slack manifest` regenerates selected manifest files. `--env` defaults
|
|
867
|
+
to `both`, and `--name` defaults to the directory name. `--print` writes
|
|
868
|
+
the manifest JSON to stdout instead of changing files. With the default
|
|
869
|
+
`--env both`, it prints development JSON, a `--- prod ---` separator,
|
|
870
|
+
then production JSON.
|
|
871
|
+
|
|
872
|
+
`slack doctor` checks both tokens, Socket Mode connectivity, and
|
|
873
|
+
Slack's `auth.test`. It exits non-zero when any check fails.
|
|
874
|
+
|
|
875
|
+
See the [Slack guide](/docs/guides/slack.md).
|
|
876
|
+
|
|
877
|
+
## github
|
|
878
|
+
|
|
879
|
+
The `github` pack discovers `githubChannel()` definitions and sends live
|
|
880
|
+
or synthesized deliveries to them.
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
agent-sdk github doctor [--install] [--json]
|
|
884
|
+
agent-sdk github events [--dir <path>] [--host <host>] [--port <n>] [--json]
|
|
885
|
+
agent-sdk github forward [--dir <path>] [--slug <slug>] [--channel <id>]
|
|
886
|
+
[--repo owner/repo | --org <org>] [--events a,b,c] [--url <url>]
|
|
887
|
+
[--host <host>] [--port <n>] [--secret <secret>] [--install]
|
|
888
|
+
agent-sdk github replay <pr-url|owner/repo#N> --dir .
|
|
889
|
+
[--events a,b,c|'*'] [--action <action>] [--conclusion <result>]
|
|
890
|
+
[--comment <body>] [--context <name>] [--slug <slug>] [--channel <id>]
|
|
891
|
+
[--host <host>] [--port <n>] [--url <url>] [--secret <secret>]
|
|
892
|
+
[--dry-run] [--out <dir>] [--json]
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
`github events` prints each discovered channel's delivery URL and event
|
|
896
|
+
set. When it finds no channels, it returns an empty result and exits
|
|
897
|
+
successfully.
|
|
898
|
+
|
|
899
|
+
`github forward` wraps `gh webhook forward`. It infers the repository
|
|
900
|
+
from the Git remote when you omit `--repo` and `--org`. URLs and events
|
|
901
|
+
come from the discovered channels; `--events` overrides the event set.
|
|
902
|
+
Use `--slug` or `--channel` to narrow discovery when several channels
|
|
903
|
+
match. Otherwise, one local proxy fans deliveries out to every match.
|
|
904
|
+
`--url` targets one channel. For `forward`, pass `--events` when no
|
|
905
|
+
matched channel can supply the event set.
|
|
906
|
+
|
|
907
|
+
Repository forwarding needs repo-admin access. Organization forwarding
|
|
908
|
+
needs org-owner access. The relay authenticates with the GitHub CLI's
|
|
909
|
+
stored login. A `GITHUB_TOKEN` or `GH_TOKEN` environment override can
|
|
910
|
+
make delivery requests return `401`, even when hook creation succeeds.
|
|
911
|
+
Unset those variables before forwarding.
|
|
912
|
+
|
|
913
|
+
Pass `--secret` or set `GITHUB_WEBHOOK_SECRET` to sign deliveries.
|
|
914
|
+
`serve --dev` accepts unsigned loopback deliveries. A non-dev target
|
|
915
|
+
requires the same secret on both sides.
|
|
916
|
+
|
|
917
|
+
`github replay` needs read access, not admin access. It reads the pull
|
|
918
|
+
request through `gh api`, builds GitHub webhook payloads, and posts them
|
|
919
|
+
to the selected channels. Supported events are `pull_request`,
|
|
920
|
+
`issue_comment`, `pull_request_review_comment`, `check_run`,
|
|
921
|
+
`check_suite`, `workflow_run`, and `status`. The default is
|
|
922
|
+
`pull_request` with action `synchronize`. Comment events need
|
|
923
|
+
`--comment`.
|
|
924
|
+
|
|
925
|
+
Use `--events '*'` to replay every supported event declared by the
|
|
926
|
+
channel. `--dry-run` prints payloads without posting them. `--out`
|
|
927
|
+
writes fixture files but still posts unless you also pass `--dry-run`.
|
|
928
|
+
|
|
929
|
+
`github doctor` checks `gh`, its login, and the pinned
|
|
930
|
+
`cli/gh-webhook` extension. `--install` installs or repairs the
|
|
931
|
+
extension. An environment-token override is a warning and doesn't make
|
|
932
|
+
`github doctor` fail.
|
|
933
|
+
|
|
934
|
+
See the [GitHub guide](/docs/guides/github.md).
|
|
935
|
+
|
|
936
|
+
## Environment variables
|
|
937
|
+
|
|
938
|
+
These environment variables affect the CLI and its channel packs.
|
|
939
|
+
|
|
940
|
+
| Variable | Meaning |
|
|
941
|
+
| --- | --- |
|
|
942
|
+
| `CURSOR_API_KEY` | Cursor credential. It takes precedence over the stored login. |
|
|
943
|
+
| `CURSOR_API_BASE_URL` | Backend used by login, account, deployment, and event-relay RPCs in non-production environments. |
|
|
944
|
+
| `CURSOR_BACKEND_URL` | Backend used by the Cursor SDK harness in non-production environments. |
|
|
945
|
+
| `AGENT_SERVE_CONFIG_DIR` | Directory for stored credentials and update-check state. The default is `~/.config/agent-serve`. |
|
|
946
|
+
| `AGENT_SERVE_NO_UPDATE_CHECK` / `NO_UPDATE_NOTIFIER` | Disable the automatic published-version check when set to a non-empty value other than `0`. |
|
|
947
|
+
| `CI` | Disable the automatic published-version check when set. |
|
|
948
|
+
| `GITHUB_WEBHOOK_SECRET` | Default signing secret for GitHub forwarding and replay. |
|
|
949
|
+
| `GITHUB_APP_ID` / `GITHUB_APP_PRIVATE_KEY` / `GITHUB_APP_INSTALLATION_ID` | GitHub App authentication for outbound API calls. |
|
|
950
|
+
| `GITHUB_TOKEN` / `GH_TOKEN` | Token authentication for outbound API calls. Unset both for `github forward`. |
|
|
951
|
+
| `SLACK_BOT_TOKEN` / `SLACK_APP_TOKEN` | Slack tokens for one agent. Use `<PREFIX>_SLACK_BOT_TOKEN` and `<PREFIX>_SLACK_APP_TOKEN` for each agent on a multi-agent host. |
|
|
952
|
+
|
|
953
|
+
## What's next
|
|
954
|
+
|
|
955
|
+
- [Project layout](/docs/reference/project-layout.md): files the CLI discovers
|
|
956
|
+
- [HTTP API](/docs/reference/http-api.md): routes used by `chat`, `call`, and other clients
|
|
957
|
+
- [Deployment](/docs/deployment.md): production auth, state, and operations
|