Antigravity 2.0 also provides Subagents, Hooks, Scheduled Tasks and Agent management capabilities.
Opening them all will not automatically improve efficiency, but will easily allow multiple agents to modify the same file.
What are the four abilities responsible for?
Subagent is suitable for subtasks that can be independently accepted.
Hooks are suitable for executing short rules when certain events occur.
Scheduled Task is suitable for recurring tasks triggered by time.
The Agent Manager is responsible for observing and intervening in running tasks.
Do not use scheduled tasks to replace failure retries, and do not use Hooks to host long-term builds.
Use a warehouse to carve out ownership
Let’s say the repository contains the frontend, API, and documentation.
Establish path ownership for three types of tasks:
|
|
Shared lock files, CI configuration, and database migrations are not assigned to normal Subagent.
They require master agent or manual serial processing.
Each Subagent uses an independent working tree
|
|
The working tree allows modifications to be isolated, but cannot resolve database, port, and cache conflicts.
Assign different ports and temporary directories to each task.
|
|
Do not let three Agents share one .env.local.
The main Agent’s task description must include exit conditions
A qualifying task should clearly state:
-
Directories that are allowed to be modified.
-
Modification of files is prohibited.
-
Tests that must be run.
-
Final submission.
-
When to stop and request human judgment.
“Getting the front end done right” is not an acceptable task.
“Fix login form keyboard navigation and make three specific tests pass” is.
Hook only does fast, deterministic checks
Actions suitable for Hook: format check, secret scan, git diff --check.
Actions not suitable for Hooks: end-to-end testing, deployment, automated merging, and database upgrades.
Hooks must have a timeout.
Hook failure should prevent the next step and hand the original exit code to the Agent Manager.
Do not let the Agent guess success based on the error text.
Scheduled tasks must prevent overlapping execution
When generating dependency reports every day, acquire the lock first.
If there is already an instance running, skip it instead of starting another Agent.
Task output is written to date-separated directories.
Keep the model, prompt version and warehouse commit used this time.
Repeated executions on the same day should also generate a unique run ID.
Merge order is determined by dependencies
When a document depends on an API field, merge the API first.
When the front end relies on the same field, rebase after the API merge.
|
|
Do not leave conflicts to be resolved by two agents at the same time.
Designate one owner, the other just provides the explanation.
What should Agent Manager focus on?
Instead of staring at each token, look at exception signals:
-
Continuous repetition of the same tool.
-
The modification exceeds the path range.
-
The number of tests suddenly decreases.
-
Running time exceeds historical baseline.
-
Request new credentials or network permissions.
If any of these items appear, the task should be suspended rather than continuing to add prompts.
Separation of browser tasks and code tasks
Antigravity can control the browser, but test accounts cannot reuse personal accounts.
Prepare independent test tenants and resettable data.
The browser agent can only access the test domain name.
Production admin should be excluded from the allow list.
Screenshots and videos may also contain personal information, and the retention period must be clear.
A complete walkthrough
First let the frontend agent modify a component.
Hook run format and secret checks.
The backend agent also adds a conflict-free unit test.
The master agent waits for both branches to complete and reads the diff.
Merge and run integration tests in dependency order.
The docs agent finally updates the documentation based on the real interface.
Deliberately having a Hook return a non-zero exit code confirms that the workflow will stop.
Then deliberately create conflicts with the same file to confirm that there is only one resolver.
Don’t automate the part
Don’t hand over production deployment approval to scheduled tasks.
Key rotation should not be performed by normal Subagent.
License changes and database destructive migrations require manual review.
Preserve diffs, test results, and task logs before deleting the working tree.
Review indicators
Record whether the total time consumption decreases after parallelization.
Record the number of conflicts and manual intervention.
Record the pass rate of each Agent.
If parallelism saves 10 minutes but adds 30 minutes to merge costs, you should reduce the number of Subagents.
The correct goal of multi-agent is to shorten the critical path, not to create more windows that can run simultaneously.
Antigravity workflow information
Use dependency graph to determine parallelism instead of dividing tasks evenly
First write the tasks into nodes: interface definition, back-end implementation, front-end call, integration test and documentation. Only nodes without pre-dependencies are started at the same time.
|
|
If the interface is still changing, starting the document agent early will only create rework. The master agent should save the commit SHA after each node is completed, and then hand this final version to the downstream.
Dependency and port isolation in Worktree
Node projects should not share writable node_modules across multiple working trees. The package cache can be shared, but the installation directory cannot be shared. The database creates an independent schema or container for each Agent.
|
|
The other agent uses a different port, database name, and temporary directory. In this way, when the test fails, the log can correspond to the only task.
Generate machine-readable handover notes before merging
When each Subagent is completed, it returns branches, starting commits, end commits, modified files, test commands, and unresolved issues.
|
|
The master agent verifies these fields from Git and test logs. Natural language claims that “pass all” cannot cover non-zero exit codes.
Create a real conflict
Let two work trees modify the same type definition respectively, one to add fields and the other to rename fields. After merging the first branch, perform a rebase on the second branch.
|
|
The conflict resolver must rerun the tests for both branches instead of just running his own tests. After the type check passes, let the read-only review agent compare the merged result with the two task descriptions.
Deactivation switch of scheduled tasks
Each Scheduled Task must have a deactivation entry that requires no code modification. When a trigger goes out of control, scheduling is disabled first and then the started instance is processed.
Record the next run time, the last success time, the number of consecutive failures and the current lock holder. Stop scheduling and notify humans when consecutive failures reach a threshold. Do not let the Agent repair the errors it generates indefinitely.
Output contract of Hooks
The Hook return value allows both human and Agent to judge the result. It is recommended to output the check name, target commit, exit code, number of findings, and report path.
|
|
Do not print the suspected key text to standard output. The report is located using fingerprint, file path and line number. Viewing the original text requires higher permissions.
Browser Agent test data cleaning
Automatically created accounts, orders, and uploaded files all have run IDs. The cleanup task only deletes data with that ID that is in the test tenant, and cannot use broad conditions like “delete all objects created today.”
A failed cleanup should not cause the main test to show success. The business test results and cleaning results are recorded in the report respectively, making it easier for the personnel on duty to discover that the test environment is accumulating data.
Determine whether the number of parallelism should be reduced
Three consecutive rounds of statistics on waiting time, conflict rate, failed rerun and manual review time. If the agent is waiting heavily on the same interface or a shared test environment, it is often faster to reduce the number of parallelism from three to two.
It’s not worth setting up extra branching, porting, and merging processes for parallelization when the task can be completed sequentially in ten minutes with a single working tree.