Current app/repo release: v3.2.3
zb_app is the web, API, and operator surface for Zenbot. In v3 it is a
single App Engine application with an OpenAI-native runtime underneath:
- browser chat and reference pages
- authenticated
zb_apiroutes used by GPT Actions and other clients - review/admin pages
- Responses API chat runtime with prompt caching and provider conversation state
- optional File Search, strict function tools, and background session critic
main.py: Flask routes for browser, API, admin, and review flowsutilities.py: hot-state storage, Responses API adapter, koan lookup, GCS archive helpers, memory logbook helpers, and tool handlerscontracts.py: typed runtime contracts and tool schemasconfig.py: runtime/env/secret resolutionmodels.py: active model registry plus legacy fine-tune catalogscripts/: deploy, vector-store sync, and tooling export helperstemplates/andstatic/: browser UI assets
The v3.2 runtime is App Engine-only:
- one public App Engine service serves browser routes, SSE chat, admin pages, and authenticated API routes from the same host
CHAT_ALLOWED_ORIGINSremains available only for explicit extra browser callers; it is no longer used for a split Zenbot shell/API topology- active conversation state uses Redis/Memorystore when
REDIS_URLis set, then falls back to Firestore, then local memory for development - archived transcripts and generated review/training artifacts stay in GCS
- review manifests and memory workflows remain GCS-backed today, with the new runtime ready for stricter structured backends later
The live Mumonbot path now uses the current OpenAI Python SDK and the Responses API rather than Chat Completions.
Implemented v3 runtime pieces:
- deterministic live botling defaults sourced from
models.py gpt-5.4for critic/judging,gpt-4.1reserved for post-training work- prompt caching via stable
prompt_cache_keyvalues - provider-side conversation continuation via
previous_response_id - optional File Search through configured vector stores
- strict internal function tools:
load_case_contextsearch_exemplarsload_memory_summariesload_memory_entrysave_memory_candidatearchive_sessionenqueue_reviewreport_ui_status
- optional background session critic submissions
The tool catalog can be exported with:
python scripts/export_openai_tool_manifest.pyInspect the live botling presets, model capabilities, and resolved session settings from the shell with:
python scripts/inspect_botlings.py --help
python scripts/inspect_botlings.py
python scripts/inspect_botlings.py --preset fierce_barrier --model set03-bs2lr05e7 --reasoning-effort mediumThe default vector-store sync helper is:
python scripts/sync_openai_vector_store.py --create-
Create or activate a Python environment.
-
Install runtime dependencies:
pip install -r requirements.txt
-
Install dev tooling when needed:
pip install -r requirements-dev.txt
-
Copy
.env.exampleto.envand fill in the values you actually need. -
Run the app from
zb_app:python main.py
Run app commands from this zb_app directory. It is the active Git root for
the deployed Flask/App Engine service; the parent zenbot directory contains
project notes, training data, and historical assets.
OPENAI_API_KEY_SECRET_NAMEFLASK_SECRET_KEY_SECRET_NAMEACTION_API_TOKEN_SECRET_NAMEOPENAI_LIVE_MODELOPENAI_JUDGE_MODELOPENAI_ENABLE_FILE_SEARCHOPENAI_VECTOR_STORE_IDSOPENAI_ENABLE_BACKGROUND_CRITICREDIS_URLSESSION_TTL_SECONDSSTREAMING_ENABLEDWEB_APP_ORIGINCHAT_ALLOWED_ORIGINS
- Browser chat:
/chatter->/chat-> hot session state ->/save_chat-> GCS archive + review manifest upsert + optional background critic - API chat:
/zb_api/chatand/zb_api/chat_case/<case_id>-> same live runtime, no browser cookies required - Memory selection:
/zb_api/load_memory_logbook->/zb_api/load_memory_entry/<serial_number> - Review/admin:
/admin/conversationsand/review
docs/ARCHITECTURE.mddocs/DEVELOPER_GUIDE.mdRECOVERY_RUNBOOK.mdscripts/WHAT_TO_RUN.mdCHANGELOG.md
From the zb_app directory, use the scripts that exist in scripts\:
- Code deploy to App Engine:
scripts\deploy.bat - Docs/settings/search-context update:
scripts\update_context.bat - First-time search-context creation:
scripts\update_context.bat --create - Rotate secrets only:
scripts\rotate_keys.bat - Print the admin/API token:
scripts\get_token.bat
If you want the short explanation, read scripts\WHAT_TO_RUN.md.
python -m pytest -q
python -m flake8
python -m mypy .