Skip to main content

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

Release files for agentk8 2.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentk8 2.3.8
File Size Uploaded
agentk8-2.3.8.tar.gz 19.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentk8 2.3.8
File Interpreter ABI Platform
agentk8-2.3.8-py3-none-any.whl Python 3 none any Details

Total release size: 40.5 kB

Release files / agentk8-2.3.8.tar.gz

Download URL agentk8-2.3.8.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
40ab658e3636e57a54901a40c9f9ec615b967b1cd84d431ba5133b64c99f63e0
BLAKE2b-256 checksum
How to use checksums
b995118ff351d42053a1edc44a5e030ed479bbb4cb820a8d9ec477780330690e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / agentk8-2.3.8-py3-none-any.whl

Download URL agentk8-2.3.8-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e944d45437383e21694877c3b90525e86b65bfd96e5b9298b13aef42f87cbae6
BLAKE2b-256 checksum
How to use checksums
18426e22febfd18783e8cea77310192d5997f1ead1993b84e33fe5e21bbcf98e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

2.3.8 This release

2 release files

2.3.7

2 release files

2.3.6

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page