by CharlieDigital · 1mo ago · 0 comments
Both Codex[0] and Claude Code[1] output OTEL traces that you can ingest and process.
Other harnesses like OpenCode, Pi, etc. you can hook into their plugin architecture and implement your own OTEL emission from a plugin (or use an off the shelf plugin[2]).
Host an OpenTelemetry collector[3][4] or rely on your existing collector infra (e.g. Datadog (no affiliation), AppInsights, etc.)
The OTEL traces will have exactly what you need. Tool calls, full prompts, token usage/cost, etc. It is less intrusive and does not become a single-point-of failure since the OTEL emission and collection is best-effort whereas a failing/overloaded proxy is going to strand your team until resolved. It's OK if you lose some OTEL traces; no productivity lost.
The configuration to enable this for Codex and CC is very straightforward (see [0][1] + [5])
--
[0] https://learn.chatgpt.com/docs/config-file/config-advanced#o...
[1] https://code.claude.com/docs/en/monitoring-usage
[2] https://github.com/DEVtheOPS/opencode-plugin-otel
[3] Open source collector: https://opentelemetry.io/docs/collector/
[4] Sample configuration for filtering noise: https://github.com/zeeq-ai/zeeq-app/blob/main/build/otel-col...
[5] Concrete examples of .codex/config.toml and .claude/settings.json: https://zeeq.ai/docs/key-features/session-telemetry#configur...
There have been numerous scandals of AI companies offering CC/cursor alternatives, then indexing data they never should have; specifically Z.ai [0], ByteDance Trae [1] and Alibaba Qwen [2]. Maybe the argument should be that all harnesses should be sandboxed and monitored for all networking.
If it were me, all AI harnesses would be running on a VM with network logging enabled. Beyond not being able to trust what data they send via the harness, you should audit what data they access.
[0] https://www.chosun.com/english/industry-en/2026/09/22/ABYLC3...
[1] https://github.com/segmentationf4u1t/trae_telemetry_research
But I’ve seen approaches using eBPF to collect telemetry to OTEL
[1] https://laminar.sh/blog/2025-12-03-claude-agent-sdk-instrume...
Shameless plug, I've been building Relay for this exact reason. You get real-time visibility into what your agents are doing, how much they're spending, and can set hard limits so things don't spiral out of control. Plus a lot of other features they bring to the table if you want.
It's open source and self-hostable too.
https://github.com/anchorshell/relay https://anchorshell.com/
Maybe you need a decision model to route, or maybe you want to have guardrail-type models pre or post response for an enterprise client.
For supported tools, we collect prompts, responses, and tool calls, then tie them to the user, organizational context and what actually happened on the machine. We can then use this data to detect when agents (or the people piloting them) do bad things [2].
--
If you want to deploy your own collector and write your own handler (e.g. put it into a database), you can generate the stubs for the OTEL payloads and convert to domain records.
1. Get the protos here: https://github.com/open-telemetry/opentelemetry-proto
2. Generate the type/class stubs and endpoints for your platform.
3. I strongly recommend pre-filtering with the open source `opentelemetry-collector` before your custom endpoint handles the inbound telemetry payload. The collector is optimized for performing the filtering and I put it upstream of my custom ingest endpoint on a very small VM just to pre-filter and perform auth checks[0][1] on the inbound channel.
4. Do what you need to with the inbound payloads. Examples below:
- Ingest endpoint (Codex/Claude -> OTEL collector -> API): https://github.com/zeeq-ai/zeeq-app/blob/main/src/backend/Ze...
- Codex telemetry adapter: https://github.com/zeeq-ai/zeeq-app/blob/main/src/backend/Ze...
- CC telemetry adapter: https://github.com/zeeq-ai/zeeq-app/blob/main/src/backend/Ze...
I run my backend on Postgres with partitioned tables. You can forward to Elastic or other OLAP-type database targets for querying. You can see examples of what I do with the session telemetry here: https://zeeq.ai/docs/key-features/session-telemetry
[0] https://github.com/zeeq-ai/zeeq-app/blob/main/build/otel-col...
[1] https://github.com/open-telemetry/opentelemetry-collector-co...
Standards based, many off-the-shelf providers, out-of-process + buffered by default, many standard processors for traces + spans, many tools for storing and querying.
OTEL is pretty widely supported and mostly "just works" at this stage of maturity. A failing/mis-configured OTEL endpoint/collector isn't going to stop you from getting work done in the same way that a failing proxy is. You'll drop some traces, but that's probably OK in most cases.
There is a place for proxies, but those places should share the same failure boundary mode. Meaning if the proxy fails, it should necessarily stop forward agent activity. Example: proxy injection of secrets instead of local acquisition.
AI agents seem like a pretty clear case of this. Both because of recent issues, and that they tend to run on end user devices where strict compliance is harder to maintain.