Python RPC client for @tangle-network/agent-eval — judge content against rubrics over HTTP or stdio RPC. Eval logic runs in the Node runtime; this package is a thin wire client.
Project description
agent-eval-rpc — Python client
Python client for @tangle-network/agent-eval — a content/code judging framework written in TypeScript. This package is a thin transport adapter: every judgement runs in the Node runtime, marshalled over HTTP or stdio RPC. Two languages, one implementation. No drift.
What you get
A function-call interface to score any string against a rubric:
from agent_eval_rpc import Client
client = Client() # auto-detects HTTP server, falls back to subprocess
result = client.judge(
content="We just launched zero-copy IO between agents and their workdir",
rubric_name="anti-slop",
)
print(result.composite) # 0.0..1.0 — single number to gate on
print(result.dimensions) # {"buyer_quality": 0.7, "voice": 0.8, "signal": 0.9}
print(result.failure_modes) # [] or ["ai-cadence", "marketing-tone", ...]
print(result.wins) # ["specific-component", "earned-detail", ...]
print(result.rationale) # "The post names a real architectural detail..."
That's the entire surface for content judging.
Install
cd clients/python
pip install -e .
To use it, one of:
npm install -g @tangle-network/agent-eval— gives you theagent-evalbinary, used by the subprocess transport (works offline, slower per call due to Node startup ~500ms).- Run a server:
agent-eval serve --port 5005— gives you HTTP transport (~10ms per call once up).
The Python client picks whichever is available. Force one with Client(transport="http") or Client(transport="subprocess").
Why the architecture works this way
The TypeScript package is the source of truth for evaluation logic. We don't reimplement rubrics, scoring, or judges in Python — we marshal JSON to the canonical runtime over a versioned wire protocol (defined as Zod schemas, exported as OpenAPI, mirrored in this package as pydantic models).
Adding a new method to the API means: define a Zod schema in src/wire/schemas.ts, write the handler in src/wire/handlers.ts, and the Python client picks it up on the next regeneration. There is no separate Python implementation to maintain.
This is the same pattern as the Anthropic SDK, Stripe SDK, and gRPC: one canonical implementation, language-specific transport clients.
API
Client
Client(
base_url: str | None = None, # AGENT_EVAL_URL or http://127.0.0.1:5005
cli_path: str | None = None, # AGENT_EVAL_CLI or 'agent-eval'
transport: "auto" | "http" | "subprocess" = "auto",
timeout_s: float = 120.0,
)
client.judge(...)
Score a piece of content against a rubric.
def judge(
*,
content: str, # the text being judged
rubric_name: str | None = None, # OR
rubric: Rubric | dict | None = None, # an inline rubric definition
context: dict | None = None, # free-form metadata for the judge
model: str | None = None, # override the judge LLM
) -> JudgeResult
Either rubric_name (use a built-in like "anti-slop") or rubric (an inline definition with your own dimensions/prompt). Not both.
Returns JudgeResult:
composite: float— weighted score in 0..1. The single number to gate on.dimensions: dict[str, float]— per-axis scores (e.g.{"buyer_quality": 0.7}).failure_modes: list[str]— ids of negative patterns detected.wins: list[str]— ids of positive patterns detected.rationale: str— plain-English explanation.rubric_version: str— stable hash of the rubric used. Compare scores only when this matches.model: str— LLM that produced the judgement.duration_ms: int— wall-clock latency.
client.list_rubrics()
Return every rubric the server has registered, with their dimensions and stable rubric_version.
rubrics = client.list_rubrics()
for r in rubrics.rubrics:
print(r.name, r.description, r.rubric_version)
client.version()
Return server + wire-protocol version. Match your pip install version to version; check wire_version for compatibility.
v = client.version()
assert v.version.startswith("0.20")
assert v.wire_version == "1.0.0"
Defining a custom rubric
Built-in anti-slop is tuned for technical-buyer audiences. For different scoring, pass a Rubric inline:
from agent_eval_rpc import Client, Rubric, RubricDimension, FailureMode
rubric = Rubric(
name="my-rubric",
description="Does this commit message explain WHY, not just what?",
systemPrompt="You score commit messages. Score 0..1 on whether the WHY is clear...",
dimensions=[
RubricDimension(id="explains_why", description="Does the message say *why*?", weight=1.0),
],
failureModes=[
FailureMode(id="what-not-why", description="States the change but not the reason"),
],
)
result = client.judge(content="bumped the version", rubric=rubric)
Errors
| Exception | When |
|---|---|
ValidationError |
Server (or pydantic) rejected the request as malformed. Fix your inputs. |
RubricNotFoundError |
Unknown rubric_name. Call list_rubrics() to see what's registered. |
TransportError |
HTTP unreachable or subprocess failed. Retry or check the server. |
AgentEvalError |
Base class — catches everything above. |
All errors carry .code and .details (the structured payload from the server).
Versioning
This package is version-locked to the npm package. agent-eval-rpc==0.21.0 ↔ @tangle-network/agent-eval@0.21.0. CI verifies the npm package, Python package, runtime __version__, and release tag all agree before publish. If one registry publish fails after the other succeeds, retry the failed publish from the same tag or supersede with the next patch release.
wire_version is separate. It bumps only on breaking schema changes. Package versions can differ across releases as long as wire_version is the same.
Development
# install in editable mode
pip install -e ".[dev]"
# unit tests (no Node required)
pytest tests/test_models.py
# integration tests against the bundled CLI
cd ../.. && pnpm build # build the agent-eval CLI in repo root
cd clients/python && pytest # runs subprocess tests against dist/cli.js
Adding a new method
When the TS side adds a new endpoint (say evaluateScenario):
- Update
src/wire/schemas.tswithEvaluateScenarioRequestSchemaandEvaluateScenarioResponseSchema. - Add a handler in
src/wire/handlers.ts, route insrc/wire/server.ts, and case insrc/wire/rpc.ts. - In this client, add the matching pydantic model in
models.pyand method onClient. The pattern is mechanical — copy the shape fromjudge. - Test in both languages. Bump versions together.
A future iteration moves step 3 to datamodel-code-generator -i openapi.json so it's mechanical-and-automatic instead of mechanical-by-hand. Until the surface grows past ~10 endpoints, hand-written models are more readable.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_eval_rpc-0.21.0.tar.gz.
File metadata
- Download URL: agent_eval_rpc-0.21.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4147c6e6eed753bf792f78bcd6df9e40b40013297009c0cec404e09ecc5a32b2
|
|
| MD5 |
c6fbfd53e1edbdc2962c0e42f40b122c
|
|
| BLAKE2b-256 |
6e2c6f536037fa50b5d3db48cc69ba24adc183af79861e326e8906bdfbfbd567
|
Provenance
The following attestation bundles were made for agent_eval_rpc-0.21.0.tar.gz:
Publisher:
publish.yml on tangle-network/agent-eval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_eval_rpc-0.21.0.tar.gz -
Subject digest:
4147c6e6eed753bf792f78bcd6df9e40b40013297009c0cec404e09ecc5a32b2 - Sigstore transparency entry: 1475709288
- Sigstore integration time:
-
Permalink:
tangle-network/agent-eval@ac0c593e0acafcab35bdf2abc6069afc5db7601a -
Branch / Tag:
refs/tags/v0.21.0 - Owner: https://github.com/tangle-network
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ac0c593e0acafcab35bdf2abc6069afc5db7601a -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_eval_rpc-0.21.0-py3-none-any.whl.
File metadata
- Download URL: agent_eval_rpc-0.21.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d301457bc23feda61551197ccd0f1fdeab6900247a1b64ca386fd3e7930a747f
|
|
| MD5 |
239e7b90d6018273e3e0ac479e3cde66
|
|
| BLAKE2b-256 |
f4c0097b98caca869a436336cf8601bf4799b61d808395a9cd4a747b11b1d11f
|
Provenance
The following attestation bundles were made for agent_eval_rpc-0.21.0-py3-none-any.whl:
Publisher:
publish.yml on tangle-network/agent-eval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_eval_rpc-0.21.0-py3-none-any.whl -
Subject digest:
d301457bc23feda61551197ccd0f1fdeab6900247a1b64ca386fd3e7930a747f - Sigstore transparency entry: 1475709417
- Sigstore integration time:
-
Permalink:
tangle-network/agent-eval@ac0c593e0acafcab35bdf2abc6069afc5db7601a -
Branch / Tag:
refs/tags/v0.21.0 - Owner: https://github.com/tangle-network
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ac0c593e0acafcab35bdf2abc6069afc5db7601a -
Trigger Event:
push
-
Statement type: