lightdash compile, the coding agent targets any repo you can write to and delegates verification to that repository’s own CI.
When to use it
Use the coding agent when the change belongs in a repository that isn’t your dbt project — for example:- Update a copy string or config value in a frontend or backend app repo
- Fix a typo in a README or a docs site
- Add a small feature or tweak business logic in a service repo
- Adjust a shared library used by several services
lightdash compile to validate the diff before opening the PR.
For questions that don’t need a code change, the agent will pick a different tool:
Prerequisites
- The AI coding agent feature flag (
ai-coding-agent) must be enabled for your organization. Theai-writebackflag also unlocks the tool — either is sufficient. - Your instance must have a valid enterprise license.
- The Lightdash GitHub App (or GitLab App) must be installed on the repository you want to edit, and the installation must grant write access.
- Your user account must itself have access to that repository. The agent only acts on repositories where both the org’s Lightdash Git App and your user can write.
- The user asking for the change needs the manage source code permission on the project.
- On self-hosted instances you need to bring your own E2B and Anthropic API keys, the same way you do for AI writeback. See AI writeback self-hosting — the coding agent uses a separate, leaner sandbox image but the same key setup.
How it works
When you ask the agent for a code change, it calls a tool callededitRepo. The tool:
- Resolves the target repository against the connected Lightdash Git app and confirms that both the app installation and your user can write to it. Non-writable repos are rejected up front.
- Starts a fresh, isolated E2B sandbox — a lean image containing only
gitand the Claude CLI. There is no dbt toolchain and nolightdash compilestep, so the sandbox has no way to run a build even if it wanted to. - Clones the target repo with a short-lived,
contents:read-scoped token, subject to a pre-clone repository size guard. - Edits files based on a self-contained instruction generated from your request. The sandbox does not see your chat history.
- Pushes a new branch and opens a pull request on GitHub or a merge request on GitLab against the repository’s default branch.
- Returns the PR / MR URL to you in chat.
GitHub commits are signed by the Lightdash GitHub App. GitLab commits are
pushed over OAuth and are unsigned.
Using it in chat
Phrase your request as a direct change to a specific repository, and, where possible, name the files or areas you want touched. The more specific you are, the more reliably the agent finds the right place to edit. Good promptsMentioning repositories with @
Type @ in the chat input to open the mention menu. Alongside Charts, Dashboards, and Files, you’ll see the repositories your organization has connected. Each entry is badged so you can tell at a glance which repos the agent can and can’t write to — non-writable repositories are shown as read-only. Picking a repository inserts it as a pill in your message and pins the coding agent to that target.
Multiple pull requests in one thread
A single conversation can hold several workstreams in parallel. Each workstream is one repository + one open pull request, and a thread can have multiple workstreams — even more than one against the same repository (for example, two independent changes toacme/web-app).
The agent uses two extra tools to keep them straight:
listWorkstreams— lists the pull requests this conversation has already opened, optionally filtered to one repository. The agent calls this beforeeditRepowhen it needs to decide whether a follow-up should continue an existing PR or start a new one.closePullRequest— closes (without merging) a PR the conversation opened, for example after folding the change into another PR or when it’s no longer wanted. Closing is reversible on the provider.
- Continuing existing work. If you ask for a related change and there’s already an open PR on the same repo for this thread, the agent commits onto that PR’s branch and refreshes the PR title / description.
- Starting a separate PR. If you make it clear the next change is independent — a different area of the codebase, a different feature — the agent opens a fresh pull request in the same thread rather than piling everything onto the previous one.
- Pasting a PR link. Include the PR URL in your message to force the agent to iterate on that specific pull request.
Security and safety
The coding agent runs under several deliberate constraints:- Repository allowlist. Only repos writable by both the Lightdash Git App installation and the user asking for the change are eligible. If your user’s own access can’t be confirmed (for example, GitHub’s API is rate-limiting the check), the agent fails closed and refuses to edit the repo.
-
Denied-path commit gate. The host inspects every commit before opening the PR and rejects any change that touches:
- CI configuration —
.github/workflows/**,.gitlab-ci.yml/.yaml,azure-pipelines.yml/.yaml,bitbucket-pipelines.yml/.yaml. - Secret-shaped files —
.envand<name>.env(includingprod.env,app.env.local), key material (*.pem,*.key,*.keystore,*.jks), and credential files.
- CI configuration —
-
No shell in the sandbox. The general-purpose agent’s tool allowlist has zero
Bashentries. Combined with a lean image that has no dbt, no build tools, and no Lightdash CLI, there is nothing on the sandbox to run even if a prompt tried. -
Scoped clone token. The token used to clone your repo is minted with
contents:read, held only long enough to clone, and revoked immediately after. The sandbox has no long-lived credentials. - Pre-clone size guard. Repositories larger than the configured ceiling (default 500 MB) are rejected before any clone, with a clear error, instead of failing later with an opaque timeout.
- Audit logging. Every write is logged with the acting user, repo, and PR.
Reviewing and acting on the pull request
The coding agent posts a chat card for each PR it opens with the same actions as writeback:- View ▾ — dropdown with Pull request (opens on GitHub/GitLab) and, when applicable, Diff (opens an in-Lightdash diff viewer with a file list and per-file
+/−counts). Coding-agent PRs don’t build a Lightdash preview project, so the Preview entry isn’t shown. - Close PR / Merge PR — merge is disabled until the provider reports the PR as mergeable (CI green, no conflicts, branch not blocked). The card pins the head commit SHA it was opened against so a later commit can’t be merged by mistake.
- Once the PR is merged or closed, the button group collapses to a Merged / Closed marker and the card stops polling.
Iterating on an existing pull request
You can continue an existing coding-agent PR in three ways:- Same thread, related change. Ask for a follow-up in the same thread — the agent picks the right open PR automatically.
- Force a specific PR. Paste the PR / MR URL alongside your request. The URL must belong to a repo this feature is enabled for, and the PR must be open. Merged or closed PRs are rejected.
- Force a new PR. Say the next change is separate. The agent opens a fresh pull request in the same thread instead of committing onto the previous one.
What happens if it can’t run
Related
- AI writeback — the same experience for changes to your project’s dbt repository, with
lightdash compilevalidation built in. - AI writeback self-hosting — E2B and Anthropic key setup that also applies to the coding agent.