## TL;DR
Check existence before creating, and treat a create timeout as unknown, not as failure: the agent created the same Comet experiment repeatedly because the create call timed out after the server had already created it, so list experiments by name first and reuse the match. A timeout on a create is ambiguous: the experiment may exist. Retrying the create without checking manufactures duplicates with identical names and split histories.

```text
agent loop detected: agent keeps creating same Comet experiment after create timeout error
```

## Use this when
- The check or run fails with this symptom: an agent loop keeps creating the same Comet experiment after a create timeout.
- You are working on an agent workflow that creates Comet experiments programmatically before logging and the failure repeats on the same data or configuration.
- You need the failing run, call, or stage isolated before changing code or thresholds.

## Not for this skill when
- A create that genuinely failed server side, where a retry after a not-found check is correct.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. List experiments in the workspace by the target name. Verify: one or more experiments with that name already exist
2. Pick the earliest matching experiment as the canonical one and note the duplicates. Verify: the canonical experiment id is recorded
3. Change the workflow to a get-or-create pattern: search by name, create only when absent. Verify: a rerun reuses the existing experiment
4. After any create timeout, search before retrying. Verify: a timed out create that succeeded is reused instead of duplicated
5. Archive or merge the duplicate experiments histories where the tool allows. Verify: the workspace shows one experiment per intended experiment

## Variant phrasings
### agent keeps creating same Comet experiment create timeout
The shorter phrasing focused on the named failure.
### duplicate comet experiments agent loop error
The symptom phrasing a searcher tries next.
### get or create experiment timeout fix
The variant naming the failing stage or tool directly.

Compatibility: Comet ML experiment creation APIs, agent get-or-create patterns

## Why it happens
Create calls are not idempotent in most trackers, and network timeouts hide successful creates. Agent retry logic written for reads, where a retry is harmless, duplicates state when applied to writes, and each duplicate then attracts its own runs.

## Edge cases / pitfalls
- Get-or-create needs a unique key beyond the display name when names legitimately repeat, such as a project plus a dataset version.
- Duplicates that already collected runs cannot simply be deleted without losing history; consolidate deliberately.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_FScC5hHvYuRMRnZqeI80-g
