Skip to content

feat(agentic): nest search_web verifier in Langfuse and price it - #197

Merged
ethancjackson merged 4 commits into
mainfrom
feat/langfuse-search-verifier-tracing
Aug 26, 2026
Merged

feat(agentic): nest search_web verifier in Langfuse and price it#197
ethancjackson merged 4 commits into
mainfrom
feat/langfuse-search-verifier-tracing

Conversation

@ethancjackson

Copy link
Copy Markdown
Collaborator

Summary

  • Nested search_web.google_search and search_web.leakage_verifier generations under the ADK agent trace, so the cutoff verifier is visible in Langfuse instead of a black-box tool span.
  • Skip the cutoff fence (soft prompt + verifier) when as_of is today or later, so live searches are not stripped of current news.
  • Send Langfuse usage_details as input/output (not input_tokens/output_tokens) so search and verifier generations get inferred USD cost, matching ADK call_llm and the LLM-process path.

Test plan

  • Restart kernel and run energy notebook 03 Stream 3 with a past origin (SCENARIO_AS_OF in 2026-02/03). Confirm the Langfuse tree has search_websearch_web.google_search + search_web.leakage_verifier.
  • On those two generations, confirm costDetails.total is non-null (not just token counts). Trace-detail Σ should include them plus analyst call_llm costs.
  • Optional: run Stream 3 with as_of on/after today and confirm the verifier generation is absent.
  • Note: the traces list Cost ($) column still shows the root AGENT span (null). That is Langfuse #16077; use the trace-detail Σ.

Made with Cursor

ethancjackson and others added 4 commits August 26, 2026 13:26
…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>
@ethancjackson
ethancjackson merged commit 2dec494 into main Aug 26, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant