Skip to main content

enbanc

Adversarial multi-agent adjudication. Advocates argue each possible answer; a judge cross-examines them until it can rule — with a full audit transcript.

Built on PydanticAI.

Why

Most "LLM as judge" tooling asks one model to score an output. enbanc instead stages an adversarial proceeding: every possible answer gets a dedicated advocate with its own tools, and a tool-less judge interrogates them across rounds until it can rule or the round limit is hit.

That structure is designed for decisions that need to be defensible — loan underwriting, insurance appetite, eligibility screening — where you need the reasoning and the evidence, not just the answer.

Install

uv add enbanc

Requires Python 3.11 or later.

A taste

This runs as written with OPENAI_API_KEY and TAVILY_API_KEY set. docs/guides/ has two complete programs that make a real decision each; the live test tier runs both, unchanged.

import asyncio
import os

from pydantic_ai.models import infer_model

from enbanc import (
    Advocate, Case, Judge, Ruling, Source, Statute, Tribunal, Undecided, Verdict,
)
from enbanc.tools import web_search

class LoanDecision(Verdict):        # the allowed answers, one advocate each
    APPROVE = "approve"
    DENY = "deny"

class LoanApplication(Case):        # the facts of one decision, given a schema
    applicant: str
    income: int

async def credit_file(applicant: str) -> list[Source]:
    """Look up the applicant's credit file."""  # a tool is any async function
    return [Source(reference=f"bureau://{applicant}", content="Debt-to-income: 0.51")]

tribunal = Tribunal(
    question="Shall the bank loan this applicant $500k?",
    verdicts=LoanDecision,
    statute=Statute(                # the rule being judged against
        text="Approve $500k loans only where DTI < 0.43 and ...",
        name="underwriting-v3",
    ),
    model=infer_model("openai:gpt-6-luna"),  # any pydantic-ai model
    judge=Judge(guidance="Where the record is ambiguous, deny."),
    advocates={
        LoanDecision.APPROVE: Advocate(
            tools=[credit_file, web_search(api_key=os.environ["TAVILY_API_KEY"])]
        ),
        LoanDecision.DENY: Advocate(tools=[credit_file]),
    },
    max_rounds=5,
)

async def main() -> None:
    hearing = await tribunal.hear(LoanApplication(applicant="A. Okonkwo", income=182000))

    match hearing.outcome:          # a ruling, or no verdict at all
        case Ruling(verdict=verdict, reasoning=reasoning, confidence=confidence):
            print(verdict)          # deny
            print(reasoning)        # why, in the judge's words, resting on the record
            print(confidence)       # 0.8: the judge's own estimate, not a probability
        case Undecided(reason=reason):  # rounds or budget spent, no verdict
            print(f"no verdict: the {reason} ran out")

    hearing.transcript              # every filing, in order
    hearing.usage                   # tokens and cost, judge plus advocates
    hearing.usage_by_participant    # the same spend, split by who incurred it

asyncio.run(main())

The judge has no tools — it reasons only over what advocates put into the record. Advocate tools are read-only, and that is a contract you keep: enbanc ships nothing that writes and has no mutation path of its own, but it cannot inspect a function you pass for side effects.

Every exhibit in the record carries a reference the tribunal stamped — a URL, a document key, the query that produced a row — taken from what the tool actually returned rather than from what the model said it returned. So a reviewer can follow any piece of evidence back to its source, and an advocate cannot cite something no tool produced.

The transcript also holds everything the advocates' tools returned and they didn't file, verbatim. An advocate that queries a damaging fact and argues around it leaves a trace: the retrieval is in the record and no exhibit cites it. That is the question no LLM-as-judge transcript usually answers — not what did it decide on? but what did it leave out?

It also holds what steered the decision: the guidance you gave each participant, the verdicts the bench was deciding among, and the version of the procedural prompt enbanc ran. A ruling reached under "where the record is ambiguous, deny" does not read in the artifact as one reached without it.

