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.
How a hearing runs
There is one advocate per allowed answer, so there can be two, three, or
twelve. Here the verdicts are approve, deny and refer:
sequenceDiagram
autonumber
actor You
participant J as Judge<br/>(no tools)
participant A as Advocate<br/>APPROVE
participant D as Advocate<br/>DENY
participant R as Advocate<br/>REFER
You->>J: tribunal.hear(case)
rect rgba(120, 160, 255, 0.12)
Note over J,R: Round 1 · Argument: every advocate files at once, blind to its peers
Note over A,R: Each advocate gathers evidence with its own read-only tools:<br/>any async function you write, or the bundled Tavily web_search
par
A->>J: Argument for APPROVE + exhibits
and
D->>J: Argument for DENY + exhibits
and
R-->>J: Concession: "the facts don't support REFER"
end
Note over R: The prompt tells every advocate to<br/>concede when the facts don't support its verdict.<br/>A concession is a finding, not a failure.
J->>J: Deliberate over the record
J->>A: Continuance: interrogatory r1-q1
J->>D: Continuance: interrogatory r1-q2
end
rect rgba(255, 180, 80, 0.12)
Note over J,R: Round 2+ · Interrogation: only advocates who were asked answer,<br/>and they can now see what their peers filed
A->>J: Response to r1-q1 + new exhibits
D->>J: Response to r1-q2 + new exhibits
J->>J: Deliberate: rule, or ask again (repeat)
end
alt the judge can rule
J->>You: Ruling: verdict · reasoning · confidence
else max_rounds or budget runs out
J->>You: Undecided: reason = "rounds" or "budget"
end
Note over You,R: Either way you also get the full transcript and the token/cost usage
The judge never gathers evidence itself. It decides only on what the advocates put into the record, and it can keep questioning until the record is enough.
Install
uv add enbanc
Requires Python 3.11 or later.
Basic usage
The smallest complete program: define the answers, describe the case, give each
advocate its tools, and read the outcome. It runs as written with
OPENAI_API_KEY and TAVILY_API_KEY set.
For real-world use, see docs/guides/. Each guide is one
runnable program that makes a real decision, such as underwriting a loan,
moderating a flagged post, or answering a factual question from the web. Each
one also shows a part of enbanc this sample leaves out, such as streaming a
hearing live, setting a cost budget, or hearing many cases at once. The live
test tier runs every guide 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 whatimport enbancis allowed to do. - Glossary — the courtroom vocabulary. One table, one minute.
The design describes what 0.1.0 does, 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 settled on the way there is closed with an ADR in
docs/decisions/ saying what was rejected and why. The
questions still open — including one that lets an advocate's citation be
stamped from the wrong ledger — sit under Open questions at the end of the
design doc that owns each. If you have opinions, those are the places 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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| enbanc-0.1.1.tar.gz | 63.5 kB | Without provenance | Details for enbanc-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enbanc-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for enbanc-0.1.1-py3-none-any.whl |
Total release size: 132.8 kB
Release files / enbanc-0.1.1.tar.gz
| Download URL | enbanc-0.1.1.tar.gz |
|---|---|
| Size | 63.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab03b48f6708cdd9509918931bce2ccb7a4e81e6ecbd8360b0965fb6b06296fc
|
|
BLAKE2b-256 checksum How to use checksums |
c602247720591058727300a0a84847fce2692ddf70d8a1fad3c729fc0b100bd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1-py3-none-any.whl
| Download URL | enbanc-0.1.1-py3-none-any.whl |
|---|---|
| Size | 69.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c4f8fdfba16509b33c35ee84fca13acd2ad290e5dff50e627a6ecdbcdc9c3d3
|
|
BLAKE2b-256 checksum How to use checksums |
02275a808db4aa969c4f4385b3d61280ba96568ee8b102415079955b0ec90ceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1
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.