Skip to main content

codex-orchestrator

A Telegram-bot-driven orchestrator for running Codex in single-run mode and plan workflow mode. It receives updates via Telegram long polling and forwards operational commands such as /mode, /profile, and /cancel into the pipeline. It also tracks Codex MCP execution status and stores sessions and trace logs locally.

Key Features

  • Routes Telegram long-polling updates and operational commands such as /mode, /profile, and /cancel into the orchestrator pipeline.
  • Runs a fast-response developer agent in single mode, and executes a selector -> planner -> developer -> reviewer flow in plan mode with up to three review rounds.
  • Restricts access using telegram.allowed_users, so only authorized users can run Codex workflows.
  • Warms up the Codex MCP executor and periodically checks status for stable operation.
  • Stores per-user session data and daily trace files locally, so state can continue after restart and support debugging.
  • Includes timestamps in stdout logs for clearer operational event tracing.

Project Structure

  • src/core: request routing, orchestration, session/profile management, trace logging
  • src/workflows: single/plan workflow logic and execution orchestration
  • src/integrations: Codex executor and MCP status integration layer
  • src/bot: Telegram update parsing and message splitting/cleanup
  • scripts/telegram_polling_runner.py: operational entry point that receives Telegram messages via long polling
  • tests: unittest coverage for command routing, workflow transitions, and integration boundaries (Executor/MCP status)

Requirements

  • Python 3.10+
  • Environment capable of running npx and codex mcp-server (for MCP communication)
  • Telegram bot token (TELEGRAM_BOT_TOKEN environment variable)

Installation

Install from PyPI

python3 -m pip install codex_orchestrator

Install a specific release

python3 -m pip install "codex_orchestrator==<version>"
# Example: python3 -m pip install "codex_orchestrator==0.1.4"

Change version (upgrade/downgrade)

python3 -m pip install --upgrade "codex_orchestrator==<version>"

Resolve error: externally-managed-environment on Ubuntu/Debian

Option 1 (user-local install)

python3 -m pip install --user --break-system-packages codex_orchestrator

Binaries are installed to ~/.local/bin, so update PATH.

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
hash -r

Option 2 (virtual environment)

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -U pip
python3 -m pip install codex_orchestrator

Development setup (run from source)

python3 -m pip install mcp python-dotenv

User Setup

  1. Copy the environment template.
cp .env.example .env
  1. Create the user config directory and copy the default config file.
mkdir -p ~/.codex-orchestrator
cp conf.toml.example ~/.codex-orchestrator/conf.toml
  1. Update required settings.
  • Set your Telegram bot token in .env under TELEGRAM_BOT_TOKEN.
  • Set allowed Telegram user IDs in ~/.codex-orchestrator/conf.toml under telegram.allowed_users.
  • Adjust runtime options such as codex.* and telegram.polling.* in conf.toml.

Notes:

  • To use a different config file, set CODEX_CONF_PATH to the desired path.
  • Path values such as working_directory and system_prompt_file are resolved relative to the conf.toml location.

Run

If installed from PyPI:

codex-orchestrator

If the command is not found, run the binary directly.

~/.local/bin/codex-orchestrator

To run from local source:

PYTHONPATH=src python3 scripts/telegram_polling_runner.py

Tests

Run the full test suite:

PYTHONPATH=src python3 -m unittest discover -s tests -p 'test_*.py' -q

Run a specific module:

PYTHONPATH=src python3 -m unittest -q tests.test_telegram_polling_runner

Telegram Commands

  • /start: show usage and command list
  • /mode single|plan: switch between single mode and plan mode (default: plan)
  • /new: reset the current session
  • /status: report current execution status
  • /cancel: cancel the active request or workflow
  • /profile list|<name>: list available profiles or switch to the specified profile

Runtime Files

  • Session files: ~/.codex-orchestrator/sessions/{chatId}-{userId}.json
  • Trace files: ~/.codex-orchestrator/traces/{yyyy-mm-dd}.jsonl

Additional Docs

  • docs/telegram-integration-runbook.md: Telegram integration operations guide
  • docs/usage-single-mode.md: single-mode usage guide

Metadata

Release files for codex-orchestrator 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codex-orchestrator 0.2.3
File Size Uploaded Provenance Actions
codex_orchestrator-0.2.3.tar.gz 58.6 kB Without provenance Details for codex_orchestrator-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codex-orchestrator 0.2.3
File Interpreter ABI Platform Actions
codex_orchestrator-0.2.3-py3-none-any.whl Python 3 none any Details for codex_orchestrator-0.2.3-py3-none-any.whl

Total release size: 108.4 kB

Release files / codex_orchestrator-0.2.3.tar.gz

Download URL codex_orchestrator-0.2.3.tar.gz
Size 58.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8d68ca192821eaf85268480d1c02771538bca84bb065f406ef5381cd619c546f
BLAKE2b-256 checksum
How to use checksums
9c7ca21d17af05362e8e8311e549a0ab76b8e506bc2eaf2ccf0a86a21f74c942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / codex_orchestrator-0.2.3-py3-none-any.whl

Download URL codex_orchestrator-0.2.3-py3-none-any.whl
Size 49.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5eae274e00ee592ae3f4ff6326d25e533fc86ebfadb1998f0df781b261470bb5
BLAKE2b-256 checksum
How to use checksums
8925ed9869cae15933d6ffa1030396cfb17a747d5f4e90dbb76cb21bfc1d63d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for codex-orchestrator 0.2.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page