feat(agentic): nest search_web verifier in Langfuse and price it - #197
Merged
Conversation
…gfuse ADK OpenInference only records the search_web tool span, so the inner googleSearch and leakage-verifier LiteLLM calls were invisible. Wrap them with langfuse_generation so they nest under the agent trace, and skip the cutoff fence when as_of is today or later so live searches are not stripped. Co-authored-by: Cursor <cursoragent@cursor.com>
Langfuse infers USD from usage types named input/output. The inner search and leakage-verifier calls were sending input_tokens/output_tokens, so token counts showed up but totalCost stayed null. Co-authored-by: Cursor <cursoragent@cursor.com>
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
search_web.google_searchandsearch_web.leakage_verifiergenerations under the ADK agent trace, so the cutoff verifier is visible in Langfuse instead of a black-box tool span.as_ofis today or later, so live searches are not stripped of current news.usage_detailsasinput/output(notinput_tokens/output_tokens) so search and verifier generations get inferred USD cost, matching ADKcall_llmand the LLM-process path.Test plan
SCENARIO_AS_OFin 2026-02/03). Confirm the Langfuse tree hassearch_web→search_web.google_search+search_web.leakage_verifier.costDetails.totalis non-null (not just token counts). Trace-detail Σ should include them plus analystcall_llmcosts.as_ofon/after today and confirm the verifier generation is absent.AGENTspan (null). That is Langfuse #16077; use the trace-detail Σ.Made with Cursor