onejudge
Typed async Python access to the onejudge CLI. The distribution is
onejudge, the import is onejudge_sdk, and each release depends on the
exact same onejudge-cli version.
pip install onejudge
import asyncio
from onejudge_sdk import OneJudge
async def main() -> None:
result = await OneJudge().run(
{"provider": {"kind": "oneharness"}},
"Review this repository",
cwd="/path/to/repository",
timeout=3600,
)
print(result.completed, result.assistant_turns, result.verdicts)
asyncio.run(main())
run validates the config before starting the CLI, writes a temporary effective
JSON config (JSON is valid YAML), and always sends the task over stdin with
--task -. It accepts a provider override, subprocess cwd, additional env
(including ONEHARNESS_HISTORY_LABELS and ONEHARNESS_TIMEOUT), and a timeout.
Executable resolution is the constructor's executable, then ONEJUDGE_BIN,
then onejudge on PATH.
Exit 0 and 1 return RunResult: exit_code and stderr remain available, and
raw, completed, verdicts, usage, assistant_turns, and agent_turns
cover ai-orchestrator's dispatch needs. Exit 2 (bad config or provider/runtime
failure) and unexpected nonzero exits raise OneJudgeProcessError without
discarding the exit code or stderr. A caller timeout raises
OneJudgeTimeoutError.
Watching a run as it happens
An agent turn can take 600–2000 seconds. Pass on_event to see its tool activity
while it is still running: the SDK runs the CLI under --stream, reads the NDJSON
as it arrives, and calls back once per event before returning the same
RunResult.
from onejudge_sdk import OneJudge, StreamEvent
def watch(event: StreamEvent) -> None:
print(event["turn"], event["event"].get("name"))
result = await OneJudge().run(config, "Review this repository", on_event=watch)
Every line is validated against the same generated contract the buffered path
uses, so an unreadable line, an envelope this SDK does not model, or a stream that
stops before its terminal result line raises ContractError — never a partial
run that looks finished. Events arrive live from a provider that streams
(provider.stream: true) and are replayed at the end of the turn from one that
does not, so on_event works either way. The protocol is documented in
docs/streaming.md.
The Rust JSON Schemas generate the SDK's complete public type surface. Besides
RunConfig and RunReport, nested contracts such as ProviderConfig,
EvalConfig, Transcript, Usage, and JudgeVerdict are importable from
onejudge_sdk; StreamEvent is one live event's payload and EventHandler the
on_event signature.
The JSONL interface in docs/protocol.md is a different thing: the internal
CommandProvider request/response protocol, not a CLI result stream.
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 onejudge-0.3.8.tar.gz.
File metadata
- Download URL: onejudge-0.3.8.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48f5e1f52bf22bf6e4675ddc40aeeb903b75509e5b8e2cfca426023b18c8918b
|
|
| MD5 |
59cbf1f549d5bd75ac38df818fc36ecb
|
|
| BLAKE2b-256 |
e5a06182ab481854584036eaae0922297ee92f8d5e8d9ba1c41102860947174e
|
Provenance
The following attestation bundles were made for onejudge-0.3.8.tar.gz:
Publisher:
release-pypi.yml on nickderobertis/onejudge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onejudge-0.3.8.tar.gz -
Subject digest:
48f5e1f52bf22bf6e4675ddc40aeeb903b75509e5b8e2cfca426023b18c8918b - Sigstore transparency entry: 2431854185
- Sigstore integration time:
-
Permalink:
nickderobertis/onejudge@554b24a993e5da714bd02763d35033620f631851 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/nickderobertis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@554b24a993e5da714bd02763d35033620f631851 -
Trigger Event:
release
-
Statement type:
File details
Details for the file onejudge-0.3.8-py3-none-any.whl.
File metadata
- Download URL: onejudge-0.3.8-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f4a360910fedbca66b3b1743a5eb1309cf6829ef652e0fec2906c9c2dcc9575
|
|
| MD5 |
1ef9ba40ba61a631e6d1b01b3c72510b
|
|
| BLAKE2b-256 |
e0c75157a30494b83d49d433bc7bd4b2f1344daa12733f0394fa46fbdd139529
|
Provenance
The following attestation bundles were made for onejudge-0.3.8-py3-none-any.whl:
Publisher:
release-pypi.yml on nickderobertis/onejudge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onejudge-0.3.8-py3-none-any.whl -
Subject digest:
0f4a360910fedbca66b3b1743a5eb1309cf6829ef652e0fec2906c9c2dcc9575 - Sigstore transparency entry: 2431854342
- Sigstore integration time:
-
Permalink:
nickderobertis/onejudge@554b24a993e5da714bd02763d35033620f631851 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/nickderobertis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@554b24a993e5da714bd02763d35033620f631851 -
Trigger Event:
release
-
Statement type: