Skip to content

[WASM] Integration tests: Structured output #2378

@awsarron

Description

@awsarron

Parent issue

strands-agents/sdk-typescript#1104

Scope

Write integration tests validating structured output (Pydantic model → validated response):

  • Basic Pydantic model as structured_output_model
  • Nested Pydantic models
  • Models with constrained fields (Field validators, enums)
  • result.structured_output returns validated instance
  • Auto-retry on validation failure
  • Per-invocation schema override vs agent-level default

Context

Structured output works by converting a Pydantic model to a JSON Schema, passing it through WIT as a tool spec, and the TS SDK's StructuredOutputTool forces the model to produce conforming JSON. The result crosses back through the event stream and is validated on the Python side.

Done when

  • Simple Pydantic model produces correct structured output
  • Nested models work
  • Validation failures trigger retry
  • result.structured_output is a properly typed Pydantic instance
  • Per-invocation override works alongside agent-level default

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-structured-outputRelated to the structured output apienhancementNew feature or requestpythonPull requests that update python code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions