Repository navigation
feat(ai): capture builder_ai_used telemetry for every agent turn - #1084
Closed
surajshetty3416 wants to merge 1 commit into
Closed
surajshetty3416 wants to merge 1 commit into
surajshetty3416 wants to merge 1 commit into
Conversation
The only AI usage event, builder_ai_used, was captured in ai_page_generator.py. The move to builder/ai/ dropped it, so Pulse has had no AI usage data since late August. run_agent_job now captures builder_ai_used once per turn, however the turn ended. Properties: outcome (complete, incomplete, awaiting_input, empty, cancelled, error, busy, failed), stop reason, provider and model, effort, tools used, edits applied, whether a page was generated, rounds, LLM calls, token counts, tool failures, image attached, elapsed time, page and session. A custom gateway's route prefix is named by the site, so it is reported as "custom". The capture runs from run_agent_job, so the eval harness, which drives AgentRunner directly, sends nothing. A telemetry failure is logged and never fails the turn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This pull request is closed, so it cannot be queued. Reopen it to get the box back. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1084 +/- ##
========================================
Coverage 81.42% 81.42%
========================================
Files 70 70
Lines 7541 7541
========================================
Hits 6140 6140
Misses 1401 1401 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Builder AI sends no usage telemetry today. The only event,
builder_ai_used, was captured inai_page_generator.py, and the move tobuilder/ai/dropped it. This PR captures it again: one event per agent turn, with what happened in that turn.outcomeis set where each turn already ends:Properties:
outcome,stop_reason,provider,model,effort,tools(sorted tool names),operations,generated_page,rounds,llm_calls,prompt_tokens/cached_tokens/completion_tokens,tool_failures,with_image,elapsed_ms,page,session.ModelRegistry.telemetry_routereports the preset prefix (frappe,openrouter,anthropic, …) orcustom. A custom gateway's prefix is a name the site chose, so it is never sent.run_agent_job, so the eval harness, which drivesAgentRunnerdirectly, doesn't emit events.run_agent_job, so it is captured.Evidence
git grep builder_ai_usedondevelopfinds nothing. In Pulse, the event's last occurrence was 2026-08-25 (62 events from 6 sites, all with empty properties). So far there's no way to chart AI adoption, model mix or failure rate.After: new tests in
builder/ai/test_agent_jobs.py:All other
builder/ai/test_*modules pass locally. The exception istest_preview_image: itssetUppatchesfrappe.utils.chromium, which my local Frappe checkout predates, so it errors there with or without this change.Merge Danger
Door: two-way
This only adds an event. Reverting removes it, and nothing reads it yet apart from the Insights dashboard that will chart it.
Blast Radius: telemetry
Only sites with Pulse enabled send it (
pulse_api_keyset, telemetry on, no developer mode). One event per turn, queued by the Pulse client and not sent inline, so it adds no latency to the turn.🤖 Generated with Claude Code