Feat/span kind - #32
Merged
Merged
Conversation
The tracer knew what every span was and said so for exactly one of them.
record_retrieval stamped metadata.kind = "retrieval", because the RAG
judges needed {context} and nothing else would do. Tool spans and LLM
spans carried no marker at all, so the backend guessed - and the UI's
guess ended in "everything else is a tool", which drew tool calls that
never happened.
child_span now takes span_kind and puts it on the wire, and the three
places that already know stamp it: trace_tool_call and the merged
framework tool calls say "tool", merged LLM steps say "llm", retrievals
say "retrieval" alongside the metadata they already wrote. The LangChain
handler's own span tree does the same, including "chain" for the graph
nodes it emits.
The flat tool_calls dual-write is untouched. That list is what the
engine's Tool failure check reads and it is a different thing from the
span's kind - one is "this interaction made these calls", the other is
"this span is a call".
Nothing here is required: a span that says nothing still classifies the
way it did, by the backend's fallback ladder. Stating it just means the
answer stops depending on whether the span happened to be named
"LLM Call N".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
child_span took span_kind; tracer.trace() did not, so the one span that
most often knows what it is - the root - had no way to say. An agentic
turn and a single flat LLM call both arrive as a root carrying a model,
and the engine deliberately refuses to guess between them from structure
alone, which leaves saying so as the only way to tell them apart.
with client.tracer.trace("rag-agent", span_kind="agent") as span:
Optional, as everywhere else: a root that says nothing classifies the
way it always did.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
No description provided.