Loading...
Loading...
Manage Blaxel resources from the command line using the bl CLI. Deploy agents, sandboxes, jobs, and MCP servers. Also installs the Blaxel CLI if not present.
npx skill4agent add blaxel-ai/agent-skills blaxel-cliblbl versioncurl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | shbrew tap blaxel-ai/blaxel && brew install blaxelbl login my-workspace| Flag | Description |
|---|---|
| Output format: pretty, yaml, json, table |
| Override workspace for this command |
| Enable verbose output |
| Enable UTC timezone |
| Skip version warning |
-y--yesbl apply # Apply configuration changes to resources declaratively using YAML files.
bl chat # Start an interactive chat session with a deployed agent.
bl connect # Open an interactive terminal session to a sandbox
bl delete # Delete Blaxel resources from your workspace.
bl deploy # Deploy your Blaxel project to the cloud.
bl drive # Manage drives and drive mounts on sandboxes.
bl get # Retrieve information about Blaxel resources in your workspace.
bl login # Authenticate with Blaxel to access your workspace.
bl logout # Remove stored credentials for a workspace.
bl logs # View logs for Blaxel resources.
bl new # Create a new Blaxel resource from templates.
bl push # Build and push a container image to the Blaxel registry without creating a deployment.
bl run # Execute a Blaxel resource with custom input data.
bl serve # Start a local development server for your Blaxel project.
bl share # Share Blaxel resources with other workspaces in your account.
bl token # Retrieve the authentication token for the specified workspace.
bl unshare # Remove shared Blaxel resources from other workspaces.
bl upgrade # Upgrade the Blaxel CLI to the latest version.
bl version # Print the version number
bl workspaces # List and manage Blaxel workspaces.--helpbl --help
bl deploy --help
bl get --help
bl get agents --help# 1. Create a sandbox with bl apply
bl apply -f - <<EOF
apiVersion: blaxel.ai/v1alpha1
kind: Sandbox
metadata:
name: my-sandbox
spec:
runtime:
image: blaxel/base-image:latest
memory: 2048
lifecycle:
expirationPolicies:
- type: ttl-idle
value: 1h # Delete after 1 hour of inactivity. Units: h, d, w
action: delete
EOF
# 2. Retrieve sandbox configuration
bl get sandbox my-sandbox
# 3. Execute a command in the sandbox and get stdout of the command
bl run sandbox my-sandbox --path /process --data '{"command": "echo hello world", "name": "my-cmd", "waitForCompletion": true}'
# 4. Retrieve the logs for that command in case stdout was not sufficient
bl logs sandbox my-sandbox my-cmdbl run sandbox ... --path /process --data '<json>'sh -lcpython3 -c--data400 Bad Request: invalid character ... in string escape code--data '{"command": "...", "waitForCompletion": true}'--file# Step 1 — agent writes /tmp/process.json with content like:
# {
# "command": "sh -lc 'python3 -c \"print(\\\"hello\\\")\"'",
# "name": "cve-check",
# "waitForCompletion": true
# }
#
# Step 2 — execute it
bl run sandbox my-sandbox --path /process --file /tmp/process.jsonbl new agent my-agent
cd my-agent
bl serve --hotreload # Test locally
bl deploy # Deploy to cloud
bl chat my-agent # Chat with itbl get sandboxes # List all
bl get sandbox my-sandbox --watch # Watch status
bl connect sandbox my-sandbox # Interactive terminal
bl logs sandbox my-sandbox --follow # Stream logs
bl delete sandbox my-sandbox # Clean upbl workspaces dev # Switch to dev
bl deploy # Deploy to dev
bl workspaces prod # Switch to prod
bl deploy # Deploy to prod