# AI use cases for Opik (comet-ml/opik)

Repo: [comet-ml/opik](https://github.com/comet-ml/opik) | Use cases: 3 | Page: https://dedupedai.com/use-cases/comet-ml-opik/

Opik is an open-source platform to trace, evaluate and monitor LLM applications and agents. A @track decorator logs nested calls as traces, LLM-as-a-judge metrics such as Hallucination score outputs, datasets and experiments compare versions, and the whole platform can be self-hosted with Docker Compose or used on Comet.com, with an MCP setup so coding agents can read traces.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Trace every LLM and tool call in your app: https://dedupedai.com/use-cases/comet-ml-opik/trace-an-llm-app-with-opik-track/
- Score answers for hallucination with an LLM judge: https://dedupedai.com/use-cases/comet-ml-opik/score-hallucinations-with-opik-llm-judge/
- Self-host Opik on your own machine: https://dedupedai.com/use-cases/comet-ml-opik/self-host-opik-with-docker/

## How to trace every LLM and tool call in your app with Opik

Repo: [comet-ml/opik](https://github.com/comet-ml/opik) | Difficulty: Beginner | Time: 30 minutes | Basis: From the README

Wrap functions with @track so each call, including nested ones, shows up as a trace you can inspect.

**Who it is for:** A developer debugging an agent that sometimes gives wrong answers.

**The problem:** Without traces you cannot see which step of a multi-step agent went wrong.

**The outcome:** Full agent and pipeline traces logged to Opik for every call.

### Steps

1. Install the SDK with `pip install opik`
2. Run `opik configure` and enter your server address or Comet API key and workspace
3. Decorate your functions with @track from Opik
4. Run the app and open the traces; use one of the integrations such as LangChain or LiteLLM if you already use them

### Prompt to paste into your agent

```text
Using comet-ml/opik, install it with `pip install opik`, run `opik configure`, add @track to the main functions of <my LLM app>, run it once, and summarize the trace tree that was logged.
```

### Caveat

This card is written from the comet-ml/opik README, not from a test run by Deduped. Before you start, make sure you have Python with pip. Check the repo for newer instructions before you rely on these steps.

Risk, privacy: Prompts and outputs are logged to the Opik server; self-host it if they contain sensitive data.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/comet-ml-opik/trace-an-llm-app-with-opik-track/

## How to score answers for hallucination with an LLM judge with Opik

Repo: [comet-ml/opik](https://github.com/comet-ml/opik) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Use the built-in Hallucination metric to check whether an output is supported by its context.

**Who it is for:** A team running a RAG app that sometimes invents facts.

**The problem:** Manual spot checks do not scale and miss regressions.

**The outcome:** A numeric score per answer you can track across datasets and experiments.

### Steps

1. Install the SDK with `pip install opik` and run `opik configure`
2. Import Hallucination from Opik.evaluation.metrics
3. Call metric.score with the input, output and context, as in the README
4. Run evaluations over a dataset and compare experiments, or add them to CI with the PyTest integration

### Prompt to paste into your agent

```text
Using comet-ml/opik, score 20 question, answer and context triples from <my RAG logs> with the Hallucination metric and list the five lowest scoring answers.
```

### Caveat

This card is written from the comet-ml/opik README, not from a test run by Deduped. Before you start, make sure you have Python with pip. Check the repo for newer instructions before you rely on these steps.

Risk, cost: LLM-as-a-judge metrics call a model for every score, which costs tokens on hosted providers.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/comet-ml-opik/score-hallucinations-with-opik-llm-judge/

## How to self-host Opik on your own machine with Opik

Repo: [comet-ml/opik](https://github.com/comet-ml/opik) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Clone the repo and start the full platform with the Opik.sh script, then point the SDK at it.

**Who it is for:** A developer or company that cannot send traces to a third-party cloud.

**The problem:** Many observability tools only offer self-hosting on an enterprise plan.

**The outcome:** A local Opik UI at localhost:5173 receiving traces from your apps.

### Steps

1. Run `git clone https://github.com/comet-ml/opik.git` and `cd opik`
2. Start the platform with `./opik.sh` (use `./opik.sh --verify` to check that all containers are healthy)
3. Configure the SDK with `opik configure` for the self-hosted address, or call Opik.configure(use_local=True)
4. Stop with `./opik.sh --stop`; only use `./opik.sh --clean` when you want to remove all data

### Prompt to paste into your agent

```text
Self-host comet-ml/opik with `./opik.sh`, verify it with `./opik.sh --verify`, send one test trace from <my script>, and confirm it appears at localhost:5173.
```

### Caveat

Docker Compose is meant for local development and testing; the README points to Helm for production.

Risk, data-loss: `./opik.sh --clean` stops all containers and removes all Opik data volumes.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/comet-ml-opik/self-host-opik-with-docker/
