API referenceConsole
code agent
Polylane investigates the issue and hands the fix to Factory droids on managed computers, which implement it and push the pull request. Bring your own API key.

Connect

Connect Factory from the terminal. Pass --help for the flags Factory accepts.

Terminal
polylane integration connect --type factory

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 reportsWhat to do
Factory could not set up a machine with the repositoryMake sure that the GitHub connection of the Factory organization can access the repository.
Factory did not finish in the time limitGive Factory a smaller task.
Factory refused the keyCreate 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.

Terminal
polylane integration disconnect <id>