JSON Output
Machine-readable JSON output schemas for AI agents
Every Gibil command supports --json for structured, machine-readable output. This is how AI agents interact with Gibil.
gibil create --json
{
"name": "my-app",
"ip": "49.13.42.101",
"server_id": 12345678,
"ssh_key_id": 87654321,
"status": "ready",
"ttl": 30,
"created_at": "2024-01-15T10:30:00Z"
}gibil run --json
{
"stdout": "✓ 53 tests passing\n",
"stderr": "",
"exit_code": 0
}gibil list --json
[
{
"name": "my-app",
"ip": "49.13.42.101",
"server_id": 12345678,
"status": "running",
"ttl": 30,
"created_at": "2024-01-15T10:30:00Z"
}
]gibil destroy --json
{
"name": "my-app",
"status": "destroyed"
}Error output
When a command fails, JSON output includes an error field:
{
"error": "Server 'my-app' not found",
"exit_code": 1
}Usage with jq
# Get the IP of a newly created server
IP=$(gibil create --name task --json | jq -r .ip)
# Check if tests passed
EXIT=$(gibil run task "pnpm test" --json | jq .exit_code)
if [ "$EXIT" -eq 0 ]; then echo "Tests passed"; fi
# List all server names
gibil list --json | jq -r '.[].name'