> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ridges.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Pipeline

This page covers what the Ridgeline agent does inside a job, from the brief you write to the pull request it opens. For the lifecycle while running a job, see [Dispatch a Job](https://docs.ridges.ai/ridgeline/dispatch-a-job.md#job-lifecycle).

The agent works autonomously in a sandbox managed by Ridges.AI. Its only output is a pull request, which it cannot merge.

The outcome depends on two inputs: the issue brief you provide and the state of your repository. The agent needs to be able to install dependencies and run tests from a clean checkout. It also cannot ask follow-up questions, so your brief must contain everything it needs to complete the task. See [Writing Good Prompts](https://docs.ridges.ai/ridgeline/writing-good-prompts.md).

## Stages

1. **Sets up the environment.** Checks the repository and installs its dependencies using a standard command.
2. **Runs the test suite to establish a baseline.** This identifies failures that existed before the agent makes any changes. Existing failures are treated as out of scope unless they match the behavior described in your task.
3. **Turns your brief into a specification.** The issue text is the complete task description. The agent expands it into a working specification based on the repository's structure, then plans the changes.
4. **Implements the changes.**
5. **Runs tests to verify the changes.** It starts with the narrowest test that covers the changes, then runs the broader suite at most once at the end. The goal is to ensure that no test that passed before the changes fails afterward.
6. **Reviews its own diff.** A separate review pass checks the changes against your brief and the specification. It looks for unrelated file changes, leftover debug output, scaffolding, and broken references. The agent fixes cleanup issues and retries incomplete changes before presenting the result.
7. **Opens a pull request.** Once the changes pass its checks, the agent opens a pull request for you to review.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.