Telegram orchestrator for running Codex single/plan-agent workflows
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 codex_orchestrator-0.2.3.tar.gz.
File metadata
- Download URL: codex_orchestrator-0.2.3.tar.gz
- Upload date:
- Size: 58.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d68ca192821eaf85268480d1c02771538bca84bb065f406ef5381cd619c546f
|
|
| MD5 |
6ac1abfefe447978b259dce5eac0019e
|
|
| BLAKE2b-256 |
9c7ca21d17af05362e8e8311e549a0ab76b8e506bc2eaf2ccf0a86a21f74c942
|
File details
Details for the file codex_orchestrator-0.2.3-py3-none-any.whl.
File metadata
- Download URL: codex_orchestrator-0.2.3-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eae274e00ee592ae3f4ff6326d25e533fc86ebfadb1998f0df781b261470bb5
|
|
| MD5 |
b3795695ffc8a9442e37d8a7de734d05
|
|
| BLAKE2b-256 |
8925ed9869cae15933d6ffa1030396cfb17a747d5f4e90dbb76cb21bfc1d63d3
|