Skip to content

bug(strands): normalize public reasoning and keep Agent output final-only #282

Closed

Description

@sipercai

Problem

Strands exposes provider-public reasoning as reasoningContent.reasoningText.text. The instrumentation currently passes the raw SDK block into GenAI messages:

{"reasoningContent":{"reasoningText":{"text":"synthetic plan"}}}

This is missing the shared message-part discriminator. It should become:

{"type":"reasoning","content":"synthetic plan"}

The Agent invocation also reuses the model-output converter, so its final output includes the final model's reasoning alongside the answer. Agent output should describe the final result; intermediate reasoning, tool plans and tool results belong to the model/tool spans.

Reproduction and evidence

Using Strands 1.60.0 with the real Agent.invoke_async / Agent.stream_async loop, a deterministic provider, reasoning deltas and actual tool dispatch:

  • Two user turns per session, multiple model decisions and concurrent sessions reproduce both defects.
  • A complex SDK-backed application produces 18 raw reasoning blocks on 18 LLM spans and reasoning in all 6 Agent outputs.
  • Streaming and non-streaming regression assertions fail before the fix. Changing only reasoning conversion still leaves the Agent boundary assertion failing.
  • The application's final answers, SDK messages and tool results are otherwise correct.

These defects predate the separate stream lifecycle fix in #278.

Expected behavior

  • Normalize public reasoning text in model inputs and outputs through the shared Reasoning type.
  • Exclude reasoning signatures, encrypted/redacted reasoning and unavailable text from telemetry.
  • Keep Agent output limited to final result parts, preserving final multimodal parts.
  • Preserve original SDK responses, stream results, tools, usage and context behavior.
  • Apply the same message semantics to span and structured log-event capture.

A focused follow-up fix and regression tests are being prepared.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions