AnyAgent

Cursor

Use the Cursor CLI through AnyAgent: what you can ask for, how it behaves, and the flags underneath.

The cursor adapter drives the Cursor CLI in headless print mode, detected as the agent binary on PATH (the legacy cursor-agent name also resolves); import cursor from anyagent/cursor.

What you can ask for

readOnly, model, effort, and resume work on the CLI’s own flags; systemPrompt and schema are provided by AnyAgent. mcp is undeclared: reach Cursor’s own agent mcp configuration via extraArgs. readOnly runs plan mode, which the CLI enforces read-only. authStatus() asks agent status --format json and models() parses agent --list-models, every listed id valid verbatim as model. The full grid is on the support matrix.

Good to know

  • effort has no standalone flag; it rides in the model id’s bracket overrides, so effort without model throws InvalidOptions. model: "m", effort: "high" becomes --model m[effort=high].
  • Effort and speed variants are also baked into model ids (gpt-5.3-codex-low, …-high-fast); picking one of those needs no effort.
  • The init event’s session id lands on result.sessionId; pass it back as resume.
  • Usage reports cache reads and writes as separate line items; no cost and no reasoning tokens are reported.

Under the hood

Every run executes agent -p --output-format stream-json --trust --force with the prompt piped over stdin. Run options change the mode and append flags:

OptionFlag
readOnly: true--mode plan in place of --force
model--model <id>, bracket overrides pass through verbatim ("claude-opus-4-8[context=1m]")
effortcompiled into the model’s bracket overrides
resume--resume <chatId>

On this page