Skip to content

Allowing protocol_serde functions to be used externally #1279

Closed
@azriel-healthpoint

Description

@azriel-healthpoint

Describe the feature

#269 indicates issues with implementing Serialize/Deserialize for all types; but since there is code in shape_api_result.rs that serializes this (and other) type(s), could they be made public so that applications can use the same logic, instead of duplicating the types just to enable serialization?

Use Case

Hi! I'm writing a bedrock agent lambda handler, and I'd like to return an ApiResult, as that (looks like) the documented return shape -- I may be wrong here, so please correct me if I am!

However, since it doesn't implement Serialize/Deserialize, which is a requirement of the lambda return type, I need another way of serializing it.

pub(crate) async fn function_handler(event: LambdaEvent<AgentEvent>)
-> Result<ApiResult, Error> {
    //    ^^^^^^^^^ the type here needs to impl Serialize;
    //              a different type can be used as long as
    //              it serializes to the bedrock-agent accepted
    //              response
    // ..
}

Proposed Solution

Probably a larger conversation, since allowing consumers to access the protocol_serde module logic may be too wide a net to cast and support as API.

Other Information

Currently InvokeInlineAgent uses that under the hood (so, client.invoke_inline_agent()..`), but I didn't want to misuse that call as a way to reach the serialization code.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

A note for the community

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue is a duplicate.feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions