Boto3 Bedrock Prompt Flow Invoke -> bad alias?

0

Hello,

I'm using a Bedrock Agent to do a recommendation engine. The agent has a Lambda associated with it to invoke certain Prompt Flows. I have this error when trying to invoke the prompt flow that tells me my alias is wrong however I see conflicting info in the docs.

This is how I invoke it: ` response = client.prepare_flow(flowIdentifier="arn:aws:bedrock:us-east-1:123456789:flow/CKUHX8JW7L")

client_runtime = boto3.client('bedrock-agent-runtime')

response = client_runtime.invoke_flow(
    flowIdentifier="arn:aws:bedrock:us-east-1:123456789:flow/CKUHX8JW7L",
    flowAliasIdentifier="arn:aws:bedrock:us-east-1:123456789:flow/CKUHX8JW7L/alias/BOTALIAS1",
    inputs=[
        {
            "content": {
                "document": 
                    user_input
                
            },
            "nodeName": "FlowInput",
            "nodeOutputName": "document"
        }
    ]
)`

This is the error:

"errorMessage": "An error occurred (ValidationException) when calling the InvokeFlow operation: The FlowAliasIdentifier is invalid. Please use a valid Flow Alias Arn or Id.", "errorType": "ValidationException",

The documentation (https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeFlow.html) hints from the regex that the alias should be 10 characters however the UI tells you it can be 100. more info

How can I fix this issue? thank you for your assistance,

Antoine

Antoine
asked 2 months ago452 views
1 Answer
1
Accepted Answer

print(client.list_flow_aliases(flowIdentifier="arn:aws:bedrock:us-east-1:<accountid>:flow/<flowid>")) This is how you get your flow aliases, you don't get to see them on the web page.

Antoine
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile pictureAWS
EXPERT
reviewed 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions