# BRAINIAC Concurrency Hazard Detector

> BRAINIAC Concurrency Hazard Detector is a paid API for AI agents from www.brainiac.software, paid per call via x402, $0.04/call, status unknown (last checked 2026-11-11).

Statically analyzes source code files for concurrency hazards such as race conditions and unsafe shared-state assignments using deterministic pattern matching.

## Facts

- Endpoint: POST https://www.brainiac.software/api/v1/code/concurrency-hazard-detect?utm_source=zero.xyz
- Price: $0.04/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/brainiac-concurrency-hazard-detector-50ef507f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7wvz0_1vgM5WPpEHS3m8x

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability brainiac-concurrency-hazard-detector-50ef507f -d '<json body>'
```

Example prompt: Can you scan my worker.js file for concurrency hazards — look for any shared state assignments that happen without a nearby lock or synchronization mechanism?

## When to prefer this

Use this endpoint when you need a fast, accountless, pay-per-call static check for concurrency hazards in source code without spinning up a full static analysis toolchain. It is ideal for CI pipeline spot-checks, pre-merge audits, or agent workflows that need a quick signal on race conditions in JavaScript, TypeScript, Python, or Go files. It is not a runtime tracer and does not execute code, so prefer it for rapid pattern-based triage rather than exhaustive runtime verification.

## Known failure modes

- Files array empty or missing — validation error returned
- File source too large (exceeds 100,000 character limit per file) — rejected with schema error
- Too many files submitted (over 200) — rejected with schema error
- Unsupported language enum value — schema validation failure
- Payment not completed via x402 — 402 Payment Required response
- No concurrency patterns found — empty findings array returned with zero-count summary

## How this service works

Pay-per-call APIs for AI agents: OFAC sanctions screening, compliance checks, token security, and Base chain data via x402. No account. Fixed USDC price. MCP-ready.

## Output

Returns a JSON object containing a summary (file count and total findings), a list of findings each with a hazard code, line number, file path, evidence snippets, severity level, and remediation guidance, plus explanatory notes clarifying that findings are deterministic pattern matches and no code is executed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "files": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "path",
     "source"
    ],
    "properties": {
     "path": {
      "type": "string",
      "maxLength": 260,
      "minLength": 1
     },
     "source": {
      "type": "string",
      "maxLength": 100000,
      "minLength": 1
     },
     "language": {
      "enum": [
       "javascript",
       "typescript",
       "python",
       "go",
       "other"
      ],
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "maxItems": 200,
   "minItems": 1
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "summary": {
   "files": 1,
   "findings": 1
  },
  "findings": [
   {
    "code": "assignment_without_visible_lock",
    "line": 1,
    "path": "worker.js",
    "evidence": [
     "worker.js:1 assigns state in a concurrent-looking file without a nearby lock keyword on that line."
    ],
    "severity": "low",
    "remediation": "If the binding is shared, add synchronization; if not, keep it local to the task."
   }
  ],
  "explanations": [
   "Findings are deterministic pattern matches on supplied source text. They are not proof of a race and the code is not executed.",
   "No repository checkout or runtime tracer is used."
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/brainiac-concurrency-hazard-detector-50ef507f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.brainiac.software](https://www.zero.xyz/host/www.brainiac.software/llms.txt)
