Skip to content

Feature request: allow customizing serializer on BedrockAgentResolver (parity with BedrockAgentFunctionResolver) #8270

@kimnamu

Description

@kimnamu

Thanks for Powertools — it's our default for Lambda.

Use case

A Bedrock Agent action group that returns non-ASCII text (e.g. Korean 잔액은 1,000원입니다 or emoji) is \uXXXX-escaped in responseBody.body, because BedrockResponseBuilder.build() (event_handler/bedrock_agent.py:42) serializes via the default json.dumps(..., ensure_ascii=True) serializer (api_gateway.py:1625).

Unlike ApiGatewayResolver and the sibling BedrockAgentFunctionResolver — both of which expose a serializer= argument (as noted by the maintainer in #7776) — BedrockAgentResolver.__init__ hardcodes serializer=None (bedrock_agent.py:102-111) with no way to override it. So there's no supported way to emit readable non-ASCII from a Bedrock Agent resolver.

Solution/User Experience

Expose the parent's existing serializer parameter on BedrockAgentResolver (no new abstraction — the same serializer param #6394 endorsed and the sibling function resolver already accepts). Users could then pass partial(json.dumps, ensure_ascii=False).

Alternative solutions

Defaulting the builder to ensure_ascii=False would be a behavior change; exposing the existing param is additive and lower-risk.

I'd be happy to open a small PR with a regression test.


This issue was prepared with the help of an AI agent (Claude Code) and reviewed by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions