Skip to main content

Overview

The LLMCouncil creates a council of specialized LLM agents that collaborate through independent responses, peer review, and synthesis. Inspired by Andrej Karpathy’s llm-council, it demonstrates how different models evaluate and rank each other’s work.

Installation

Workflow

  1. Dispatch: Query sent to all council members in parallel
  2. Respond: Each member independently answers the query
  3. Evaluate: All members review and rank anonymized responses
  4. Synthesize: Chairman creates final answer based on responses and rankings

Attributes

str
default:"LLM Council"
Name of the council
str
default:"A collaborative council of LLM agents..."
Description of the council’s purpose
Optional[List[Agent]]
default:"None"
List of Agent instances representing council members. If None, creates default council with GPT-5.1, Gemini 3 Pro, Claude Sonnet 4.5, and Grok-4
str
default:"gpt-5.1"
Model name for the Chairman agent that synthesizes responses
bool
default:"True"
Whether to print progress and intermediate results
HistoryOutputType
default:"dict-all-except-first"
Format for the output (“list”, “dict”, “string”, “final”, “json”, “yaml”, etc.)

Methods

run()

Execute the full LLM Council workflow.
Parameters:
  • task (str): The user’s task/query to process (preferred parameter)
  • query (str): Alias for task (kept for backwards compatibility)
Returns: Formatted output containing conversation history with all responses, evaluations, and synthesis

batched_run()

Run the LLM Council workflow for a batch of tasks.
Parameters:
  • tasks (List[str]): List of tasks to process
Returns: List of formatted outputs

Usage Examples

Basic Usage with Default Council

Custom Council Members

Batch Processing

Different Output Formats

Non-Verbose Mode

Default Council Members

When no custom members are provided, the default council includes:
  1. GPT-5.1 Councilor
    • Specialization: Analytical and comprehensive responses
    • Focus: Deep analysis, thorough exploration
  2. Gemini 3 Pro Councilor
    • Specialization: Concise and well-structured responses
    • Focus: Clear structure, efficient information processing
  3. Claude Sonnet 4.5 Councilor
    • Specialization: Thoughtful and balanced responses
    • Focus: Nuanced reasoning, ethical considerations
  4. Grok-4 Councilor
    • Specialization: Creative and innovative responses
    • Focus: Unique perspectives, creative problem-solving

Evaluation Process

Each council member evaluates all responses (anonymized) and provides:
  1. Rankings: Ordered list from best to worst response
  2. Reasoning: Explanation for each ranking
  3. Observations: Additional insights about strengths/weaknesses
Example evaluation format:

Synthesis Process

The Chairman agent:
  1. Reviews all original responses
  2. Considers all evaluations and rankings
  3. Identifies strongest elements from each response
  4. Creates cohesive final answer incorporating best aspects
  5. Acknowledges which perspectives influenced the synthesis

Output Structure

The conversation history includes:

Features

  • Parallel Execution: All council members respond simultaneously
  • Anonymous Evaluation: Responses are anonymized during peer review
  • Multi-Model Diversity: Leverages different LLM strengths
  • Peer Review: Each member evaluates all responses objectively
  • Intelligent Synthesis: Chairman creates cohesive final answer
  • Transparent Process: Full conversation history available
  • Flexible Output: Multiple output format options
  • Batch Processing: Handle multiple queries efficiently

Best Practices

  1. Council Composition: Include agents with complementary strengths
  2. Clear Queries: Provide well-defined questions for best results
  3. Output Type: Use “final” for end-user answers, “dict” for analysis
  4. Custom Members: Tailor council to your domain/use case
  5. Verbose Mode: Enable for understanding the decision process