axon run command performs full end-to-end execution of AXON programs, from source code to final output. It compiles the source, targets a backend, and executes through the AXON runtime.
Synopsis
Description
Executes the complete AXON pipeline:- Compile — Lex → Parse → Type Check → IR Generation
- Backend Compile — Transform IR to backend-specific prompts
- Execute — Run through the AXON runtime with configured backend
- Output — Display results and optional execution trace
Arguments
Path to the
.axon source file to executeOptions
LLM backend to use for execution.Choices:
anthropic, openai, gemini, ollamaShort form: -bSave execution trace to
<filename>.trace.json for debugging and analysis.Tool execution mode:
- stub: Use fake tools (no external calls, safe for testing)
- real: Use production tool backends (requires API keys)
- hybrid: Prefer real tools, fallback to stubs
stub, real, hybridExit Codes
| Code | Meaning |
|---|---|
0 | Success — execution completed without errors |
1 | Compilation or execution error |
2 | I/O error or missing API key |
Output Format
Success Output
With Trace Saved
Error Output
Examples
Basic Execution
Production Execution
With Execution Trace
Different Backends
Safe Testing with Stubs
- Unit testing
- CI/CD pipelines
- Development without API keys
Hybrid Mode (Recommended)
- Uses real tools where API keys are available
- Falls back to stubs automatically
- Best for development environments
Batch Execution
CI/CD Integration
Execution Trace
When--trace is enabled, AXON records detailed execution information:
- Step execution
- Model API calls
- Anchor checks
- Validation results
- Retry attempts
- Memory operations
Tool Modes Explained
Stub Mode (Default)
- All tools return fake data
- No external API calls
- No file system access
- Deterministic results
- Testing
- CI/CD
- Development without credentials
- WebSearch → Returns mock search results
- FileReader → Returns mock file contents
- CodeExecutor → Returns mock execution results
- PDFExtractor, ImageAnalyzer, APICall (stubs)
- Calculator, DateTime (always real)
Real Mode
- All tools use production backends
- Requires API keys for external services
- Fails if dependencies missing
- Production execution
- Integration testing
- Real-world workflows
- WebSearch → Serper.dev API
- FileReader → Local filesystem
- CodeExecutor → subprocess execution
- Calculator, DateTime → stdlib (always available)
Hybrid Mode (Recommended)
- Prefers real backends where available
- Falls back to stubs automatically
- Graceful degradation
- Development with partial credentials
- Mixed test/production environments
- Gradual rollout of real tools
Backend Configuration
Each backend requires specific setup. See API Keys for detailed configuration.Anthropic (Claude)
claude-3-5-sonnet-20241022 (default)
OpenAI (GPT)
gpt-4-turbo or gpt-4o (varies by backend logic)
Google Gemini
gemini-1.5-pro
Ollama (Local)
llama3.1, mistral, or custom local models
Troubleshooting
Missing API Key
Execution Failed
Tool Backend Error
- Set the required API key, OR
- Use
--tool-mode stubfor testing
Network Timeout
Solution: Increase timeout in your program or check network connectivity.Related Commands
check
Validate before running
compile
Compile without execution
trace
Analyze execution traces
Performance Tips
- Use stubs for development: Avoid API costs and latency
- Enable tracing selectively: Adds ~5-10% overhead
- Batch similar programs: Reuse backend connections
- Cache compiled IR: Use
axon compile+ load IR for repeated runs
