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/cancelinto the orchestrator pipeline. - Runs a fast-response developer agent in single mode, and executes a
selector -> planner -> developer -> reviewerflow 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 loggingsrc/workflows: single/plan workflow logic and execution orchestrationsrc/integrations: Codex executor and MCP status integration layersrc/bot: Telegram update parsing and message splitting/cleanupscripts/telegram_polling_runner.py: operational entry point that receives Telegram messages via long pollingtests:unittestcoverage for command routing, workflow transitions, and integration boundaries (Executor/MCP status)
Requirements
- Python 3.10+
- Environment capable of running
npxandcodex mcp-server(for MCP communication) - Telegram bot token (
TELEGRAM_BOT_TOKENenvironment 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
- Copy the environment template.
cp .env.example .env
- Create the user config directory and copy the default config file.
mkdir -p ~/.codex-orchestrator
cp conf.toml.example ~/.codex-orchestrator/conf.toml
- Update required settings.
- Set your Telegram bot token in
.envunderTELEGRAM_BOT_TOKEN. - Set allowed Telegram user IDs in
~/.codex-orchestrator/conf.tomlundertelegram.allowed_users. - Adjust runtime options such as
codex.*andtelegram.polling.*inconf.toml.
Notes:
- To use a different config file, set
CODEX_CONF_PATHto the desired path. - Path values such as
working_directoryandsystem_prompt_fileare resolved relative to theconf.tomllocation.
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 guidedocs/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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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.