Skip to content
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
strands-agents:mainfrom
pgrayy:pgrayy/fix-invoke-async
Draft

fix: access structured-output via kebab-case attr in invoke_async#1102
pgrayy wants to merge 3 commits into
strands-agents:mainfrom
pgrayy:pgrayy/fix-invoke-async

Conversation

@pgrayy

@pgrayy pgrayy commented May 26, 2026

Copy link
Copy Markdown
Member

Description

The _AgentResultAccumulator.finalize() method in strands-py-wasm 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. This caused an AttributeError when using agent.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

  • Added an invoke_async integration test that exercises the fixed code path
  • Both stream_async and invoke_async tests pass

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • My changes generate no new warnings

pgrayy added 3 commits May 26, 2026 10:52
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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant