Some changes span more than one repository, such as a new API field that the frontend must also show. A task started from a single repository gives the agent only that repository. To let the agent work in several repositories at once, add them to an environment and start the task from it.
Before you begin
- Connect the Git provider that hosts all the repositories. An environment uses one provider, so the repositories must be on the same provider. See Integrations overview.
- Make sure the connected account can access each repository.
Step 1: Create an environment with the repositories
- In the sidebar, select Environments.
- Select Create environment.
- Enter an Environment name, for example
Sample web and API. - Under Repositories, pick your Git provider.
- Pick the first repository and its branch, for example
your-org/sample-webonmain. - Optionally, enter an install command, for example
npm ci. - Add the second repository and its branch, for example
your-org/sample-apionmain. - Repeat for each extra repository (up to 20).
- Mark the repository where most of the work happens as primary.
- Select Create environment.
Wait until the environment status is Ready. Each repository is cloned into its own folder, and its install command runs during the build. For all options, see Create an environment. If you change the provider, the repositories you already added are cleared.
Step 2: Start a task from the environment
- In the sidebar, select New task.
- Select Repository or environment.
- Under Environments, select your environment.
- Choose an agent and a model.
Each repository is in its own folder in the workspace. The agent starts in the primary repository and can read, change, and run commands in every repository.
Step 3: Describe the change across repositories
Name each repository and say what should change in it. If one change depends on another, say which comes first.
Add a "discount" field to products.
In sample-api: add the field to the Product model and return it from
GET /api/products. Add a test.
In sample-web: show the discount on the product card when it is greater
than zero. Add a component test.
Run the tests in both repositories before you finish.Step 4: Review the changes for each repository
- Open the workspace panel with the panel button in the top-right corner of the task, and open the Changes tab.
- In the repository menu, choose all repositories to see every change, or pick one. Each repository shows its file count and lines added and removed.
- Select a file to see its diff.
See Review changes. To check something yourself, use the Files and Terminal tabs. They show every repository in the workspace.
Step 5: Open the pull requests
Select Create pull request in the Changes tab, pick the repositories, and confirm. You can open one pull request per repository that has changes, up to 10 repositories in one go. If you leave the title and description empty, they are written for you. Or ask the agent:
Commit the changes and open a pull request in each repository against
main. Link the two pull requests to each other in the descriptions.Each pull request gets its own card in the task. Repositories without changes don’t get a pull request. See Pull requests.
Verify
- The picker above the prompt box shows the environment’s name.
- The repository menu in Changes lists each repository the agent changed.
- The task shows one pull request card for each changed repository.
Troubleshooting
- A repository is not in the list when you add it: the connected account can’t see it, or it is on another provider. See Repository or branch not listed.
- The environment is not in the composer: it is not Ready yet, or you don’t have access. See Use an environment in a task.
- The agent changed only one repository: name each repository and what to change in it in your prompt.
- A repository didn’t clone during the build: the build shows it as a warning, and each task clones it itself. Check the latest build on the environment’s page.
- You need repositories from two providers: this is not supported. An environment uses one connected provider.