Skip to content

feat: Add support for @strands-agents/sdk#2144

Merged
Luca Forstner (lforst) merged 6 commits into
mainfrom
lforst/strands-instrumentation
Jun 23, 2026
Merged

feat: Add support for @strands-agents/sdk#2144
Luca Forstner (lforst) merged 6 commits into
mainfrom
lforst/strands-instrumentation

Conversation

@lforst

@lforst Luca Forstner (lforst) commented Jun 19, 2026

Copy link
Copy Markdown
Member

Fixes #2115

Comment on lines +882 to +895
function normalizeSerializable(value: unknown): unknown {
if (!isObject(value)) {
return value;
}
const toJSON = value.toJSON;
if (typeof toJSON === "function") {
try {
return toJSON.call(value);
} catch {
return value;
}
}
return value;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just feels like slop tbh. Do we need all this normalization/guarding? We do that anyway before serializing the span to be sent to braintrust.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah unnecessary, removed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this is pure slop. Strands has barely any downloads and I can't justify putting in too much work 💩

Comment thread js/src/instrumentation/braintrust-plugin.test.ts Outdated
| typeof strandsAgentSDKChannels.swarmStream;

export class StrandsAgentSDKPlugin extends BasePlugin {
private readonly activeChildParents = new WeakMap<object, Span[]>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are treating this as a stack w/ pushChildParent and peekChildParent, but that goes against having this as a WeakMap. We should make sure we aren't using it as a stack, otherwise we'll definitely end up with incorrect parent child relationships.

: "";
}

function stringifyUnknown(value: unknown): string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to stringifyUnknown? Shouldn't braintrust span serialization take care of this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also unnecessary, removed

The only thing that I left is the error serialization because Error objects serialize to {} with JSON.stringify()

@lforst Luca Forstner (lforst) merged commit 6f1f848 into main Jun 23, 2026
90 of 92 checks passed
@lforst Luca Forstner (lforst) deleted the lforst/strands-instrumentation branch June 23, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] Strands Agents TypeScript SDK (@strands-agents/sdk) not instrumented — no tracing for agent invocation, tool execution, or model calls

2 participants