Cursor CLI Integration
PraisonAI provides integration with Cursor’s CLI (cursor-agent) for headless code automation, file modifications, and streaming output.Installation
Download and install Cursor from cursor.com, which includes the CLI.Quick Start
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
workspace | str | ”.” | Working directory for CLI execution |
timeout | int | 300 | Timeout in seconds |
output_format | str | ”json” | Output format: “json”, “text”, “stream-json” |
force | bool | False | Allow file modifications |
model | str | None | Model to use (e.g., “gpt-5”) |
stream_partial | bool | False | Stream partial output |
resume_session | str | None | Session ID to resume |
Examples
Basic Execution
Force Mode (File Modifications)
Model Selection
Session Resume
Streaming Output
As Agent Tool
Environment Variables
CLI Flags Used
The integration uses the following Cursor CLI flags:| Flag | Description |
|---|---|
-p | Print mode (headless) |
--force | Allow file modifications |
-m | Model selection |
--output-format json | JSON output for parsing |
--stream-partial-output | Stream partial results |
--resume | Resume a previous session |
Output Formats
JSON Output
Stream JSON Output
Error Handling
Authentication
Cursor CLI supports two authentication methods:Browser-Based Login (Recommended)
API Key
Best Practices
- Use force=True only when file modifications are needed
- Set appropriate model based on task complexity
- Use session resume for multi-step tasks
- Enable streaming for long-running tasks
- Set timeouts appropriate for task complexity
- Use JSON output for programmatic processing

