# Contributions to OpenSRE

> 16 merged pull requests to OpenSRE, an open-source AI agent for reliability work: a guardrails engine that redacts secrets before LLM calls, Vercel and OpsGenie integrations, and test fixes.

Source: https://ebrahimsameh.com/projects/opensre-contributions/

[OpenSRE](https://github.com/Tracer-Cloud/opensre) is an open-source, Apache-2.0 agent for CI/CD and production reliability, built in Python on LangGraph. You connect it to your tools, it takes an alert, gathers evidence from those tools and works toward a root cause. In April 2026 I opened 16 pull requests against it, and all 16 were merged.

Unlike most of my work, this code is public, so every claim on this page links to the pull request it comes from.

## A guardrails engine for LLM calls

An agent that reads your logs and alerts will sooner or later send a credential, a card number or an internal hostname to an LLM provider. [#495](https://github.com/Tracer-Cloud/opensre/pull/495) adds a guardrails engine that checks content before every LLM call and redacts, blocks or audits what it finds (+1,608 lines).

Teams write rules as regex patterns or keywords in `~/.opensre/guardrails.yml`. Each rule has an action:

| Action | What happens |
| --- | --- |
| `redact` | The match is replaced before the text leaves the process |
| `block` | The call is refused with `GuardrailBlockedError` and never retried |
| `audit` | The call goes through and the match is logged |

The main design choice was where to hook in. Instead of wrapping the LLM clients, the scan runs inside the two client `invoke()` methods. The agent's main paths to a model (alert extraction, root-cause diagnosis, action planning, structured output) all go through one of those two methods, so one hook covers them, and the existing `.with_config()` and `.with_structured_output()` call chains keep working. The LangChain chat nodes get a separate helper that scans message content before the call.

The audit log is append-only JSONL and stores only a truncated preview of the matched text, so the log itself doesn't become a copy of the secrets. A CLI comes with it: `opensre guardrails init` writes a starter config with patterns for AWS keys, card numbers, PEM private keys and generic API tokens, `test` dry-runs a string, `rules` lists the rules, and `audit` shows recent log entries. If there's no config file, no rules load and the scan is skipped. The PR has 74 tests, including Unicode, overlapping and adjacent matches, and mixed block and redact rules.

## Vercel and OpsGenie integrations

[#351](https://github.com/Tracer-Cloud/opensre/pull/351) adds Vercel for deployment monitoring: a client for projects, deployments, events and runtime logs, plus two tools the agent can call during an investigation. It's wired into onboarding, health checks and `opensre integrations verify`.

[#353](https://github.com/Tracer-Cloud/opensre/pull/353) adds OpsGenie for alert intake. The client wraps the OpsGenie Alert API v2 (list, get, activity log and adding a note back to the alert) and supports both US and EU regions. Two tools let the agent search open alerts and read one alert's details and history. The API key lives only in the integration store, following the existing Datadog pattern. It shipped with 58 tests, and I checked it end to end against a live OpsGenie instance by creating a P1 alert and running onboarding and verify against it.

## A Kubernetes test harness, and the two bugs it found

[#583](https://github.com/Tracer-Cloud/opensre/pull/583) adds a synthetic root-cause test harness for Kubernetes, modelled on the existing RDS Postgres suite. It has fixture backends for EKS and Datadog, a scenario loader with one level of inheritance, and scoring for both the agent's trajectory and its reasoning. The real Kubernetes failure scenarios were separate issues, so the PR ships one healthy placeholder scenario to prove the wiring works end to end.

One detail I cared about: when a tool gets a fixture backend, the harness does not mark the connection as verified. That keeps every unwired EKS and Datadog tool switched off in test mode, so a scenario can't make a real AWS or Datadog call by accident.

Building the harness turned up two existing bugs. I filed both as issues before opening the PR and fixed them in follow-ups:

- [#584](https://github.com/Tracer-Cloud/opensre/pull/584): the EKS tools ran successfully, but there was no evidence mapper for them, so their output was silently dropped before root-cause diagnosis. The agent investigated Kubernetes incidents without the data it had just collected.
- [#585](https://github.com/Tracer-Cloud/opensre/pull/585): the "clearly healthy" short-circuit didn't recognise EKS evidence, so a healthy Kubernetes investigation still called the reasoning LLM for nothing.

## Database tools that failed on every call

The PostgreSQL, MySQL and Azure SQL diagnostic tools were missing two callbacks in their `@tool` decorators, so every call failed with a `TypeError` about missing arguments. In a full run of the RDS synthetic suite I counted 184 PostgreSQL failures. [#703](https://github.com/Tracer-Cloud/opensre/pull/703), [#704](https://github.com/Tracer-Cloud/opensre/pull/704) and [#707](https://github.com/Tracer-Cloud/opensre/pull/707) wire the callbacks in, following the working MariaDB pattern. After the fixes there were no PostgreSQL TypeErrors, and the 92 Azure SQL failures from the agent trying those tools on unrelated scenarios dropped to 0, because the tools now correctly report themselves unavailable. Credentials stay out of the tool signatures, so the LLM never sees them.

## Smaller fixes

- [#696](https://github.com/Tracer-Cloud/opensre/pull/696): `from __future__ import annotations` turned `RunnableConfig | None` into a string LangGraph doesn't recognise, which caused 12 warnings per test run. The same fix had been merged once and lost in a refactor.
- [#700](https://github.com/Tracer-Cloud/opensre/pull/700) and [#708](https://github.com/Tracer-Cloud/opensre/pull/708): pytest and ruff were both silently ignoring config blocks in `pyproject.toml` because a dedicated config file took precedence. Any edit there looked like it worked and didn't.
- [#698](https://github.com/Tracer-Cloud/opensre/pull/698): a Snowflake tool parameter named `schema` shadowed a Pydantic method. A rename was the only fix that worked, because LangChain ignores field aliases here.
- [#285](https://github.com/Tracer-Cloud/opensre/pull/285): an `opensre update` command with `--check` for scripts. Frozen binary installs get the reinstall command printed instead of being replaced while running.
- [#396](https://github.com/Tracer-Cloud/opensre/pull/396): benchmark results written into the README automatically after `make benchmark`.
- [#282](https://github.com/Tracer-Cloud/opensre/pull/282): an `.editorconfig` matching the ruff settings, plus small tooling cleanups.

The full list is on GitHub: [pull requests by ebrahim-sameh in Tracer-Cloud/opensre](https://github.com/Tracer-Cloud/opensre/pulls?q=is%3Apr+author%3Aebrahim-sameh).
