Skip to content

fix: Capture systemPrompt in Strands agent model span input - #2311

Open
Alex Jean-Baptiste (justcodebruh) wants to merge 2 commits into
mainfrom
ajb-strand-fix
Open

fix: Capture systemPrompt in Strands agent model span input#2311
Alex Jean-Baptiste (justcodebruh) wants to merge 2 commits into
mainfrom
ajb-strand-fix

Conversation

@justcodebruh

@justcodebruh Alex Jean-Baptiste (justcodebruh) commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Linear Issue: https://linear.app/braintrustdata/issue/SDK-109/typescript-strands-sdk-wrapper-drops-systemprompt-from-model-span

  • The TypeScript Strands plugin read event.agent.messages to build the model span input but never read event.agent.systemPrompt, so the system prompt was silently absent from every model span
  • Add buildModelSpanInput() which prepends a { role: "system", content } message to the input array when systemPrompt is present, matching the behavior already documented for the Python integration
  • Add systemPrompt?: string to the StrandsAgent vendor type

Test plan

  • Existing Strands plugin unit tests pass (src/instrumentation/plugins/strands-agent-sdk-plugin.test.ts — 7 tests ✓)
  • Reproduce locally: run a Strands agent with systemPrompt set via wrapStrandsAgentSDK or auto-instrumentation and confirm the Strands model span input includes a leading { role: "system" } message
  • Confirm agents without systemPrompt are unaffected (input falls back to messages array only)

References

  • Pylon: #19712 (Built Technologies — system prompt missing from Strands agent traces)

The TypeScript Strands plugin read event.agent.messages to build the
model span input but never read event.agent.systemPrompt, so the system
prompt was silently absent from every model span — even though it was
set on the agent and visible in other observability tools.

Add buildModelSpanInput() which prepends a { role: "system", content }
message to the input array when systemPrompt is present, matching the
behavior already documented for the Python integration.

Also add systemPrompt to the StrandsAgent vendor type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@justcodebruh
Alex Jean-Baptiste (justcodebruh) marked this pull request as ready for review July 30, 2026 16:38
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.

1 participant