Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Unexpected enableTrace Parameter Injection in BedrockFlowsAgent Calls #163

Open
guisartori88 opened this issue Dec 19, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@guisartori88
Copy link

Expected Behaviour

When invoking the BedrockFlowsAgent in a Lambda environment, setting enableTrace=False (or not specifying it at all) should result in no enableTrace parameter being sent to Bedrock. If enableTrace=True is supported as per documentation, it should also not cause the request to fail due to unknown parameters.

Current Behaviour

In AWS Lambda, requests to Bedrock Flows fail with the following error, whether enableTrace is not specified or explicitly set to True:

Parameter validation failed: Unknown parameter in input: "enableTrace", must be one of: flowAliasIdentifier, flowIdentifier, inputs

This issue does not occur when running the same code locally. It appears that enableTrace is being injected internally or not recognized by Bedrock, causing the Bedrock API to reject the payload.

Code snippet

from multi_agent_orchestrator.agents import BedrockFlowsAgent, BedrockFlowsAgentOptions

def my_flow_input_encoder(agent, input, **kwargs):
    # Minimal input encoder
    return {"inputs": {"file_key": input["inputs"]["file_key"]}}

# Tried both with and without enableTrace:
# - Without enableTrace parameter
# - With enableTrace=True as per documentation

sentiment_agent = BedrockFlowsAgent(BedrockFlowsAgentOptions(
    name="sentiment-agent",
    description="Agent for sentiment analysis",
    flowIdentifier="yy",
    flowAliasIdentifier="yy",
    flow_input_encoder=my_flow_input_encoder,
    # enableTrace=True or omitted entirely still causes the error
))

Possible Solution

Investigate if a specific library version or global configuration variable injects enableTrace unexpectedly.

Steps to Reproduce

  1. Deploy the above code to an AWS Lambda function with the multi_agent_orchestrator library.
  2. Attempt to invoke the function:
  • With enableTrace omitted.
  • With enableTrace=True included in BedrockFlowsAgentOptions.
  1. Observe the error indicating enableTrace is an unknown parameter, despite the local environment running the same code without issues.
@guisartori88 guisartori88 added the bug Something isn't working label Dec 19, 2024
@brnaba-aws
Copy link
Contributor

Hi @guisartori88 ,

can you please tell us the version of boto3 you have locally vs the one in lambda?

It might be a boto3 parameter validation issue.

@guisartori88
Copy link
Author

guisartori88 commented Dec 19, 2024

Thank you so much for your response! After adjusting the boto3 version to 1.35.0, as required by the multi-agent-orchestrator==0.1.2, the issue was resolved.

Local Environment:
Version: 1.35.84 Summary: The AWS SDK for Python

Lambda Environment:
"body": "Boto3 version: 1.34.145, Botocore version: 1.34.145"

Conflict Error:

ERROR: Cannot install -r requirements.txt (line 3) and boto3==1.35.84 because these package versions have conflicting dependencies.
The conflict is caused by:
    The user requested boto3==1.35.84
    multi-agent-orchestrator 0.1.2 depends on boto3==1.35.0
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

@brnaba-aws
Copy link
Contributor

This is still strange because boto3 doesn't make any mention of enableTrace: https://boto3.amazonaws.com/v1/documentation/api/1.35.0/reference/services/bedrock-agent-runtime/client/invoke_flow.html

while the API does: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeFlow.html

I'll keep investigate. Thanks

@guisartori88
Copy link
Author

Exactly! That’s why I was having a hard time. Honestly, it was more luck than following the documentation hahaha

Thank you again for looking into this

@brnaba-aws brnaba-aws moved this from Todo to In review in multi-agent-orchestrator board Dec 20, 2024
@cornelcroi cornelcroi added help wanted Extra attention is needed and removed triage bug Something isn't working labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Development

No branches or pull requests

3 participants