Factory
Connect
Connect Factory from the terminal. Pass --help for the flags Factory accepts.
polylane integration connect --type factoryAn API key from your Factory account.
Connect Factory to let Factory droids write the fixes that Polylane finds. Polylane investigates the issue and confirms the root cause. A droid writes the change on a Factory managed computer and pushes it to your GitHub. You use your own Factory account, so your Factory plan must include API and remote workspace access.
- In Factory, go to Settings → API keys and create an API key. The key starts with
fk-. - Make sure that the GitHub connection of the Factory organization can access your target repositories.
- Paste the key into Polylane.
When you connect Factory, it becomes the executor for every autofix of the workspace. To send autofixes back to Polylane's own agent, turn off Use Factory for all autofixes on the Factory integration page in Settings.
Polylane encrypts the key before it stores it, and the agent never sees it.
How it works
Polylane hands the fix to a droid
When a fix run confirms the root cause of an issue, Polylane writes a brief: the root cause, the change to make, and how to check it. Every brief tells the droid to run the typecheck, the lint and the tests of the repository, and to list each check in the pull request description. A fix from a chat thread also includes the change that Polylane wrote in its sandbox.
Before the droid starts, Polylane applies the same gates as for its own fixes: the autofix switch, the autofix quota, a fix already in progress, and an open pull request for the same fix.
Then Polylane creates one Factory managed computer for the fix, with the repository cloned and its dependencies installed. Polylane waits a maximum of ten minutes for the computer. Then it starts a droid session on the computer with the brief and the name of the branch to push.
Code hosts
Factory works only with GitHub repositories. For a repository on GitLab, Polylane writes the fix in its own sandbox.
The pull request comes back
Polylane reads the session every five minutes, for a maximum of six hours. When the droid is done, Polylane deletes the managed computer.
If the droid opened a pull request, Polylane uses it. If the droid pushed the branch only, Polylane opens the pull request through its GitHub App. That pull request follows the workspace setting for draft pull requests. If the droid pushed nothing, Polylane records the autofix as skipped. Polylane records the pull request on the autofix and adds a section with its evidence and the history of the fix.
When a run fails
If the computer setup fails, the session fails, or the droid does not finish in six hours, Polylane's own agent takes the fix and writes it. A run that opened a pull request always counts as a success. If Factory refuses the key, Polylane sends one notice and gives new fixes to its own agent until you reconnect or verify the integration.
Give droids Polylane's MCP tools
A droid can read Polylane while it writes a fix: issues, the infrastructure graph and observability data. Create an API key in Polylane under Settings → Coding agents. The key gets every read scope that the MCP tools check, plus edits to Polylane's own data. It cannot act on your cloud or on connected providers. Then commit .factory/mcp.json to the repository:
{
"mcpServers": {
"polylane": {
"type": "http",
"url": "https://mcp.polylane.com/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}
Troubleshooting
When a Factory run fails, Polylane's own agent writes the fix. To let Factory do the next fix, correct the cause:
| What Polylane reports | What to do |
|---|---|
| Factory could not set up a machine with the repository | Make sure that the GitHub connection of the Factory organization can access the repository. |
| Factory did not finish in the time limit | Give Factory a smaller task. |
| Factory refused the key | Create a new API key and reconnect Factory. |
Disconnecting
Disconnect Factory in Polylane, then revoke the API key in Factory. After you disconnect, Polylane's own agent writes new fixes.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Factory is removed as well; nothing is left behind.
polylane integration disconnect <id>