Run the Codex CLI non-interactively from Python, backed by a Rust core.
Project description
codexcw (Python)
Run the Codex CLI non-interactively from Python, backed by a Rust core. It
spawns codex exec --json, decodes the JSONL event stream, and exposes each run
as iterables, callbacks, results, and typed errors.
The codex executable must be on PATH, authenticated, and new enough to
support codex exec --json. Defaults are automation-friendly: read-only
sandbox, approval never, ephemeral sessions, color disabled, git check
skipped.
Install
pip install codexcw
Usage
from codexcw import Runner, Request
runner = Runner()
result = runner.run(Request(prompt="diga oi"))
print(result.final_message)
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)
Running many Codex 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
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 Distributions
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 codexcw-0.2.1.tar.gz.
File metadata
- Download URL: codexcw-0.2.1.tar.gz
- Upload date:
- Size: 55.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0af1257c13cfcbcabc1529a9856cc9d0d4b8caa5a749cdc72046276499d02f4
|
|
| MD5 |
dcc08357ee2e7cdc854edb9c4b96d2ac
|
|
| BLAKE2b-256 |
45c5373ff26eee0cd387bc135e7354e3bce0b72b477ff1141000f43c80842a28
|
Provenance
The following attestation bundles were made for codexcw-0.2.1.tar.gz:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1.tar.gz -
Subject digest:
f0af1257c13cfcbcabc1529a9856cc9d0d4b8caa5a749cdc72046276499d02f4 - Sigstore transparency entry: 2129172366
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 716.1 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2ca51eef176863f217d6112a1369ea06399f52a09b14f291c28181be7cc8fd
|
|
| MD5 |
4f040a98dd8d2a1e7f043cf24f10925d
|
|
| BLAKE2b-256 |
f4792a1695567dcad1583469cd3fc908a847ceac477e2b265c7cbb8ce5b296fa
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-win_amd64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-win_amd64.whl -
Subject digest:
da2ca51eef176863f217d6112a1369ea06399f52a09b14f291c28181be7cc8fd - Sigstore transparency entry: 2129174215
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 961.1 kB
- Tags: CPython 3.9+, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f8003c205cc2ea9727f895a5cfccc13e74544ba994498e56a1c962902762d06
|
|
| MD5 |
7196e5bded701fa31f647fe85ed461fb
|
|
| BLAKE2b-256 |
d387292724730b35697f58a7ce2c2357b7b8f1d0f76d088ccfea67a9c313de55
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-musllinux_1_1_x86_64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-musllinux_1_1_x86_64.whl -
Subject digest:
8f8003c205cc2ea9727f895a5cfccc13e74544ba994498e56a1c962902762d06 - Sigstore transparency entry: 2129173471
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-musllinux_1_1_aarch64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-musllinux_1_1_aarch64.whl
- Upload date:
- Size: 898.3 kB
- Tags: CPython 3.9+, musllinux: musl 1.1+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b14c7a09d278a75decb363db7417df43d16b999069744ed8ba5351ab1573e96f
|
|
| MD5 |
42bdf84bd11bef15818dd02161559704
|
|
| BLAKE2b-256 |
9dd7b80d72ce9d7b09933c032e60ad8dbaa810415fb288d61af884b9e41af778
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-musllinux_1_1_aarch64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-musllinux_1_1_aarch64.whl -
Subject digest:
b14c7a09d278a75decb363db7417df43d16b999069744ed8ba5351ab1573e96f - Sigstore transparency entry: 2129173157
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 748.6 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b03c7b139083ddd61b2384bb6dd52a143a981936db8bb5cd19ae666b2c72b0a8
|
|
| MD5 |
292b930ceab9180f16f1e10ddcc15145
|
|
| BLAKE2b-256 |
6d4747eff8e8781317b1f0314c377958df55ca2df79298dd97ad8e8230fe5ed0
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
b03c7b139083ddd61b2384bb6dd52a143a981936db8bb5cd19ae666b2c72b0a8 - Sigstore transparency entry: 2129173767
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 720.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f167a355a4e1f529d8edc94137c7b3c0518eaca9a6b4d7da6ca68b9d2d6b1614
|
|
| MD5 |
7e6590ff80cf05f06de53978ef889f4b
|
|
| BLAKE2b-256 |
cd9764bbd8a3201f931e0c1c0753495a04527625c7e734709d4d7416daf9148a
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
f167a355a4e1f529d8edc94137c7b3c0518eaca9a6b4d7da6ca68b9d2d6b1614 - Sigstore transparency entry: 2129172530
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 680.7 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4a643dacba86fbabd575a2048b04e622806c23f6c30135c4b36715cd2ea1880
|
|
| MD5 |
67a399c018f6c6874a0d93e7469c6224
|
|
| BLAKE2b-256 |
c90f280bfe239cd0f5f832348d12097317554aa407c36e15d755bcbbb9e1757b
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
c4a643dacba86fbabd575a2048b04e622806c23f6c30135c4b36715cd2ea1880 - Sigstore transparency entry: 2129172692
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codexcw-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: codexcw-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 709.6 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1131f6e1c9321ffc3706c68e71eb5c8a7e9a3c0bfb6ba620956f95a42334ab5
|
|
| MD5 |
6cf2492d01959987c0dc9b989e8ff094
|
|
| BLAKE2b-256 |
62562ab55a8c630ea7811e52e4b15f22755a60104215e3a3e1c253f4ea209410
|
Provenance
The following attestation bundles were made for codexcw-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-pypi.yml on c3-oss/codexcw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codexcw-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
a1131f6e1c9321ffc3706c68e71eb5c8a7e9a3c0bfb6ba620956f95a42334ab5 - Sigstore transparency entry: 2129173961
- Sigstore integration time:
-
Permalink:
c3-oss/codexcw@3f318ec94ace9ce405e920c550c734abc8933d77 -
Branch / Tag:
refs/tags/py-v0.2.1 - Owner: https://github.com/c3-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-pypi.yml@3f318ec94ace9ce405e920c550c734abc8933d77 -
Trigger Event:
push
-
Statement type: