cortex agent exec

Execute agent tasks non-interactively in one-shot mode. The agent processes the prompt, runs tools as needed, and returns the result — useful for scripting and automation.

Usage

cortex agent exec [options] "<prompt>"

Options

OptionDescription
--provider, -pLLM provider to use
--model, -mModel name
--max-turnsMaximum tool-call turns (default: 12)
--streamEnable streaming output
--sessionResume an existing session by ID
--file, -fRead prompt from a file

Examples

cortex agent exec "Analyze the performance of src/server/ and suggest optimizations"
cortex agent exec -m claude-sonnet-4-5 "Review this codebase for security vulnerabilities"
cortex agent exec -f ./tasks/weekly-report.md