How to Install and Configure Antigravity AI for Automated Physics Simulation Workflows
How to Install and Configure Antigravity AI for Automated Physics Simulation Workflows
Antigravity AI is a powerful simulation engine that leverages machine learning to accelerate physics simulations for engineering, VFX, and scientific research. This guide walks you through installing the Python SDK, managing API keys, integrating with Blender, and building automated simulation workflows from scratch.
Prerequisites
- Python 3.9 or later
- pip or conda package manager
- An Antigravity AI account (antigravity.ai)
- Blender 3.6+ (for Blender integration)
- CUDA-compatible GPU recommended for large simulations
Step 1: Install the Antigravity AI Python SDK
Install the core SDK and optional dependencies using pip:
# Install core SDK pip install antigravity-aiInstall with Blender integration and GPU acceleration
pip install antigravity-ai[blender,gpu]
Verify installation
antigravity —version
For conda environments:
conda install -c antigravity antigravity-ai
Step 2: API Key Management
After creating your account at the Antigravity AI dashboard, generate an API key under Settings → API Keys. Configure it using one of these methods:
Option A: Environment Variable (Recommended)
# Linux/macOS export ANTIGRAVITY_API_KEY="YOUR_API_KEY"Windows PowerShell
$env:ANTIGRAVITY_API_KEY=“YOUR_API_KEY”
Option B: Configuration File
# Create config at ~/.antigravity/config.yaml
antigravity config init
antigravity config set api_key YOUR_API_KEY
antigravity config set default_engine gpu
Option C: Inline in Code
import antigravity
client = antigravity.Client(api_key=“YOUR_API_KEY”)
For team environments, use project-scoped keys and store them in a secrets manager. Never commit API keys to version control.
Step 3: Run Your First Physics Simulation
Create a basic rigid-body simulation to validate your setup:
import antigravity from antigravity.physics import RigidBodySim, Gravity, Meshclient = antigravity.Client() # Uses env variable
Define simulation scene
sim = RigidBodySim( name=“drop_test_001”, duration=5.0, fps=60, solver=“ai_accelerated” # ML-enhanced solver )
Add objects
sim.add_object( Mesh.from_primitive(“cube”, size=1.0), position=(0, 0, 10), mass=2.5 ) sim.add_object( Mesh.from_primitive(“plane”, size=50.0), position=(0, 0, 0), static=True )
Add forces
sim.add_force(Gravity(strength=9.81))
Execute and retrieve results
result = client.simulate(sim) print(f”Frames: {result.frame_count}”) print(f”Compute time: {result.compute_time_ms}ms”) result.export(“output/drop_test.abc”) # Alembic cache
Step 4: Configure Blender Integration
Antigravity AI integrates directly with Blender for viewport previews and final renders:
# Install the Blender add-on antigravity blender install --blender-path "/usr/bin/blender"Or specify a custom Blender scripts directory
antigravity blender install —scripts-dir ”~/.config/blender/3.6/scripts/addons”
After installation, enable the add-on in Blender under Edit → Preferences → Add-ons and search for Antigravity AI. Enter your API key in the add-on preferences panel.
Scripting from Blender's Python Console
import bpy import antigravity.blender as agbConvert selected Blender objects to Antigravity scene
scene = agb.scene_from_selection(bpy.context.selected_objects)
Run simulation with AI-accelerated fluid solver
result = agb.simulate(scene, solver=“fluid_ml”, substeps=4)
Apply simulation cache back to Blender timeline
agb.apply_cache(result, start_frame=1)
Step 5: Build Automated Workflows
Use the workflow API to chain simulations and post-processing steps:
from antigravity.workflows import Pipeline, Stagepipeline = Pipeline(name=“destruction_sequence”)
pipeline.add_stage(Stage( type=“rigid_body”, config={“solver”: “ai_accelerated”, “duration”: 3.0} )) pipeline.add_stage(Stage( type=“particle_emit”, config={“source”: “fracture_points”, “count”: 50000} )) pipeline.add_stage(Stage( type=“render”, config={“engine”: “cycles”, “samples”: 256} ))
Run entire pipeline
job = client.run_pipeline(pipeline, priority=“high”) print(f”Job ID: {job.id} — Status: {job.status}“)
Poll or use webhook for completion
job.wait() job.download_results(“output/destruction/”)
Pro Tips for Power Users
- Batch simulations: Use
client.simulate_batch([sim1, sim2, sim3])to run multiple variations in parallel and compare results side by side. - Cache training data: Enable
sim.record_training_data = Trueto capture simulation data that fine-tunes the AI solver for your specific use case over time. - Headless rendering: Run
antigravity render --headless --scene scene.json --output ./frames/on CI/CD servers for automated output generation. - Webhook notifications: Set
client.set_webhook("https://your-server.com/hook")to receive job completion callbacks instead of polling. - Solver benchmarks: Run
antigravity benchmark --scene your_scene.jsonto compare classical vs. AI-accelerated solvers and find the optimal configuration for your workload.
Troubleshooting Common Errors
| Error | Cause | Solution |
|---|---|---|
AuthenticationError: Invalid API key | Missing or expired API key | Regenerate your key in the dashboard and update your environment variable or config file. |
SolverTimeout: Exceeded 300s | Scene complexity too high for current plan | Reduce mesh polygon count, lower substeps, or upgrade to a higher compute tier. |
ImportError: No module named antigravity.blender | Blender extras not installed | Reinstall with pip install antigravity-ai[blender]. |
CUDA out of memory | GPU VRAM insufficient | Set solver="cpu_fallback" or reduce simulation resolution with sim.set_resolution(0.5). |
VersionMismatch: Blender 3.4 not supported | Blender version below minimum | Update Blender to version 3.6 or later. |
Frequently Asked Questions
What types of physics simulations does Antigravity AI support?
Antigravity AI supports rigid body dynamics, soft body deformation, fluid simulation (SPH and FLIP), particle systems, cloth simulation, and destruction/fracture workflows. Each solver type has both a classical and an AI-accelerated variant that can reduce compute times by up to 10x on supported hardware.
Can I use Antigravity AI without a GPU?
Yes. While a CUDA-compatible GPU is recommended for large simulations and AI-accelerated solvers, all solvers include a CPU fallback mode. Set the solver to cpu_fallback or configure default_engine: cpu in your config file. CPU mode is fully functional but will run slower on complex scenes.
How does the Blender integration differ from using the Python SDK directly?
The Blender add-on provides a visual interface for setting up scenes, previewing simulations in the viewport, and applying cached results directly to your timeline. The Python SDK offers more control for automation, batch processing, and CI/CD pipelines. Both use the same underlying API, so results are identical. Many professionals use the add-on for prototyping and the SDK for production-scale automated workflows.