#3175·opik

[Bug]: update_current_span creates new trace instead of updating existing LangGraph span

Author: testcoder-uiCreated Sep 3, 2025Updated Sep 16, 2026
LabelsBugdocumentationpythonIntegrationstestsJCPython SDK

What component(s) are affected?

  • Opik Python SDK
  • Opik Typescript SDK
  • Opik Agent Optimizer SDK
  • Opik UI
  • Opik Server
  • Documentation

Opik version

  • Opik version: latest

Describe the problem

When using Opik with LangGraph integration (OpikTracer), each node automatically creates spans. I want to add additional runtime cost information (for a Flux API call, which doesn’t map to token usage) to the current span during execution.

Example:

@tool @track def tool(): cost = calculate_flux_cost() opik_context.update_current_span(total_cost=cost)

Expected behavior: The total_cost is appended to the current LangGraph span opened by OpikTracer, so that the trace reflects the true execution + external API cost.

Actual behavior: A new trace (separate root) is created in Opik instead of updating the existing span, breaking continuity.

Reproduction steps and code snippets

No response

Error logs or stack trace

No response

Healthcheck results

No response