refactor(trace): move tool spans onto 0.16.6 end() options - #173
Draft
rgao-coreweave wants to merge 1 commit into
Draft
refactor(trace): move tool spans onto 0.16.6 end() options#173rgao-coreweave wants to merge 1 commit into
rgao-coreweave wants to merge 1 commit into
Conversation
0.16.6 deprecates the Tool.result setter and adds ToolEndOptions
{result, errorType}, plus args accepting a JSON object instead of a
pre-serialized string. Drops the deprecated setter and the manual
error.type writes.
Wire format verified identical for object/string/number/false/array
inputs. Two edges handled: tool_input is already guaranteed non-null by
isJsonObject, and a null result keeps the historical empty string rather
than serializing to "null".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 14, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.

0.16.6 deprecates the
Tool.resultsetter and replaces it withToolEndOptions:It also widens
startTool({ args })fromstringtoJsonObject | string. This drops the deprecated setter at all three sites and the manualerror.typewrites thaterrorTypenow covers.args: jsonStr(args.input)becomesargs: args.input, letting the SDK serialize.Wire format checked, not assumed
Ran both paths side by side through an in-memory exporter and compared
gen_ai.tool.call.argumentsandgen_ai.tool.call.result:Two edges came out of that, both handled:
argswith a null input is the only divergence, and it is unreachable:hookHandleralready rejects a non-objecttool_inputviaisJsonObject(which returns false fornull) beforebeginCallruns, soargs.inputis always a plain object."null"under the SDK, where ourjsonStrreturned"". Kept as""withresult: outcome.output ?? ''so this PR stays a pure API migration. Worth revisiting separately if"null"is actually preferable.SubAgentspans keepsetAttributes({ [ATTR.ERROR_TYPE]: … }), sinceerrorTypeexists only onToolEndOptions.Verification
tsc clean, 203/203 pass.
🤖 Generated with Claude Code