# Tracely

> Trace-native CI/CD for AI agents: failing production traces become replayable regression tests that gate pull requests

- Category: Evaluation & Production Ops / Evaluation & Red-Teaming
- Language: Python
- Licence: MIT
- Repository: https://github.com/jwuthri-cloud/Tracely-ai
- Website: https://tracely-ai.com
- Canonical page: https://ai-tldr.dev/tools/tracely/

## In short

Tracely is an open-source platform that turns production failures of AI agents into regression tests. It sits in the Evaluation & Red-Teaming category of the Evaluation & Production Ops tools and is open-source, written in Python and licensed MIT. To get started: run the whole stack with demo data.

## Overview

Tracely is an open-source platform that turns production failures of AI agents into regression tests. It ingests agent traces over OTLP, grades each run as it lands with structural checks and LLM judges, groups failures into issues, and lets you promote a failing trace into a hermetic test case that is replayed on every pull request. Its README frames the idea as "the recorded run is the test": instead of hand-authoring an eval dataset, the exact input, tool calls and model responses of a real failure become the fixture.

The workflow has five stages, each a page in the app. Observe shows traces as conversation threads with agent semantics (agent, conversation, turn, step) stored as indexed columns and evaluators shown as columns on the trace table. Detect and triage clusters failures structurally and semantically. Test promotes a failure into a case with a fail-to-pass contract, or into a multi-turn or adversarial red-team scenario. Ship runs the suite in CI through the tracely CLI or a GitHub Action that posts a commit status and a PR comment. Alerts are drawn as flows that can post to Slack, email or a webhook and include an LLM step.

The whole product (FastAPI backend, Celery workers, Next.js UI, Python SDK and CI gate CLI) is MIT licensed and self-hostable with Docker Compose, backed by ClickHouse, Postgres with pgvector, Redis and MinIO. The project states that its write path mirrors Langfuse's design, reimplemented in Python. A hosted service is offered at tracely-ai.com with a free tier, and every backend also serves an MCP endpoint so a coding agent can read traces and create evaluators.

## What it does

- OTLP/HTTP ingestion from any language plus a Python SDK (tracely-ai) that auto-instruments OpenAI, Anthropic, Google, Mistral and LangChain calls
- Evaluators as columns on the trace table: structural checks with no model, and LLM judges at conversation, run or span level, with scores streamed live and a judge-calibration screen for comparing verdicts with human labels
- Failure clustering by structural signature and semantic embedding, with suggested evaluators and one-click promotion to a regression case
- Hermetic regression cases that bundle the recorded input and tool/LLM outputs as fixtures with a fail-to-pass contract, plus scripted and adversarial red-team scenarios
- CI gating via tracely simulate / replay / gate and a GitHub Action: non-zero exit, commit status and an upserted PR comment, with replay against recorded fixtures needing no API keys
- Alert flows (gate failed, conversation failed, new failure mode, rate thresholds) routed to Slack, email or webhooks, an in-app assistant and an MCP endpoint at /mcp

## Getting started

The README's quickstart needs Docker and Docker Compose. It brings up the full stack with demo data, then shows how to send traces from Python and gate pull requests in GitHub Actions.

1. Run the whole stack with demo data

   This starts ClickHouse, Postgres, Redis and MinIO, runs migrations, seeds a default project with the ingest key tracely_dev_key and populates traces, clusters, cases and gates. The web app is on port 3001 and the backend on port 8000 (remap with TRACELY_WEB_PORT / TRACELY_BACKEND_PORT).

```bash
git clone https://github.com/jwuthri-cloud/Tracely-ai && cd Tracely-ai
docker compose --profile demo up -d --build --wait
open http://localhost:3001
```

2. Send your first trace

   Install the SDK with the extra for your provider ([openai], [anthropic], [langchain] or [all]), initialize it once, and wrap a run. Provider calls inside the block are captured as GENERATION spans with model, messages, tokens, latency, tool calls and cost. Any OTLP/HTTP exporter can post to {endpoint}/v1/traces instead.

```python
pip install "tracely-ai[openai]"

import tracely_sdk as tracely

tracely.init(
    endpoint="http://localhost:8000",
    api_key="tracely_dev_key",
    service_name="support-agent",
    env="prod",
    instrument="auto",
)

with tracely.trace(agent="support-agent", conversation="conv-1", user="u_42"):
    client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Where is order ORD-4471?"}],
    )
```

3. Gate pull requests in CI

   Once failures are promoted to cases or scenarios, add the GitHub Action. In this mode Tracely calls your registered agent endpoint and runs its scenarios; the README also documents gating the traces your CI already emits (mode: gate) and hermetic replay with tracely replay.

```yaml
      - uses: jwuthri-cloud/Tracely-ai/.github/actions/tracely-gate@master
        with:
          api:   https://tracely.your-co.dev
          key:   ${{ secrets.TRACELY_KEY }}
```

4. Or replay recorded cases against your code

   Replay re-runs your agent on each promoted case's recorded input and serves the recorded tool and model outputs as fixtures, so it is deterministic and makes no model calls. It requires routing tool and model calls through the SDK's call_tool / call_llm seam; add --live to make real calls.

```bash
pip install tracely-ai
tracely replay planner --entrypoint my_pkg.agent:run
```

5. Connect a coding agent over MCP

   Every backend serves an MCP endpoint at /mcp scoped to the ingest key's workspace. The project also publishes an agent skill: npx skills add https://github.com/jwuthri-cloud/Tracely-ai --skill tracely.

```bash
claude mcp add --transport http tracely http://localhost:8000/mcp \
  --header "Authorization: Bearer tracely_dev_key"
```

## When to use it

- Stop a known agent failure from shipping again by promoting the failing production trace to a regression case that blocks the pull request reintroducing it
- Run agent regression suites in CI at no model cost by replaying recorded tool and LLM outputs instead of calling live APIs
- Triage large volumes of agent failures by clustering them into issues with counts rather than reading individual traces
- Self-host agent tracing, LLM-judge evaluation and alerting on your own infrastructure under an MIT licence
