Skip to main content

cog run

Run a Cognitive Module.

Command Name

This documentation uses cog (npm version). If using the pip version, replace cog with cogn.

Syntax

cog run <module> [input_file] [options]

Arguments

ArgumentDescription
moduleModule name or path
input_fileInput JSON file (optional, can be omitted when using --args)

Options

OptionShortDescription
--output FILE-oOutput file path
--args TEXT-aPass text argument directly
--prettyFormat JSON output
--no-validateSkip Schema validation
--subagent-sEnable sub-agent mode
--model MODEL-mOverride LLM model

Examples

Using JSON File

cog run ui-spec-generator input.json -o output.json --pretty

Using --args

cog run code-reviewer --args "def foo(): pass" --pretty

Enable Sub-agent

cog run product-analyzer --args "health product" --subagent --pretty

Specify Model

cog run code-reviewer --args "code" --model gpt-4-turbo

Save Output

cog run api-designer --args "user API" -o api-spec.json --pretty

Output

On successful run:

→ Running module: code-reviewer
{
"issues": [...],
"confidence": 0.95
}
Confidence: 0.95

On failure:

→ Running module: code-reviewer
✗ Error: Output validation failed: [...]

Environment Variables

VariableDescription
LLM_PROVIDERLLM backend (openai/anthropic/minimax/ollama/stub)
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
MINIMAX_API_KEYMiniMax API key
LLM_MODELDefault model