all
I am trying to invoke Bedrock agent using boto3 and I am getting the following error:
botocore.eventstream.InvalidHeadersLength: Header length of 1953527156 exceeded the maximum of 131072
Here is the code I am using:
import boto3
import uuid
bedrock = boto3.client('bedrock-agent-runtime',
aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
region_name=REGION
)
response = bedrock.invoke_agent(
agentId=AGENT_ID,
sessionId=str(uuid.uuid4()),
inputText=INPUT_TEXT,
agentAliasId="",
enableTrace=False,
endSession=False
)
stream = response.get("completion")
if stream:
for event in stream:
chunk = event.get('chunk')
print(f"Agent Chunks: {chunk}")
What could be the issue?
Thanks