docs: describe the span tree the SDK now emits - #37
Conversation
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2137167. Configure here.
2137167 to
73fa904
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 73fa904. Configure here.
73fa904 to
1f5aa42
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1f5aa42. Configure here.
1f5aa42 to
619c8ef
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 619c8ef. Configure here.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 619c8ef. Configure here.
619c8ef to
c2a178b
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c2a178b. Configure here.
c2a178b to
cc0eb52
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit cc0eb52. Configure here.
cc0eb52 to
b2b3c53
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b2b3c53. Configure here.
b2b3c53 to
c139584
Compare
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 73c9dd7. Configure here.
73c9dd7 to
537233e
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 537233e. Configure here.
537233e to
3ebb6af
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3ebb6af. Configure here.
3ebb6af to
1f36055
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1f36055. Configure here.
1f36055 to
46af84b
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 46af84b. Configure here.
46af84b to
eb6b7b8
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit eb6b7b8. Configure here.
README and AGENTS.md both still described one flat span per call with four attributes, which is what this SDK emitted before the span work and what neither SDK emits now. A reader following either document would have built the wrong thing. README gains the tree, the rule that tool spans are siblings of chat rather than children, why the root is the only span carrying the LaunchDarkly identity and the run total, and what prompt caching does to the input count. The Anthropic example is the one worth keeping in mind: the provider reports an input of 3 for a turn that processed 23,554 tokens. It also documents that conversation content is off by default and how to turn it on, since that is the change most likely to surprise someone who was reading prompts off their spans. AGENTS.md now points at TELEMETRY-CONTRACT.md as the authority rather than restating a summary that can drift from it, and lists the shared helpers with what each one writes. The instruction that matters most is not to hand-write a span.set_attribute for anything a helper covers: six hand-rolled copies is how these spans drifted apart in the first place. It also records the three things a new handler author would otherwise get wrong: that cache folding belongs at the call site and not in the shared writer, that finish reasons have three mechanisms rather than one, and that `except Exception` does not catch the GeneratorExit a streaming consumer triggers by breaking out of the loop. Each handler package's agents.md gets a four-line note with its span shape and a pointer to the contract, so someone opening one package sees it without reading the root document first. Fixes the README's install command, which named a package that does not exist: launchdarkly-ai rather than launchdarkly-ai-python.
eb6b7b8 to
bc7815a
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bc7815a. Configure here.
Updates the docs to describe the span tree the SDK now emits.
README and AGENTS.md both still described one flat span per call with four attributes, which is what this SDK emitted before this stack and what neither SDK emits now. A reader following either document would have built the wrong thing.
README
chatrather than children.Also fixes an install command that named a package which does not exist:
launchdarkly-airather thanlaunchdarkly-ai-python.AGENTS.md
Now points at
TELEMETRY-CONTRACT.mdas the authority rather than restating a summary that can drift from it, and lists the shared helpers with what each one writes.The instruction that matters most is not to hand-write a
span.set_attributefor anything a helper covers: six hand-rolled copies is how these spans drifted apart in the first place.It also records the three things a new handler author would otherwise get wrong:
except Exceptiondoes not catch theGeneratorExita streaming consumer triggers by breaking out of the loop.Per-package docs
Each handler package's
agents.mdgets a four-line note with its span shape and a pointer to the contract, so someone opening one package sees it without reading the root document first.Where this sits
Top of the stack. Docs only, no code.
Note
Overview
Documentation now matches the three-level OpenTelemetry span tree handlers emit (
invoke_agent→chat {model}→execute_tool), replacing the outdated “one flat span per call” description.README adds user-facing coverage of the span hierarchy (tool spans as siblings of
chat), why LaunchDarkly identity and run totals live on the root span, prompt-cache folding intogen_ai.usage.input_tokens, default-off conversation content viacapture_content=True, and abandoned-stream handling. It also corrects the OTel install line tolaunchdarkly-ai-python[otel]instead of the non-existentlaunchdarkly-ai[otel]package name.AGENTS.md defers span specifics to
TELEMETRY-CONTRACT.md, lists sharedlaunchdarkly_ai_serverspan helpers, and documents handler-author pitfalls: explicit parent context, per-provider cache folding at the call site, gated content capture, finish-reason differences, and streaming cleanup infinallyforGeneratorExit.Each Tier 1 handler package
agents.mdgets a short header pointing at the same span shape,spans.py, and the contract file.Reviewed by Cursor Bugbot for commit bc7815a. Bugbot is set up for automated code reviews on this repo. Configure here.