codexcw (Python)
Run Codex, Claude Code, or Grok Build non-interactively from Python, backed by
a Rust core. Codex wraps codex exec --json; Claude wraps
claude -p --output-format stream-json; Grok uses --no-auto-update and
streaming-messages-json. All expose iterables, callbacks, results, typed
usage, and typed errors through the same API.
The selected agent executable must be on PATH and authenticated. Codex must
support codex exec --json; Claude must support --output-format stream-json;
Grok must support streaming-messages-json.
Codex defaults are automation-friendly: ephemeral sessions, non-interactive
execution, a read-only sandbox, and approval never.
The Claude agent is selected with Runner(agent=codexcw.AGENT_CLAUDE); its
events are normalized into the same event model, with model selection via the
haiku/sonnet/opus aliases (CLAUDE_MODEL_*).
Select Grok with Runner(agent=codexcw.AGENT_GROK). New runs use read-only
sandboxing and dontAsk permissions; Grok sessions are always persisted.
Install
pip install codexcw
Usage
from codexcw import Runner, Request
runner = Runner()
result = runner.run(Request(prompt="diga oi"))
print(result.final_message)
print(result.usage.total_tokens)
print(result.usage.total_cost_usd)
Streaming
from codexcw import Runner, Request
runner = Runner()
session = runner.start(Request(prompt="resuma este repo"))
for event in session.events():
if event.type == "item.completed" and event.item.type == "agent_message":
print(event.item.text)
result = session.wait()
Account usage
from codexcw import AccountUsageRequest, get_account_usage
usage = get_account_usage(AccountUsageRequest(env={"CODEX_HOME": "/tmp/codex-home"}))
print(usage.rate_limits.primary.used_percent if usage.rate_limits.primary else None)
print(usage.token_usage.summary.lifetime_tokens if usage.token_usage else None)
from codexcw import get_claude_account_usage
claude_usage = get_claude_account_usage()
print(claude_usage.windows)
Running many agent instances
from codexcw import Runner, Request
runner = Runner()
group = runner.run_many(
[Request(prompt="review package A"), Request(prompt="review package B")],
max_concurrent=2,
)
for run_event in group.events():
print(run_event.index, run_event.event.type)
results = group.wait()
Async
import asyncio
from codexcw import Request
from codexcw.aio import Runner
async def main():
runner = Runner()
session = await runner.start(Request(prompt="oi"))
async for event in session.events():
print(event.type)
result = await session.wait()
print(result.final_message)
asyncio.run(main())
License
Metadata
Release files for codexcw 0.6.0
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 |
|---|---|---|---|---|
| codexcw-0.6.0.tar.gz | 78.3 kB | With provenance | Details for codexcw-0.6.0.tar.gz |
Built distributions (wheels)
Total release size: 6.5 MB
Release files / codexcw-0.6.0.tar.gz
| Download URL | codexcw-0.6.0.tar.gz |
|---|---|
| Size | 78.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52ce877d18710ee4d8abac93ffe416ac31ee46654b19b831ec2deb5b2a1b452b
|
|
BLAKE2b-256 checksum How to use checksums |
f093fa1e5f6ef1fd357cb3745dcd0f217d0359d90702b3e741c54353089f173c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-win_amd64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 874.2 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ee9af63ecb73e414ecf00cef4b59368c21b1b7bd699a535021737397a61aab04
|
|
BLAKE2b-256 checksum How to use checksums |
9bdf01427c7a5bdbcc8685955e888b776cb5b2463e0f3823bb502682bea71ba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-musllinux_1_1_x86_64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.9 Linux musl 1.1+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e9362f18c969655445c5a152fd5721d9cd5340477c65aae803363133e6e87cef
|
|
BLAKE2b-256 checksum How to use checksums |
89ba65c0c0597851974005775359068d965e6f95e4c21715feb07773cdb36f2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-musllinux_1_1_aarch64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-musllinux_1_1_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.9 Linux musl 1.1+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c901757d33dde1dd55f48d6d234c143e96a9c918d64e073fd522d3f734479949
|
|
BLAKE2b-256 checksum How to use checksums |
5f243675f1e6dcde10d9ee9f4f45c9ea3aa7ead34b888defa9e925ec28fb1ffa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 899.4 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4d5ef3b3f5fc257505620acc4a1678d664a98f56f92a70e648750a3d810385ca
|
|
BLAKE2b-256 checksum How to use checksums |
d2e0c18d022f27164c262cb6ba68d420581a75d35b527714d86eaecb0131fca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 857.0 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6c908284d4245f0f214853ba953f7d4e85be2dea70cb6e948f6874b6cfdbebc5
|
|
BLAKE2b-256 checksum How to use checksums |
2494c9f22317a0245ddd181859d6a1259322b62d64ce4a229e12f714e5356d82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 820.9 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
19f235e8ef75dee7d5c91a537a90ca757d09e45c8d6f14c77211261e7c24b2b4
|
|
BLAKE2b-256 checksum How to use checksums |
4f480a1a367144c606227de8ac0ae23b7fbbb2cfacf5ee986f69ed7349b4c2b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / codexcw-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | codexcw-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 860.5 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
d3e5349eabd4d758a8c4d966791a6c15b080ce5a2d83efa8379950cc48089c79
|
|
BLAKE2b-256 checksum How to use checksums |
bfb52840e459019ff7836fa89197383ee34926e2389456ab29ca72e45dbbca87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for codexcw 0.6.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.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for codexcw-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA 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.