To run an Atlas session non-interactively in a Go CI pipeline and retrieve machine-readable output, developers in 2026 can invoke `atlas run` with the `--format json` flag, allowing integration with `go test` and `go mod` for automated code generation and verification.
How to run Atlas non-interactively in a Go CI pipeline
In 2026, Go developers can execute Atlas non-interactively within their CI pipelines by using the `atlas run` command. This command is designed for headless operation, sending a single prompt and exiting once the session becomes idle, making it ideal for automated Go module tasks.
When integrating Atlas into a Go CI pipeline, the primary command is `atlas run`. This command's default behavior is non-interactive: it accepts a single prompt as an argument, streams events to standard output, and then exits when the session goes idle. This design ensures that Atlas can perform tasks such as adding table-driven tests or refactoring a Go interface without requiring human intervention. For instance, a pipeline step might invoke `atlas run "add a new test case to the `database/sql` package in `main.go`"` within a Go module, where Atlas can read existing Go packages, interfaces, and `go.sum` dependencies. Atlas will then draft a plan in a read-only plan agent and ask for approval before switching to a build agent, even in a headless context, which requires pre-approval through permission configuration.
How to get JSON output from Atlas for Go CI automation
For Go CI pipelines requiring structured data, Atlas in 2026 offers the `--format json` flag with `atlas run`. This option streams raw event data to standard output, enabling subsequent pipeline steps to parse machine-readable JSON instead of human-readable prose, which is crucial for automated Go module processing.
To enable automated processing of Atlas's output in a Go CI pipeline, developers must pass the `--format json` flag to `atlas run`. This ensures that Atlas streams its events as raw JSON objects to standard output, rather than formatted prose. A subsequent Go program or script in the pipeline can then parse this JSON stream to extract information, verify changes, or trigger further actions, such as running `go test` on the generated diff. It is also critical to explicitly set the model using the `provider/model` form, for example, `atlas run --format json --model github/copilot "refactor the `User` struct in `models/user.go`"`. This ensures the correct model and provider are used for the Go codebase, as the GitHub path specifically requires this format and rejects anything else.
How to manage Atlas tool permissions for headless Go CI
In 2026, running Atlas headless in a Go CI environment necessitates pre-approving tools via the permission configuration. Since there is no interactive user to answer 'ask' prompts, all necessary tools like `bash`, `read`, `edit`, and `todowrite` must be explicitly allowed to ensure the Go workflow proceeds without interruption.
A key aspect of running Atlas headless in a Go CI pipeline is managing tool permissions. Atlas's tool calls are permission-gated against `allow`, `ask`, and `deny` rules. In a headless execution, there is no user to respond to an `ask` prompt, so all tools required for the Go job must be pre-approved in the permission configuration. This includes essential tools like `bash` for executing shell commands, `read` for accessing file content, `edit` for modifying Go source files, and `todowrite` for creating or updating TODOs. Atlas also computes a unified diff for every file edit and surfaces it for approval before writing, and snapshots file changes as git patches, allowing edits to be diffed and rolled back. This ensures that even in an automated Go workflow, changes are transparent and auditable, integrating with `git branches`, `status`, and `diffs`.
How to resume or fork an Atlas session in Go CI
For complex Go development tasks in 2026, Atlas allows resuming or forking prior sessions using `--continue`, `--session`, or `--fork`. This capability enables a CI pipeline step to build upon an earlier Atlas run, ensuring continuity for multi-stage Go code generation or refactoring efforts without starting from scratch.
When a Go CI job requires building upon previous Atlas work, the `atlas run` command provides options for session management. The `--continue` flag allows resuming the most recent session, while `--session <session-id>` enables resuming a specific prior session. Alternatively, `--fork <session-id>` creates a new session based on an existing one, preserving its context but allowing for divergent work. This is particularly useful in Go development pipelines where an initial Atlas run might draft a new interface, and a subsequent step needs to implement methods for that interface, or where `go test` reveals issues that require further Atlas intervention. These options ensure that Atlas can efficiently manage state across multiple CI steps, leveraging its ability to read `git branches`, `status`, and `diffs`.
Step by step
- 01Prepare your Go module: Ensure your project has a `go.mod` file. Atlas operates within a Go module, reading packages, interfaces, and `go.sum` dependencies.
- 02Configure Atlas permissions: Pre-approve necessary tools for headless execution. For example, to allow `edit` and `bash` for Go code modifications and test execution, configure `atlas config set permissions.edit allow` and `atlas config set permissions.bash allow`.
- 03Invoke Atlas headless with a Go prompt: Run `atlas run` with your specific Go task, requesting JSON output and specifying the model. Example: `atlas run --format json --model github/copilot "add a new table-driven test for the `Calculate` function in `math.go`"`
- 04Process Atlas's JSON output: Capture the standard output from `atlas run` and parse the JSON event stream using a Go program or a `jq` command in your CI script to extract relevant information or verify changes.
- 05Verify Go code changes: After Atlas completes its task, run `go test ./...` to execute your Go tests and `gofmt -w .` to ensure code formatting compliance on any modified files.
- 06Review and commit changes: Atlas computes a unified diff for every file edit. Review these changes, and if satisfactory, Atlas can stage and create commits on your behalf, integrating with your `git` workflow.
Frequently asked questions
- How do I run Atlas in a Go CI pipeline without interaction?
- Run `atlas run` with your prompt as an argument. Its default mode is non-interactive, sending a single prompt and exiting when the session goes idle, perfect for Go CI automation.
- Can Atlas output machine-readable data for Go automation?
- Yes, pass `--format json` to `atlas run`. This streams raw event data to stdout, allowing your Go pipeline to parse structured JSON instead of prose for automated processing.
- How do I handle tool permissions for Atlas in headless Go CI?
- Pre-approve necessary tools like `bash`, `read`, `edit`, and `todowrite` in Atlas's permission configuration. Headless runs have no user to answer `ask` prompts, so explicit `allow` rules are required.
- What Go tools does Atlas integrate with?
- Atlas integrates directly with the Go toolchain, including `go mod` for package management, `go test` for running tests, and `gofmt` for code formatting, recognizing Go modules and interfaces.
- Can Atlas resume a previous session in a Go CI job?
- Yes, use `--continue` to resume the last session, or `--session <session-id>` to resume a specific one. `--fork <session-id>` creates a new session from an existing one, preserving context.
- How does Atlas ensure safety when modifying Go code in CI?
- Atlas drafts a plan in a read-only agent, asks for approval (which must be pre-approved in headless mode), computes a unified diff for every file edit, and snapshots changes as git patches for review and rollback.
- How do I specify the model for Atlas in a Go CI environment?
- Set the model explicitly using the `provider/model` form, for example, `--model github/copilot`. This is required for certain providers like GitHub and ensures the correct model is used for your Go codebase.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Run Atlas Headless in CI with Atlas (2026 Workflow)
How to run Atlas headless in CI in 2026: atlas run sends one prompt and exits when the session goes idle, with --format json, --command, and --continue for pipeline steps.
Atlas for Go in 2026
Atlas, the terminal-native AI coding agent, empowers Go developers in 2026 with intelligent code understanding, safe refactoring, and robust testing capabilities.
Plan a Multi-File Change Before Editing in Go with Atlas (2026)
How Atlas plans a multi-file Go change in 2026: plan mode denies edits, codebase_search maps your go.mod packages, and plan_exit hands off before go test runs.
Self-Review Your Working Diff Before Committing in Go with Atlas (2026)
Atlas self-reviews an uncommitted Go diff: bash produces the patch, read checks each package in full, grep hunts debug leftovers, and session revert restores a snapshot.
Write Unit Tests for Untested Go Code with Atlas in 2026
Add real Go tests to an untested package in 2026: Atlas enumerates exported symbols with lsp, copies your table-driven conventions, writes the _test.go file, and runs go test.
Diagnose a hanging or long-running command in Go with Atlas (2026)
Is your go test hung or just slow? In 2026 Atlas's bash timeout message names the interactive-input case, so a blocked go mod download is diagnosed, not waited out.
Automate GitHub Issue and Pull Request Triage in Go with Atlas in 2026
Streamline GitHub issue and pull request triage for your Go projects in 2026. Atlas integrates with `go mod` and `go test` to safely automate responses directly from GitHub Actions, ensuring code quality and security.
Trace a runtime bug from a stack trace in Go with Atlas (2026)
Go from a Go panic stack trace to the responsible line in 2026 with Atlas: read each frame at its offset, grep the error string, and walk callers with lsp findReferences.