droid exec in Practice: Running Factory Droid Headless in CI

droid exec lets Factory Droid run headless in CI with controllable autonomy, enabling automated PR review and task execution.
This article introduces Factory Droid's droid exec headless execution mode for CI/CD pipelines, covering five key mechanisms: autonomy levels for permission boundaries, output formats and tool controls for machine-readable output and behavioral constraints, worktree isolation for concurrent tasks, GitHub Actions integration, and droid-action for automated PR review. It ends with a security checklist and recommends starting with low autonomy levels.
droid exec in Practice: Running Factory Droid Headless in CI
As AI coding assistants move from the IDE into the pipeline, "headless execution" becomes a critical capability. Factory Droid's droid exec mode is designed precisely for this—it brings Droid's judgment into CI/CD, letting code review, automated fixes, and batch tasks run unattended. Based on the official guide, this article breaks down its core mechanisms and practical implementation points.

Why Headless Mode Is Needed
AI coding assistants in the IDE rely on human-machine dialogue, but CI environments have no interactive interface. droid exec provides a non-interactive execution entry point, allowing Droid to receive tasks, invoke tools, and output structured results in pipelines such as GitHub Actions.
This solves a real pain point: code review and fixes often require developers to trigger them manually, but once Droid is integrated into CI, checks can be triggered automatically when a PR is created or pushed, reducing waiting and context switching. According to the original guide, this mode covers autonomy levels, output formats, tool controls, worktree isolation, GitHub Actions integration, and PR review driven by droid-action.
Headless Execution refers to a program running without a graphical interface or interactive terminal. In the CI/CD context, headless mode means the AI tool must receive all input through command-line arguments, environment variables, or configuration files, and return results via standard output or files, rather than waiting for user confirmation or follow-up questions. This is fundamentally different from the "dialogue—confirm—execute" loop in the IDE: CI pipelines are one-way, repeatable, and unattended, and any step requiring human intervention will cause tasks to hang or time out. Therefore, headless mode requires tools to have deterministic behavioral boundaries, machine-readable output, and configurable permission constraints—which is the fundamental reason autonomy levels and tool controls exist, as discussed below.
Autonomy Levels: Controlling How Far Droid Can Go
The biggest risk of headless mode is "losing control." droid exec uses autonomy levels to let teams set permission boundaries by scenario: at low levels Droid only performs analysis and suggestions, while at high levels it can execute modifications or even commit changes.
The significance of this tiered design is that it turns "trust" into a configurable item. For teams just getting started, it makes sense to begin with read-only analysis, verify output quality, and then gradually open up write permissions. The guide specifically emphasizes avoiding security pitfalls, noting that loosening permissions must be paired with tool controls.
Autonomy Levels are a permission-tiering model used to describe the scope of decisions an AI agent can make independently during a task. They can typically be divided into several gradations: read-only analysis (only reading code and outputting suggestions without modifying any files), controlled modification (performing edits within a limited directory or file type), and full execution (able to run commands, commit changes, and even create PRs). The higher the level, the greater the agent's utility, but the higher the risk of side effects and misoperations. In headless environments, since there is no human real-time confirmation, autonomy levels effectively play the role of "pre-approval"—the team decides at configuration time how far Droid can go, rather than judging case by case at runtime. Pairing levels with tool controls creates a dual constraint of "what it can do" and "what it can use to do it."
Output Formats and Tool Controls
CI scenarios require machine-readable output. droid exec supports multiple output formats, making it easy for downstream steps to parse results, generate reports, or use them as gating conditions. Combined with tool controls, teams can restrict the commands and external resources Droid can invoke, reducing unintended side effects.
Together, these two capabilities form the foundation of observability and controllability for headless execution: output formats make results consumable by the pipeline, and tool controls make behavioral boundaries clear.
Worktree Isolation and GitHub Actions Integration
Parallel tasks are the norm in CI. The worktree mechanism lets each Droid task run in an independent working tree, preventing multiple tasks from polluting each other's file state. The guide lists this as a practical point, indicating that isolation is critical for multi-task concurrency scenarios.
GitHub Actions integration then connects the above capabilities into a complete chain: the workflow triggers droid exec, Droid executes in an isolated environment, and results are written back to the PR or used as check items.
Git worktree is a mechanism provided by Git that allows multiple working trees to be checked out in the same repository, with each working tree corresponding to a different branch or commit while sharing the same .git object store. Compared with cloning multiple repositories, worktrees save disk and network overhead while ensuring that each working tree's file state is independent of the others. In droid exec's concurrency scenarios, each Droid task can be assigned an independent worktree, thereby avoiding file conflicts, staging area pollution, or branch state corruption caused by multiple tasks reading and writing the same working directory simultaneously. After a task completes, the worktree can be cleaned up or retained for review, providing CI parallel AI tasks with an effect close to container isolation but with finer granularity and faster startup.
PR Review with droid-action
PR review is the most direct application of this approach. Through droid-action, Droid can perform review tasks on PRs, feeding back discovered issues as comments or check results. Compared with manual review, it can quickly provide a first round of feedback after code is submitted, letting people focus their energy on complex logic.
GitHub Actions is GitHub's native CI/CD platform. Workflows are defined by YAML files in the repository, triggered by events (such as pull_request and push), and executed on GitHub-hosted or self-hosted runners. droid-action is a packaged Action unit that lets droid exec be embedded into workflows as a standard step, eliminating the need to hand-write complete command-line invocations and credential-passing logic on every configuration. The reusability of Actions enables scenarios like PR review to be implemented quickly: attach droid-action to the pull_request event, and Droid can analyze changes, output comments or check results in an isolated runner, and naturally integrate with GitHub's branch protection rules and check mechanisms.
Security Checklist Before Deployment
Headless execution's benefits come with risks. The security pitfalls highlighted in the guide are worth checking one by one: whether autonomy levels match the team's level of trust, whether tool controls cover high-risk operations, whether worktree isolation takes effect on all concurrency paths, and whether CI credential permissions are minimized. Defining these boundaries clearly first and then gradually expanding Droid's scope of responsibility is the safer adoption path.
Summary
droid exec advances the AI coding assistant from "human-machine dialogue" to a "pipeline component." Autonomy levels, output formats, tool controls, and worktree isolation together form a controllable headless execution framework, while droid-action makes PR review the first scenario to be implemented. For teams hoping to integrate AI into their R&D processes, this is a path worth evaluating.
One-line Summary
droid exec lets Factory Droid integrate into CI in a controllable headless mode, enabling automated PR review and task execution.
Paragraph Summary
This article introduces Factory Droid's droid exec headless execution mode, explaining how it enables AI coding assistants to run non-interactively in CI/CD pipelines. It focuses on five key mechanisms: autonomy levels for configuring Droid's permission boundaries by scenario, from read-only analysis to executable modifications; output formats and tool controls that together provide machine-readable output and behavioral constraints; worktree isolation that ensures concurrent tasks do not pollute each other; GitHub Actions integration that connects the above capabilities into a complete chain; and droid-action, which makes automated PR review the first application scenario to be implemented. The article ends with a security checklist before deployment, emphasizing that loosening permissions must be paired with tool controls, and recommending that teams start with low autonomy levels and gradually expand Droid's scope of responsibility.
Related articles

Nothing CMF Buds 2A Drops to $17.89 on Black Friday: A New Low for ANC Earbuds
Nothing CMF Buds 2A wireless earbuds Black Friday deal: just $17.89 on Amazon, about $11 off retail and a record low. ANC earbuds at an entry-level price.

When AI Creation Gets Accused of "Spitting": Hacker News Heats Up Over the Glaude Controversy
A Hacker News post, "Spitting in the Face of Glaude," sparks debate on AI creation transparency and attribution ethics. This analysis examines the blurred creator identity behind the controversy and offers practical advice for AI content production.

Akai Embraces Custom Firmware: MPC Sample 1.4 Lets Users AI-Program Their Sampler
Akai embraces the modding community with MPC Sample 1.4 firmware, supporting vibe-coded custom firmware and effects. We analyze the impact of this open strategy on music hardware and AI-assisted programming.