Version: v1.0
Date: March 6, 2026
Scope: OpenCTO Anyway tracing integration only
This guide documents the current Anyway integration in OpenCTO and how to operate it safely.
Anyway tracing is implemented in the cloudbot worker only.
- Worker:
opencto/opencto-cloudbot-worker - Core file:
opencto/opencto-cloudbot-worker/src/index.ts - Pattern: fail-open trace buffer that never blocks user responses
No Anyway integration is currently wired into:
opencto/opencto-api-workeropencto/opencto-dashboardopencto/mobile-appopencto/cto-orchestrator
Webhook Event (Telegram/Slack/Infobip)
|
v
OpenCTO CloudBot Worker
- span buffer per request
- flush at request completion
|
v
Anyway ingest endpoint
Tracing is enabled only when both are true:
OPENCTO_ANYWAY_ENABLED=trueOPENCTO_ANYWAY_API_KEYis configured
Code location:
anywayEnabled(env)inopencto/opencto-cloudbot-worker/src/index.ts
AnywayTraceBuffer handles:
- trace ID generation
- span start/end with status and attributes
- batched flush to ingest endpoint
Default ingest endpoint:
https://api.anyway.sh/v1/ingest
Request payload shape:
{ traces: [{ trace_id, spans }], metrics: [] }
Cloudbot spans are created around:
- Telegram webhook handling
- Slack webhook handling
- Infobip webhook handling
- lexical and semantic memory retrieval
- OpenAI response generation
| Variable | Purpose |
|---|---|
OPENCTO_ANYWAY_ENABLED |
Global enable flag (true/false) |
OPENCTO_ANYWAY_API_KEY |
Bearer token for ingest auth |
OPENCTO_ANYWAY_ENDPOINT |
Optional custom ingest URL override |
- Set secrets:
wrangler secret put OPENCTO_ANYWAY_API_KEY- Set vars in
wrangler.toml:
OPENCTO_ANYWAY_ENABLED = "true"
OPENCTO_ANYWAY_ENDPOINT = "https://api.anyway.sh/v1/ingest"- Deploy worker:
wrangler deploy- Verify:
GET /healthconfirms worker is up.- Trigger a webhook event.
- Confirm traces arrive in Anyway.
- Integration is explicitly fail-open; telemetry failures are swallowed by design.
- Do not place user secrets in span attributes.
- Treat phone numbers and user IDs as sensitive identifiers; hash/redact where possible before adding new attributes.