Run Gammacode programmatically without interactive UI
Overview
The headless mode allows you to run Gammacode programmatically from command line scripts and automation tools without any interactive UI.Basic usage
The primary command-line interface to Gammacode is thegammacode run
command:
Configuration Options
Headless mode leverages all the CLI options available in Gammacode. Here are the key ones for automation and scripting:Flag | Description | Example |
---|---|---|
message.. | Message to send (positional arguments) | gammacode run "analyze this code" |
--command | The command to run, use message for args | gammacode run --command "analyze" "this code" |
-c, --continue | Continue the last session | gammacode run --continue "now optimize it" |
-s, --session | Session id to continue | gammacode run --session abc123 "update tests" |
-m, --model | Model to use in the format of provider/model | gammacode run --model "anthropic/claude-3-sonnet" "review code" |
--agent | Agent to use | gammacode run --agent security-analyzer "check for vulnerabilities" |
--format | Format: default (formatted) or json (raw JSON events) | gammacode run --format json "analyze performance" |
-v, --version | Show version number | gammacode run --version |
--help | Show help | gammacode run --help |
Multi-turn conversations
For multi-turn conversations, you can resume conversations or continue from the most recent session:Output Formats
Default Output
JSON Output
Returns structured data including metadata:Agent Integration Examples
SRE Incident Response Bot
Automated Security Review
Multi-turn Legal Assistant
Specialized Agent Usage
Using specific agents for tasks
Best Practices
-
Use JSON output format for programmatic parsing of responses:
-
Handle errors gracefully - check exit codes and stderr:
- Use session management for maintaining context in multi-turn conversations
- Leverage specialized agents for domain-specific tasks to get better results
-
Consider timeouts for long-running operations:
- Respect rate limits when making multiple requests by adding delays between calls