CouncilAsAJudge grades a response. It builds six judge agents, one per dimension: accuracy, helpfulness, harmlessness, coherence, conciseness and instruction adherence. The judges read the same text in parallel and each writes a detailed analysis of its own dimension. An aggregator agent then combines the six analyses into one report with an executive summary, a detailed analysis and recommendations.
You do not pass agents to the council. It creates the judges and the aggregator itself. You pass the text to grade, which should hold both the question and the response.
Reference: CouncilAsAJudge.
1. Grade a response
Put the question and the answer in one string and pass it torun. Each judge receives that string inside its own grading prompt.
output_type="final", run returns only the aggregator’s report, as a string.
2. Read each judge’s analysis
Setoutput_type="dict" to get the whole conversation as a list of {"role", "content"} messages:
"dict-all-except-first" gives the same list without the User message. "str" and "json" give the conversation as one string. Each run clears the conversation first, so one council can grade many responses.
3. Choose the models
Three parameters set the models:
Set both the judge model and
aggregation_model_name, or the aggregator still runs on gpt-5.4. A common choice is a fast model for the judges and a stronger one for the report.
4. Compare two answers
Grade several candidate answers with the same council and compare the reports. Here two writers answer the same question in different styles:output_type="final" on each writer makes writer.run return only its reply, so the council grades the answer and not the writer’s whole conversation.
5. Run async and handle failures
arun is the async form of run. It awaits each judge’s arun, then the aggregator’s, on the event loop. max_concurrency caps how many judges run at once; None runs all six together. With arun, judge messages are recorded in dimension order rather than finish order.
Any failure, including a single judge’s, raises EvaluationError with the failing dimension in its message, and no report is written. usage sums the token counts of the six judges and the aggregator across every run.
Things to know
- Seven calls per run. Six judges and one aggregator, each with
max_loops=1. The council’s ownmax_loopsis stored but not used. - Parallel by default.
runuses a thread pool sized to 75 percent of your CPU cores, so on most machines all six judges run at once. - Fixed dimensions. The six dimensions and their grading criteria live in
EVAL_DIMENSIONSinswarms.structs.council_as_judge. The judges are incouncil.judge_agents, keyed by dimension, and the aggregator iscouncil.aggregator_agent. - cache_size does nothing. The prompt builders keep their own cache of 128 entries.
- random_model_name=True replaces
model_namewith a model picked at random from a built-in list of several providers, so you need keys for each of them.
Next steps
- CouncilAsAJudge reference
- MajorityVoting guide, to pick between answers by vote
- LLMCouncil guide, where members answer and then rank each other
- Runnable scripts