feat: add cekura_metrics_python extension for observability#2148
Open
frank005 wants to merge 1 commit into
Open
feat: add cekura_metrics_python extension for observability#2148frank005 wants to merge 1 commit into
frank005 wants to merge 1 commit into
Conversation
Adds an optional observability extension that forwards transcripts, per-module latency, and session lifecycle events to Cekura (https://cekura.ai) with zero changes to core framework files. Extension: ai_agents/agents/ten_packages/extension/cekura_metrics_python/ - Subscribes to graph-routed signals emitted by ten_ai_base: asr_result (user transcript), text_data (assistant transcript), and metrics (STT/TTS/LLM latency). - Consumes on_user_joined / on_user_left from agora_rtc for session lifecycle, auto-flushing snapshots on an interval while open. - Stays idle with a warning if CEKURA_API_KEY is unset so demos still run unmodified. - Includes unit tests, a detailed README with routing notes, and requirements.txt (aiohttp). voice-assistant example wiring: - Adds the cekura_metrics node to tenapp/property.json with ${env:CEKURA_API_KEY|} / ${env:CEKURA_ASSISTANT_ID|} placeholders; no hardcoded credentials. - Registers the extension path in manifest.json / manifest-lock.json. - Documents the env vars and opt-in behavior in the example README. Notes for reviewers: - No changes to main_python, message_collector2, or any framework code. Tool-call and LLM reasoning streams (routed via explicit set_dests/return_result in main_python) remain out of scope for this PR and can be added later behind an opt-in hook if needed. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional observability extension,
cekura_metrics_python, that forwards conversational data (user + assistant transcripts, per-module latency, session lifecycle) to Cekura — with zero changes to core framework files.ai_agents/agents/ten_packages/extension/cekura_metrics_python/voice_assistantexample as an opt-in node (disabled unlessCEKURA_API_KEYis set, so existing demos are unaffected).requirements.txt(addsaiohttp).What the extension captures (via graph wiring only)
Because
ten_ai_basebase classes emit these signals throughsend_datawithoutset_dests, they are graph-routable and can be fan-out-subscribed inproperty.json:asr_resulttext_dataagora_rtcon_user_joined/on_user_leftmetricsRouting proof (from
core/src/ten_runtime/extension/extension.c:ten_extension_determine_out_msgs): whendest_cnt == 0the runtime consults graph connections and clones the message to every subscriber; whendest_cnt > 0it bypasses graph fan-out. Since TTS/STT/metrics paths inten_ai_basenever callset_dests, this extension can subscribe alongsidemain_controlwithout any framework changes.What is deliberately out of scope for this PR
main_pythonroutes LLM tool-call invocations and reasoning deltas through explicitset_dests/return_resultpaths (tomessage_collectorand tool providers). Those streams are not graph-fan-out and therefore not captured here. A future follow-up could add an opt-in observability hook inmain_pythonif the maintainers want that, but this PR intentionally leavesmain_pythonuntouched. Basic observability (transcripts + latency + session) works fully without it.Files changed
New extension
ai_agents/agents/ten_packages/extension/cekura_metrics_python/(manifest, addon, extension, config, session, client, helpers, tests, README, requirements)Example wiring (
voice-assistant)tenapp/manifest.json— registers the extension pathtenapp/manifest-lock.json— adds the lock entry (v0.1.0)tenapp/property.json— adds acekura_metricsnode (opt-in via${env:CEKURA_API_KEY|}) and connection blockREADME.md— documents env vars (CEKURA_API_KEY,CEKURA_ASSISTANT_ID,CEKURA_METRIC_IDS) and that the demo still runs unchanged when those are unsetSafety
"${env:CEKURA_API_KEY|}").Test plan
tman installresolves the new addon in thevoice-assistantexampleCEKURA_API_KEY— verify the warning logs and conversation flows normallyCEKURA_API_KEY+CEKURA_ASSISTANT_ID— verify a call log appears in the Cekura dashboard with user + assistant transcripts and latency metricspytest ai_agents/agents/ten_packages/extension/cekura_metrics_python/tests/passesCLA
I have read and agreed to the TEN Framework Contributor License Agreement.
Made with Cursor