Skip to main content

Multi-LLM Council Backend for AGENT-K - Three-stage consensus with GPT, Gemini, and Claude

Project description

AGENT-K Python Backend

Multi-LLM Council Backend for AGENT-K

╭──────────────────────────────────────────────── AGENT-K v2.3.7 ────────────────────────────────────────────────╮
│                            Multi-LLM Council - GPT + Gemini + Claude                                           │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

The Python backend provides multi-LLM consensus and Smart Context Selection for AGENT-K.

Features

  • Council Mode - Three-stage consensus with GPT-4, Gemini, and Claude
  • Smart Context Selection - RLM-inspired file selection using LLM reasoning
  • Scout Agent - Intelligent codebase research with query-aware file selection
  • LiteLLM Integration - Unified API for multiple LLM providers

Installation

pip install agentk8

Requirements

  • Python 3.10+
  • API Keys (set as environment variables):
    • OPENAI_API_KEY - For GPT-4
    • GEMINI_API_KEY - For Gemini
    • ANTHROPIC_API_KEY - For Claude

Quick Start

Scout Agent (Smart Context Selection)

from agentk.scout import Scout
import asyncio

async def main():
    scout = Scout(project_root="/path/to/project")

    # Query-aware file selection
    context = await scout.scan_project("Where is authentication handled?")
    print(context["files"])  # Returns only relevant files

    # Full investigation with web search
    report = await scout.investigate("Latest JWT best practices")
    print(report.to_context_string())

asyncio.run(main())

Council Mode (Multi-LLM Consensus)

from agentk.council import Council
import asyncio

async def main():
    council = Council()

    # Three-stage consensus
    result = await council.deliberate(
        "Design a rate limiting system for our API",
        mode="council"  # or "solo" for multi-Claude personas
    )
    print(result["final_synthesis"])

asyncio.run(main())

Council Architecture

                    ┌─────────────────────────────────────┐
                    │           Stage 1: Analysis          │
                    │  GPT-4 | Gemini | Claude (parallel)  │
                    └─────────────────┬───────────────────┘
                                      │
                    ┌─────────────────▼───────────────────┐
                    │         Stage 2: Cross-Review        │
                    │   Each model reviews others' work    │
                    └─────────────────┬───────────────────┘
                                      │
                    ┌─────────────────▼───────────────────┐
                    │       Stage 3: Chairman Synthesis    │
                    │     Claude synthesizes consensus     │
                    └─────────────────────────────────────┘

Smart Context Selection (RLM-Inspired)

Instead of blindly grabbing files, the Scout asks the LLM to select relevant files:

# Traditional approach (naive):
files = get_top_10_files()  # Often irrelevant

# Smart Context Selection:
scout = Scout(project_root=".")
context = await scout.scan_project("How does the auth middleware work?")
# LLM analyzes file tree + query → selects only auth-related files

This is inspired by the Recursive Language Models paper, which treats the codebase as an environment to navigate intelligently.

CLI Usage

# Run Scout investigation
python -m agentk.scout "Where are the API endpoints defined?"

# Run Council deliberation
python -m agentk.council "Design a caching strategy" --mode council

Module Structure

agentk/
├── __init__.py
├── council.py      # Multi-LLM consensus logic
├── scout.py        # Smart Context Selection
├── llm.py          # LiteLLM wrapper for unified API
└── tools.py        # File tree, directory scanning

Environment Variables

Variable Description
OPENAI_API_KEY OpenAI API key for GPT-4
GEMINI_API_KEY Google API key for Gemini
ANTHROPIC_API_KEY Anthropic API key for Claude

License

MIT License


AGENT-K v2.3.7 - Python Backend

GitHubPyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentk8-2.3.8.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentk8-2.3.8-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file agentk8-2.3.8.tar.gz.

File metadata

  • Download URL: agentk8-2.3.8.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentk8-2.3.8.tar.gz
Algorithm Hash digest
SHA256 40ab658e3636e57a54901a40c9f9ec615b967b1cd84d431ba5133b64c99f63e0
MD5 46f542d5adcd006358ee8f09e42c6d5e
BLAKE2b-256 b995118ff351d42053a1edc44a5e030ed479bbb4cb820a8d9ec477780330690e

See more details on using hashes here.

File details

Details for the file agentk8-2.3.8-py3-none-any.whl.

File metadata

  • Download URL: agentk8-2.3.8-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentk8-2.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e944d45437383e21694877c3b90525e86b65bfd96e5b9298b13aef42f87cbae6
MD5 53b75402fc4099cc912f6b0737a40aab
BLAKE2b-256 18426e22febfd18783e8cea77310192d5997f1ead1993b84e33fe5e21bbcf98e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page