This repository was archived by the owner on Jun 3, 2026. It is now read-only.
fix: access structured-output via kebab-case attr in invoke_async#1102
Draft
pgrayy wants to merge 3 commits into
Draft
fix: access structured-output via kebab-case attr in invoke_async#1102pgrayy wants to merge 3 commits into
pgrayy wants to merge 3 commits into
Conversation
The _AgentResultAccumulator.finalize() method accessed stop.structured_output using Python dot notation, but the StopEvent from the WASM runtime is a raw wasmtime Record that stores the field under its WIT kebab-case name 'structured-output'. Use getattr with the kebab-case key to fix the AttributeError. Also adds an invoke_async integration test.
6 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
The
_AgentResultAccumulator.finalize()method in strands-py-wasm accessedstop.structured_outputusing Python dot notation, but theStopEventfrom the WASM runtime is a raw wasmtime Record that stores the field under its WIT kebab-case namestructured-output. This caused anAttributeErrorwhen usingagent.invoke_async().The fix uses
getattr(stop, "structured-output", None)to access the kebab-case attribute directly, which works for both raw Records and the generated wrapper class.Type of Change
Bug fix
Testing
invoke_asyncintegration test that exercises the fixed code pathstream_asyncandinvoke_asynctests passChecklist