A tool is a plain async function; there is nothing to register or decorate, and enbanc.tools.web_search is built the same way yours is.

A tribunal that runs out of the envelope it was given — max_rounds deliberations, or an optional token or cost budget — without reaching a verdict returns Undecided, naming which of the two ran out. That is a finding, and it comes back on the hearing with the full transcript. A tribunal that loses a participant — the provider is down, a tool raises — is a different thing, and raises ProceedingFailed with the record so far attached. No ruling is ever issued on a bench that lost an advocate.

A proceeding takes minutes, so you can watch the record being written instead of waiting for it:

async with tribunal.hear_stream(case) as proceeding:
    async for entry in proceeding:  # each filing, at the moment it is filed
        print(f"round {entry.round}: {entry.filing.kind}")

hearing = proceeding.hearing        # the Hearing hear() would have returned

What you watch is the transcript itself — the same entries, in the same order — and hear() is this stream consumed to the end.

Design

The full design lives in docs/design/:

  • The tribunal — how a decision is reached: the round structure, the judge/advocate contract, and the constraints that hold it together.
  • Public API — every exported type, and what each piece carries.
  • Evidence — what a tool is, how you add your own, and how what one returns becomes an exhibit a reviewer can check.
  • Outcomes — every way a proceeding can end, worked through with concrete values: a ruling, a spent round limit, a spent budget, a downed provider, a misconfigured tribunal.
  • Prompting and rendering — what every participant actually reads: both procedural prompts in full, how a statute, case, and record become text, and what a rendered transcript looks like.
  • Execution — how a proceeding maps onto PydanticAI: the whole thing written out as literal messages, then the message history behind the transcript, the toolset that ledgers what an advocate's tools return, and the round loop itself.
  • Testing — how a library whose behaviour is LLM-driven is asserted on deterministically: the tiers, why the offline ones are enforced rather than trusted, and how the guarantee the transcript makes is checked by a test rather than by review.
  • Packaging — how the library is laid out as a package: the two namespaces you may import from, what __all__ promises, and what import enbanc is allowed to do.
  • Glossary — the courtroom vocabulary. One table, one minute.

The design is complete and carries no open questions. It is settled down to the schemas and the behaviour both: what an advocate sees, how a proceeding stops, what every ending looks like, the exact text each agent is sent, and how the loop is built. Every question those documents once carried is closed with an ADR in docs/decisions/ saying what was rejected and why. If you have opinions, that's the place to aim them.

How that design gets built is broken into pull requests in docs/implementations/ — one document per PR: its scope, the design sections it implements, and the tests it brings. Fifteen of them built 0.1.0.

Status

Alpha. 0.1.0 is the first release intended to be used; the releases before it were placeholders.

enbanc is pre-1.0, so a minor version may change the API, and every change is in CHANGELOG.md. What the models are told is versioned separately: each transcript records the procedure it ran under, and any change to the prompts is a new one, so hearings stay comparable across releases.

License

MIT

Metadata

Release files for enbanc 0.1.0

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

Source distribution (sdist)

Source distribution for enbanc 0.1.0
File Size Uploaded Provenance Actions
enbanc-0.1.0.tar.gz 62.5 kB Without provenance Details for enbanc-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 130.9 kB

Release files / enbanc-0.1.0.tar.gz

Download URL enbanc-0.1.0.tar.gz
Size 62.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5332f792893894aa3042ecfad4663b01cea99b3f7756050218fd4b234ec8d4c3
BLAKE2b-256 checksum
How to use checksums
8620a3293c02f707487c4bae46f68f2e650c2deafa5c8c4e0a679836e4b198be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / enbanc-0.1.0-py3-none-any.whl

Download URL enbanc-0.1.0-py3-none-any.whl
Size 68.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
beeed6e07f0e002e06dd938cb01143592464ade6c4adb606ec6913ec7e4ff763
BLAKE2b-256 checksum
How to use checksums
6144c230a9d2b1e8aa081afb3ff613975faa6f72d0d5e8a0ebb682afe8730529
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for enbanc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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