keepcalculator

06 Numbers and Powers

Google Antigravity Setup: Run Your First Agentic Coding Task

Card No. 06·69922 · Updated · Standard formula, shown below

Google Antigravity (formerly Project IDX) is a cloud-based development environment that lets you create AI-powered coding agents to automate tasks like code generation, refactoring, and testing. This guide walks you through setting up Antigravity and running your first agentic coding task, from creating an account to seeing the agent produce code.

What You’ll Need

  • A Google account (personal or Workspace)
  • A modern web browser (Chrome, Edge, Firefox, or Safari)
  • Basic familiarity with the command line and Git (helpful but not required)
  • An idea for a small coding task (e.g., “write a Python function to calculate Fibonacci numbers”)

Step-by-Step

  1. Go to the Antigravity website. Open your browser and navigate to antigravity.google. If you’re not signed in, click the “Sign in” button and use your Google account credentials.
  2. Create a new workspace. After signing in, you’ll see the Antigravity dashboard. Click the “New Workspace” button (usually a blue button labeled “New” or a plus icon). Choose a name for your workspace (e.g., “my-agent-project”) and select a template. For your first task, pick the “Blank” template or a simple language template like “Python” or “JavaScript”. Click “Create”.
  3. Wait for the workspace to initialize. Antigravity will spin up a cloud-based virtual machine with a code editor (VS Code in the browser). This may take 10–30 seconds. You’ll see a terminal panel at the bottom and a file explorer on the left.
  4. Open the AI agent panel. Look for the Antigravity icon in the left sidebar (it looks like a small sparkle or robot). Click it to open the agent chat panel. This is where you’ll interact with the AI agent.
  5. Write a clear task prompt. In the agent chat input box, type a specific, actionable instruction. For example: “Create a Python file named fibonacci.py that defines a function fib(n) which returns the nth Fibonacci number. Include a docstring and a simple test that prints fib(10).” Be as specific as possible about the file name, function name, and expected behavior.
  6. Send the prompt and watch the agent work. Press Enter or click the send button. The agent will start working: it may create files, edit code, and run commands in the terminal. You’ll see a live log of its actions in the agent panel. Wait for it to finish (it will say “Task complete” or similar).
  7. Review the generated code. Once the agent finishes, check the file explorer to see the new file(s) it created. Click on fibonacci.py to view the code. Read through it to ensure it matches your request.
  8. Run the code to verify. In the terminal panel, type python fibonacci.py (or python3 fibonacci.py on some systems) and press Enter. You should see the output 55 (the 10th Fibonacci number). If you see an error, check the code and the terminal output for clues.
  9. Iterate if needed. If the code isn’t what you wanted, type a follow-up in the agent chat, e.g., “Add error handling for negative inputs” or “Refactor to use iteration instead of recursion”. The agent will modify the file accordingly.
  10. Save your work. Antigravity autosaves, but you can also commit changes to a Git repository. Use the Source Control tab (the branch icon) to stage and commit your files, or push to GitHub if you’ve connected a repository.

Common Mistakes

  • Vague prompts: Saying “write a calculator” is too broad. The agent will guess, and you’ll likely get something you didn’t want. Always specify file names, function names, and expected behavior.
  • Ignoring the agent’s context: The agent sees the files in your workspace. If you ask it to modify a file that doesn’t exist, it will create a new one. Make sure you reference the correct file paths.
  • Not checking the output: The agent can produce code that looks correct but has bugs. Always run the code and test it yourself.
  • Using the wrong template: If you choose a template for a different language than your task, you might get confused by extra files. Stick to “Blank” for simple tasks.
  • Forgetting to save credentials: If you connect a Git repository, ensure you’ve authenticated with GitHub or GitLab in the settings, or the agent won’t be able to push.

Tips

  • Break down large tasks: Instead of asking for a full web app in one go, ask for a single component or endpoint first. This makes debugging easier.
  • Use the agent for repetitive tasks: It’s great at boilerplate code, test generation, and refactoring. Use it for those, and save your brain for architecture decisions.
  • Provide examples: If you want a specific style, show the agent an example in your prompt, like “Use type hints like in this snippet: …”
  • Pin the agent panel: Keep the agent chat open while you work. You can ask it questions about your codebase, like “Where is the function that handles authentication?”
  • Use the terminal for manual commands: The agent can run terminal commands, but sometimes it’s faster to run them yourself, especially for things like installing packages.

Troubleshooting

  • Agent is not responding: Wait a few seconds; it may be processing. If it’s stuck for over a minute, refresh the page and try again. Your workspace will be preserved.
  • Code runs but gives wrong output: Check the logic in the generated code. You can ask the agent to “add print statements to debug” or “explain the logic”. Often, the issue is a simple off-by-one error.
  • Terminal shows “command not found”: The agent may have created a file but not installed dependencies. Run pip install or npm install as needed. If the language runtime is missing, check the workspace settings to install it.
  • Agent creates files in the wrong directory: Specify the full path in your prompt, e.g., “create a file in the src/ folder”. If you don’t have a src folder, the agent will create one.
  • Workspace loads slowly: This can happen on slow connections. Try refreshing, or close other tabs. Antigravity is cloud-based, so your local machine’s speed matters less.
  • Can’t push to GitHub: Go to the settings (gear icon) and check the Git section. You may need to re-authenticate or add a personal access token.

Frequently Asked Questions

Is Google Antigravity free?

Yes, Antigravity offers a free tier with limited compute resources. For heavier workloads, there are paid plans, but for basic agentic coding tasks, the free tier is sufficient.

Can I use Antigravity with my existing GitHub repository?

Yes. In the dashboard, you can import a repository from GitHub. During workspace creation, choose “Import Repository” and paste the URL. The agent will have access to the code.

What languages does the agent support?

The agent can work with any language that has a runtime in the workspace. Common ones include Python, JavaScript, TypeScript, Go, and Java. You can install other runtimes via the terminal.

How is this different from GitHub Copilot?

Copilot is an autocomplete assistant that suggests code as you type. Antigravity’s agent is more autonomous: you give it a task, and it plans, writes, and executes code, similar to a junior developer.

Can the agent run tests?

Yes, you can ask it to write and run tests. For example, “Create a test file for fibonacci.py using pytest and run it.” The agent will install pytest if needed and execute the tests.

Is my code private?

Your workspace is private by default. Only you can access it unless you share it. Antigravity uses Google’s security standards, but avoid putting secrets or API keys in your code.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →