openinference icon indicating copy to clipboard operation
openinference copied to clipboard

[ENHANCEMENT]Update Instrumentation LC React

Open arizedatngo opened this issue 8 months ago • 3 comments

Issue:

  • When using create_react_agent from LangChain with Arize Phoenix tracing, the final AI message (agent's answer) is missing from the Phoenix trace data.

Root Cause:

  • Instrumentation Gap: Arize Phoenix (via OpenInference) doesn’t currently capture the final AgentFinish event from LangChain as a distinct span.
  • Callback Missing: The on_agent_finish method in the Arize callback isn’t implemented, so the final AI response is not logged.
  • New API Limitation: create_react_agent is a newer interface, and its tracing support is not fully mature in Phoenix/OpenInference yet.
  • Confirmed by Sean’s Output: The span data pulled via px.Client().query_spans() includes:
  • A HumanMessage (user question)
  • An AIMessage (tool call)
  • A ToolMessage (tool response) ❌ But no span for the final assistant answer.

thanks! just to give you some more context here’s what I got from pulling the spans via px.Client().query_spans it doesn’t have the last AIMessage as a span that’s available in the response.

arizedatngo avatar Apr 02 '25 07:04 arizedatngo

Image Image Image

arizedatngo avatar Apr 02 '25 07:04 arizedatngo

thanks! just to give you some more context here’s what I got from pulling the spans via px.Client().query_spans it doesn’t have the last AIMessage as a span that’s available in the response.

sean_lee.txt

arizedatngo avatar Apr 02 '25 07:04 arizedatngo

Let's add this to triage - @caroger

mikeldking avatar Apr 14 '25 16:04 mikeldking

I haven't hered from @arizedatngo or @sean_lee in slack. I am closing this ticket for now. feel free to reopen this ticket if required any workaround.

satyadevai avatar Aug 13 '25 04:08 satyadevai