Skip to main content

Python bridge for Codex app-server sessions and live conversation state

Project description

open-codex-bridge

Python facade for running Codex app-server sessions and sharing their live conversation state over the Codex IPC owner/follower protocol.

Library usage

from pathlib import Path

from codex_bridge import CodexIpcConfig, CodexIpcSession


async def main() -> None:
    config = CodexIpcConfig(
        codex_bin=Path("/opt/homebrew/bin/codex"),
        host_id="local",
        model="gpt-5.4",
        reasoning_effort="high",
    )

    async with CodexIpcSession(config) as session:
        thread = await session.start_new_thread()
        print(f"started {thread.id}")

        async for state in session.watch_state():
            # Forward this raw conversation state to a browser over WebSocket.
            print(state)


async def resume_existing(thread_id: str) -> None:
    async with CodexIpcSession(CodexIpcConfig(thread_id=thread_id)) as session:
        await session.hydrate_initial_state()
        await session.run_prompt("Summarize the current repo", wait_for_completion=True)

If codex_bin is omitted, the Codex SDK uses its pinned runtime resolver. Pass an openai_codex.CodexConfig as codex_config when you need full control over app-server launch arguments.

SSH app-server

SSH websocket transport is an open-codex-bridge extension, not part of the official openai-codex SDK:

from codex_bridge import (
    AppServerConfig,
    CodexIpcConfig,
    SshConnectionConfig,
    SshWebsocketAppServerConfig,
)

config = CodexIpcConfig(
    codex_config=AppServerConfig(
        ssh_websocket=SshWebsocketAppServerConfig(
            connection=SshConnectionConfig(host="builder.example.com"),
            remote_cwd="/srv/project",
        )
    )
)

The older app_server_config argument remains available as a compatibility alias for existing consumers.

TUI demo

The TUI is a development tool and is kept out of the core dependency set:

uv run --extra tui python examples/demo.py --codex-bin /opt/homebrew/bin/codex

Core imports such as import codex_bridge do not require textual, rich, or pillow.

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

open_codex_bridge-0.1.9.tar.gz (177.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_codex_bridge-0.1.9-py3-none-any.whl (60.5 kB view details)

Uploaded Python 3

File details

Details for the file open_codex_bridge-0.1.9.tar.gz.

File metadata

  • Download URL: open_codex_bridge-0.1.9.tar.gz
  • Upload date:
  • Size: 177.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for open_codex_bridge-0.1.9.tar.gz
Algorithm Hash digest
SHA256 1d330c537133ac47b14f78e3c82d4b230fbb0129e04a7c81447503393359c674
MD5 0a391fd9687f98f19ab523dc0fdda845
BLAKE2b-256 0f52797e92d0ff43b4d9a56fc9465745353486a7fd20eda24d0dd26891cbf89e

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_codex_bridge-0.1.9.tar.gz:

Publisher: publish.yml on Sube-py/open-codex-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_codex_bridge-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for open_codex_bridge-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9c7263624f4416ed181794b9cece2d38586987d55e55061bc8c66f544c2d537b
MD5 c865022aa6bfacc5aa6b3b1a6b630710
BLAKE2b-256 6f43a5499ff1fa1e994c843e0c1e40ee0953e8f8a587e29b4c732c5516117429

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_codex_bridge-0.1.9-py3-none-any.whl:

Publisher: publish.yml on Sube-py/open-codex-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page