grok CLI.
The Agent sends each turn to grok, which uses your xAI subscription login — no XAI_API_KEY required.
Quick Start
1
Install the Grok CLI
2
Run an Agent through Grok
cli_backend= is deprecated (removal in 2.0.0). Prefer runtime="grok-cli" — see Runtime Selection.How It Works
Each turn spawnsgrok with your subscription session. No API key is passed.
Use as Agent Backend
Delegate an Agent’s LLM turns togrok -p instead of the xAI API — uses your xAI subscription.
Backend Configuration
Thegrok-cli backend ships with this default configuration:
Backend CLI Flags
The backend builds thegrok command with these flags:
Session Resume
The backend forwards--resume <session_id> only when the session is a resume — it checks session.is_resume before adding the flag. First turns start fresh.
Configuration Surfaces
Override the default timeout (or any config field) with the dict form:Best Practices
Authenticate once with grok login
Authenticate once with grok login
Run
grok login before your first Agent turn. The backend uses whatever subscription session the CLI is signed into — no XAI_API_KEY needed.Raise the timeout for long turns
Raise the timeout for long turns
The default
timeout_ms is 5 minutes. For long-running turns, override it:Attach images when needed
Attach images when needed
Pass image paths and the backend forwards each as
--image <path>. Useful for visual tasks the model can inspect.Prefer runtime='grok-cli'
Prefer runtime='grok-cli'
cli_backend= still works but emits a DeprecationWarning. Use runtime="grok-cli" for the modern equivalent, or run praisonai doctor fix --execute to migrate YAML.Robustness (PR #4111)
- A subprocess
TimeoutErroris now returned asCliBackendResult(error=...)instead of escaping as an exception. - On
CalledProcessError, the CLI’s actual stderr diagnostic is surfaced (previously only the exit status was shown). --modeland cwd are threaded through, so scheduled runs can pin a model and run in a workspace.CliSessionBinding.is_resumeis now set on the second turn of a session, so the resume branch runs instead of re-sending the system prompt every turn.
Related
Codex CLI
Delegate Agent turns to OpenAI’s Codex CLI using your ChatGPT subscription.
Gemini CLI
Delegate Agent turns to Google’s Gemini CLI using your Google account.
Claude Code
The flagship CLI backend — works with Claude Pro / Max subscriptions.
CLI Backend Protocol
How CLI backends plug into the Agent API.

