# Run Atlas Headless in CI for Pandas Workflows in 2026

> Atlas can run headless in CI for Pandas projects, providing machine-readable output and integrating with `pytest (assert_frame_equal)` and `ruff format`.

To run an Atlas session non-interactively in a CI pipeline and retrieve machine-readable output for your Pandas projects, use the `atlas run --format json` command. This approach allows Atlas to execute tasks like refactoring `df.apply` calls or fixing chained assignment, then integrate direct with your existing Pandas toolchain, including `pytest (assert_frame_equal)` for testing and `ruff format` for code style, all without requiring human intervention in 2026.

## Key takeaways

- Use `atlas run` for non-interactive, headless execution of Atlas in your Pandas CI pipelines.
- Specify `--format json` to obtain machine-readable event streams from Atlas for automated processing.
- Pre-approve Atlas tools like `bash`, `read`, `edit`, and `todowrite` to avoid interactive permission prompts in CI.
- Atlas integrates directly with `pytest (assert_frame_equal)` for testing and `ruff format` for code style in Pandas projects.
- Atlas understands and can optimize Pandas-specific idioms, such as vectorizing `df.apply` and fixing chained assignment for pandas 3 Copy-on-Write.

## How to run Atlas non-interactively in a Pandas CI pipeline

Running Atlas non-interactively in a CI pipeline for Pandas code is achieved using the `atlas run` command, which by default sends a single prompt and exits when the session goes idle. This ensures your CI job completes without waiting for user input, a critical feature for automated workflows in 2026.

The `atlas run` command is specifically designed for headless execution in CI environments. When invoked, it processes a single prompt and streams events to standard output, concluding the session once it becomes idle. For Pandas developers, this means Atlas can be instructed to perform tasks such as analyzing DataFrame transformations, handling index operations, or optimizing merge keys without requiring any interactive steps. To execute a specific slash command, you can use `atlas run --command "/edit src/data_processing.py"`. This non-interactive mode is essential for integrating Atlas into automated build and test pipelines, ensuring that code improvements and fixes are applied consistently and efficiently across your Pandas codebase.

## Configuring Atlas permissions for headless Pandas code changes

For Atlas to operate autonomously in a headless CI environment, especially when modifying Pandas code, all necessary tool calls must be pre-approved through the permission configuration. This prevents the agent from pausing to ask for permission, ensuring a smooth, non-interactive run, a requirement for 100% automated pipelines.

In a headless `atlas run` session, there is no user to respond to 'ask' prompts for tool execution. Therefore, it is crucial to pre-configure Atlas's permissions using `allow`, `ask`, or `deny` rules. For typical Pandas code modification tasks, Atlas will need access to tools like `bash` for executing commands, `read` for inspecting files (e.g., `pyproject.toml` or Pandas scripts), `edit` for applying code changes (e.g., fixing chained assignment or vectorizing `df.apply` calls), and `todowrite` for creating new files or updating existing ones. By explicitly setting these permissions to 'allow' for the relevant tools, you ensure that Atlas can proceed with its plan to analyze, modify, and test your Pandas code without interruption, maintaining code off third-party servers by using local Ollama embeddings for indexing.

## Integrating Atlas with Pandas testing and formatting in CI

Atlas direct integrates with the standard Pandas testing and formatting toolchain, including `pytest (assert_frame_equal)` and `ruff format`. This allows Atlas to not only propose code changes but also to generate new test cases and ensure code style compliance, crucial for maintaining high-quality Pandas code in 2026.

After Atlas proposes a change to your Pandas codebase, such as replacing a row-wise `df.apply` with a vectorized expression or fixing chained assignment to align with pandas 3's Copy-on-Write default, it can then add corresponding `pytest` cases. These tests will leverage `pandas.testing.assert_frame_equal` to verify the correctness of DataFrame transformations. Following code modifications and test generation, Atlas can automatically run `ruff format` on the generated diff to ensure all new or modified code adheres to your project's formatting standards. This end-to-end integration means that a single `atlas run` command can encompass code analysis, modification, test generation, and formatting, all within your existing `pyproject.toml`-pinned Pandas environment, ensuring a consistent and high-quality development workflow.

## Getting machine-readable output from Atlas in Pandas CI

To enable downstream pipeline steps to programmatically parse Atlas's output rather than relying on human-readable prose, specify the `--format json` flag when invoking `atlas run`. This provides a structured event stream, making it straightforward to automate further actions based on Atlas's operations in 2026.

