CursorCliSdk.Options is the typed input for streaming and synchronous Cursor invocations.

options =
  CursorCliSdk.Options.new!(
    cwd: "/workspace/app",
    model: "composer-2.5-fast",
    mode: :ask,
    permission_mode: :bypass,
    approve_mcps: true
  )

Core Fields

FieldMeaning
:cli_commandOptional command path. Defaults to provider resolution for agent.
:cwdProcess cwd and Cursor --workspace <cwd>. This is the only workspace field.
:modelModel name passed as --model.
:api_keyMaterialized as CURSOR_API_KEY in the child env, never argv.
:envAdditional child environment map for standalone runs.
:timeout_msStream receive timeout.
:max_stderr_buffer_bytesTail buffer size for stderr diagnostics.

Cursor Native Fields

FieldCLI behavior
:modeCursor operational mode. :ask becomes --mode ask; :agent omits the flag.
:permission_modeProvider permission posture. :bypass maps to --force; :plan maps to --mode plan.
:trustEmits --trust when true.
:output_formatDefaults to stream-json.
:stream_partial_outputEmits --stream-partial-output when true.
:resumeEmits --resume <session_id>.
:continueTracks latest-session continuation intent for runtimes that expose it.
:sandboxEmits --sandbox <value> for string or true values.
:approve_mcpsEmits --approve-mcps.
:worktreeEmits --worktree or --worktree <value>.
:worktree_baseEmits --worktree-base <path>.
:skip_worktree_setupEmits --skip-worktree-setup.
:plugin_dirsRepeated --plugin-dir <path>.
:headersRepeated -H <header>.

Permission Mode vs Mode

:ask is a Cursor mode, not a permission mode:

CursorCliSdk.Options.new!(mode: :ask, permission_mode: :default)

Bypass is a permission posture:

CursorCliSdk.Options.new!(permission_mode: :bypass)

Governed Fields

governed_authority switches the SDK into governed launch mode. In that mode caller-owned launch placement is rejected:

  • :api_key
  • :cli_command
  • :cwd
  • :env
  • non-empty :execution_surface

See Governed Launch.