CLI Usage¶
The Savanty command-line interface provides quick access to the optimization solver from your terminal.
Basic Usage¶
Commands and Options¶
Solve a Problem¶
Start Web Interface¶
Bash
savanty --web # Default port 8000
savanty --web --port 3000 # Custom port
savanty -w -p 3000 # Short form
Run as MCP Server¶
For Model Context Protocol integration:
Show Version¶
Show Help¶
Interactive Mode¶
When Savanty needs more information, it enters interactive mode:
Text Only
$ savanty -p "Schedule nurses for shifts"
I need more information to solve this problem:
1. How many nurses are available?
2. What shifts exist?
3. How many days should the schedule cover?
Please provide the missing information: 4 nurses, morning/afternoon/night shifts, 7 days
The solver continues with your additional information.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success - solution found |
| 1 | Error - problem couldn't be solved |
Examples¶
Simple Scheduling¶
Bash
savanty -p "Schedule Alice and Bob for morning and evening shifts on Monday and Tuesday. Each shift needs one person, no one works both shifts on the same day."
With Pipe¶
In a Script¶
Bash
#!/bin/bash
PROBLEM="Schedule maintenance for 5 machines over 3 days"
RESULT=$(savanty -p "$PROBLEM")
echo "Solution: $RESULT"
Environment Variables¶
Set these before running:
Bash
export OPENAI_API_KEY=your_key_here
export SAVANTY_LLM_MODEL=openai/gpt-4o
export SAVANTY_PORT=8000
export SAVANTY_LOG_LEVEL=INFO
Common Issues¶
"OPENAI_API_KEY not configured"¶
Set your API key:
Problem Timeout¶
For complex problems, increase the timeout:
"Not suitable for ASP"¶
Some problems are better solved with other tools. Savanty will suggest alternatives:
Text Only
This problem is better suited for a different tool.
Reason: This appears to be a continuous optimization problem.
Suggested tool: scipy (pip install scipy)
Tips¶
- Quote your problem to preserve spaces and special characters
- Use multi-line input for complex problems by using quotes
- Check logs with
SAVANTY_LOG_LEVEL=DEBUGfor troubleshooting