feat: optional Langfuse tracing for agent execution (#115)

Self-activating langfuse tracing via monkey-patch: independent module, zero impact when langfuse_config unset. Captures LLM generation, tool calls, token usage from SSE streams.

Co-authored-by: totoyang
This commit is contained in:
totoyang
2026-04-20 15:27:55 +08:00
committed by GitHub
parent adc702d3f8
commit 8e6270e3a3
3 changed files with 133 additions and 0 deletions

View File

@@ -939,3 +939,7 @@ class NativeToolClient:
if resp: _write_llm_log('Response', resp.raw)
if resp and hasattr(resp, 'tool_calls') and resp.tool_calls: self._pending_tool_ids = [tc.id for tc in resp.tool_calls]
return resp
try: import langfuse_tracing # opt-in observability; noop if langfuse_config not set in mykey
except Exception: pass