# How to Set Up OpenSRE for Development and Testing: A Complete Guide

> Easily set up OpenSRE for development and testing. Clone the repo, install, configure LLMs and integrations, and validate your environment with simple commands. Start building with OpenSRE today.

- Repository: [Tracer/opensre](https://github.com/Tracer-Cloud/opensre)
- Tags: getting-started
- Published: 2026-04-18

---

**Clone the Tracer-Cloud/opensre repository, run `make install` to set up the editable Python package, execute `opensre onboard` to configure your LLM provider and integrations, then validate your environment with `make lint && make typecheck && make test-cov`.**

OpenSRE is an open-source framework for building AI-powered Site-Reliability Engineering agents, maintained in the `Tracer-Cloud/opensre` repository. To set up OpenSRE for development and testing, you need to install the Python package in editable mode, configure your environment variables, and verify the toolchain passes linting, type-checking, and unit tests. This guide walks you through the exact commands and configuration files required to get a fully functional development environment.

## Prerequisites

Before you begin, ensure you have **Python 3.10+**, **Git**, and **Make** installed on your system. While optional, **Docker** and **Docker Compose** are required if you plan to run the local Grafana/Loki testing stack described later.

## Clone the Repository and Create a Virtual Environment

Start by cloning the source code and isolating your dependencies in a virtual environment.

```bash
git clone https://github.com/Tracer-Cloud/opensre.git
cd opensre
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

```

## Install the Development Dependencies

The `Makefile` at the repository root automates the installation process. Running `make install` creates the virtual environment if it does not exist, upgrades `pip`, and executes `pip install -e ".[dev]"` to install the package in **editable mode**.

```bash
make install

```

This command installs the **CLI (`opensre`)**, the **MCP server (`opensre-mcp`)**, and all development tools including **ruff**, **mypy**, and **pytest**.

## Configure OpenSRE with the Onboarding Wizard

Run the interactive onboarding wizard to configure your LLM provider and optional integrations.

```bash
opensre onboard

```

The wizard prompts you to select an LLM provider (e.g., OpenAI, Anthropic) and optionally set up **Grafana**, **Datadog**, **AWS**, **Sentry**, or **Slack**. It writes the configuration to `~/.tracer/integrations.json` and updates a local `.env` file based on the template in `.env.example`.

## Verify Your Development Environment

Before contributing code, verify that the linting, type-checking, and test suite pass.

```bash
make lint
make typecheck
make test-cov

```

- **`make lint`** runs **ruff** to check code style in `app/` and `tests/`.
- **`make typecheck`** runs **mypy** using the configuration in [`pyproject.toml`](https://github.com/Tracer-Cloud/opensre/blob/main/pyproject.toml).
- **`make test-cov`** executes **pytest** with coverage reporting.

All three commands must exit with code zero to confirm a valid development environment.

## Optional: Stand Up Local Testing Infrastructure

For end-to-end testing without external dependencies, start the local Grafana, Loki, and Tempo stack.

```bash
make grafana-local-up
make grafana-local-seed

```

The `grafana-local-up` target spins up containers defined in [`docker-compose.testing.yml`](https://github.com/Tracer-Cloud/opensre/blob/main/docker-compose.testing.yml), while `grafana-local-seed` loads deterministic log data into **Loki** for RCA testing.

## Run a Sample Investigation

Validate the full agent pipeline by running a sample root-cause analysis against a bundled test fixture.

```bash
opensre investigate -i tests/e2e/kubernetes/fixtures/datadog_k8s_alert.json

```

This command executes the end-to-end RCA pipeline using the mock alert data in [`tests/e2e/kubernetes/fixtures/datadog_k8s_alert.json`](https://github.com/Tracer-Cloud/opensre/blob/main/tests/e2e/kubernetes/fixtures/datadog_k8s_alert.json), demonstrating how the CLI processes investigations without requiring live cloud resources.

## Summary

Setting up OpenSRE for development requires three core phases: installation, configuration, and verification.

- **Use `make install`** to set up the editable Python package and development tools.
- **Run `opensre onboard`** to configure LLM providers and write credentials to `~/.tracer/integrations.json`.
- **Execute `make lint`, `make typecheck`, and `make test-cov`** to validate code quality before contributing.

For integration testing, optionally start the local Grafana stack with `make grafana-local-up` and run sample investigations using `opensre investigate`.

## Frequently Asked Questions

### Do I need Docker to develop OpenSRE?

No. Docker is only required if you want to run the local Grafana, Loki, and Tempo stack for end-to-end testing using `make grafana-local-up`. The core development workflow—linting, type-checking, and unit tests—runs entirely within the Python virtual environment established by `make install`.

### What Python version does OpenSRE require?

OpenSRE requires **Python 3.10 or higher**. The `Makefile` and [`pyproject.toml`](https://github.com/Tracer-Cloud/opensre/blob/main/pyproject.toml) specify this constraint, and running `make install` will fail with a clear error if your system Python version is too old.

### How do I add a new integration during development?

After the initial setup, you can add or update integrations by running `python -m app.integrations setup <service>`, where `<service>` is `grafana`, `datadog`, `aws`, `slack`, or `sentry`. This command updates the `~/.tracer/integrations.json` file and prompts for required API keys or tokens. You can verify connectivity immediately using `make verify-integrations SERVICE=<service>`.

### Where are the test fixtures for end-to-end RCA scenarios?

End-to-end test fixtures are located in `tests/e2e/`, organized by infrastructure type. For example, Kubernetes alert simulations reside in `tests/e2e/kubernetes/fixtures/`, including [`datadog_k8s_alert.json`](https://github.com/Tracer-Cloud/opensre/blob/main/datadog_k8s_alert.json). You can execute these scenarios manually using `opensre investigate -i <path_to_fixture>`, or run the full E2E suite with `make test-e2e`.