> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-6/multi-judge-consensus.md).

# Recipe: multi-judge consensus

When no single judge captures a multi-faceted dimension, run several judges over the same trace and aggregate (majority vote, weighted average). Reduces single-judge noise meaningfully — 3 judges with majority vote roughly halves the false-positive rate compared to one.

```python
from layerlens import Stratix
client = Stratix()

JUDGE_IDS = ["judge_helpfulness", "judge_safety", "judge_factual"]

def consensus_for_trace(trace_id: str):
 """Run all judges against one trace, return majority vote."""
 verdicts = []
 for jid in JUDGE_IDS:
 evaluation = client.trace_evaluations.create(trace_id=trace_id, judge_id=jid)
 result = client.trace_evaluations.wait_for_completion(evaluation.id)
 verdicts.append(result.passed)

 # Majority vote
 return verdicts.count(True) > len(verdicts) // 2
```

For concurrent execution across many judges and traces, use `AsyncStratix`:

```python
import asyncio
from layerlens import AsyncStratix
client = AsyncStratix()

async def consensus_async(trace_id: str):
 creates = [client.trace_evaluations.create(trace_id=trace_id, judge_id=jid) for jid in JUDGE_IDS]
 evals = await asyncio.gather(*creates)
 waits = [client.trace_evaluations.wait_for_completion(e.id) for e in evals]
 results = await asyncio.gather(*waits)
 return [r.passed for r in results]
```

## See also

* [Concept: Judges](/8.-evaluate-score-the-outputs/judges-1.md)
* [SDK reference: trace\_evaluations](/more-in-this-section-9/trace-evaluations-1.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layerlens.ai/more-in-this-section-6/multi-judge-consensus.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