When `atlas run` is executed with the `--format json` flag, it streams raw event data to standard output. This machine-readable format is invaluable for CI pipelines where subsequent steps need to process Atlas's actions, such as identifying which files were edited, what tools were called, or the outcome of a test run. For a Pandas project, this could mean parsing events to confirm that a specific DataFrame optimization was applied, or that new `pytest` cases were successfully added. The JSON output allows for robust automation, enabling other scripts or CI tools to react to Atlas's output, for example, by triggering a code review process or updating a project dashboard with the results of the automated refactoring.

## Iterating on Atlas sessions for complex Pandas refactoring

For complex Pandas refactoring tasks that might span multiple CI runs or require incremental development, Atlas supports resuming or forking prior sessions using `--continue`, `--session`, or `--fork`. This allows a pipeline step to build upon an earlier Atlas run, ensuring continuity for intricate code transformations in 2026.

Sometimes, a single `atlas run` might not complete a highly complex Pandas optimization or refactoring task, or you might want to review an intermediate state before proceeding. Atlas provides mechanisms to manage these scenarios. The `--continue` flag allows Atlas to pick up exactly where a previous session left off, using the same context and plan. Alternatively, `--session <session_id>` lets you explicitly specify a prior session to resume. For scenarios where you want to explore an alternative path or branch off from a previous state, `--fork` creates a new session based on an existing one. These capabilities are particularly useful when dealing with large Pandas codebases, where changes to DataFrame indexing, merge keys, or complex chained assignments might require several iterative steps, each building on the last, ensuring that Atlas can effectively manage and evolve its work.

## Steps

1. Ensure your Pandas project's `pyproject.toml` file explicitly pins the `pandas` version, allowing Atlas to read your DataFrame transformations and merge keys within a defined environment.
2. Configure Atlas permissions to `allow` necessary tools like `bash`, `read`, `edit`, and `todowrite` in your Atlas configuration, preventing interactive prompts during headless CI runs.
3. Invoke `atlas run` with a specific prompt for a Pandas task, for example, `atlas run 'Replace the df.apply over rows in src/data_processing.py with a vectorized expression and show the timing difference.'`
4. Include the `--format json` flag in your `atlas run` command to ensure the output is machine-readable for subsequent CI pipeline steps, rather than human-readable prose.
5. Explicitly set the model using the `provider/model` form, such as `atlas run --model 'ollama/llama3' ...`, as required for headless execution.
6. Atlas will draft a plan in its read-only plan agent, then switch to a build agent to execute the pre-approved tools to modify the Pandas code.
7. Atlas will add new `pytest` cases to verify the changes, utilizing `pandas.testing.assert_frame_equal` to ensure the correctness of DataFrame outputs.
8. Atlas will then run `ruff format` on the generated diff to ensure the modified Pandas code adheres to your project's formatting standards.
9. Atlas computes a unified diff for every file edit and snapshots these changes as git patches, allowing for easy review and rollback if needed in your CI system.

## FAQ

### How do I run Atlas in CI without user interaction for Pandas projects?

You can run Atlas non-interactively in CI for Pandas projects using `atlas run`. This command sends a single prompt, streams events, and exits when idle, making it ideal for automated pipelines.

### Can Atlas generate `pytest` tests for Pandas DataFrames in CI?

Yes, Atlas can add `pytest` cases to your Pandas project, specifically using `pandas.testing.assert_frame_equal` to validate DataFrame transformations after making code changes.

### How does Atlas handle Pandas-specific issues like chained assignment in automated workflows?

Atlas is designed to fix Pandas-specific issues such as chained assignment, ensuring your code behaves correctly under Copy-on-Write, which is the default in pandas 3, all within an automated CI run.

### What output format does Atlas provide for CI pipelines that need to parse its actions?

For machine-readable output, use `atlas run --format json`. This streams raw event data, allowing subsequent CI steps to programmatically parse and react to Atlas's operations.

### How do I ensure Atlas doesn't ask for permissions in a headless CI job for Pandas code?

To prevent interactive permission prompts, you must pre-approve all necessary tools (e.g., `bash`, `read`, `edit`, `todowrite`) in Atlas's permission configuration before running it headless in CI.

### Can Atlas optimize slow Pandas operations like row-wise `apply` calls?

Yes, Atlas can identify and replace inefficient `df.apply` calls over rows with vectorized expressions, demonstrating the timing difference, thereby optimizing your Pandas code in CI.

### How does Atlas integrate with Python package managers and formatters in a Pandas project's CI?

Atlas integrates with your existing Python toolchain. It can read your `pyproject.toml` for Pandas version pinning and will run `ruff format` on any code changes it makes, ensuring style consistency.

---

Canonical HTML: https://runatlas.sh/resources/stacks/run-atlas-headless-in-ci-in-pandas
Source of truth: aeo_pages row `/resources/stacks/run-atlas-headless-in-ci-in-pandas` (segment: Stacks) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
